home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / datamage.zip / DOCS.ZIP / COPY.DOC < prev    next >
Text File  |  1991-02-09  |  16KB  |  335 lines

  1.                                POWER COPY PROGRAM
  2.  
  3.  
  4.  
  5. The  copy program moves selected data from selected records in a selected  file
  6. in a specified manner into selected records in another selected file.   Another
  7. way of looking at it is that it does inter-file updates.
  8.  
  9. Like  the  BASE  programs, it is a tool to do many different  tasks.   It  will
  10. expand  a  datafile  to include more data, create a fragment of  a  file,  post
  11. transactions  into a file, merge one or more files into another file, and  will
  12. create records in the target file during execution.
  13.  
  14. There are two basic kinds of operations executed by POWER COPY:
  15.  
  16.  
  17.                            FILE CREATION OPERATIONS
  18.  
  19.  
  20. FILE REORGANIZATION:
  21.  
  22. Probably the most frequent use of POWER COPY is to move data from one format to
  23. another.  To re-organize a file you first use the DBSEMAKR program to load  the
  24. current format of the file and edit it.
  25.  
  26. Just before you save the new format it's handy to print the new format.  You'll
  27. have  a  nice list of the fields in the new file.  As you remove  the  printout
  28. from your printer mark it NEW.  Then save the new file format.
  29.  
  30. To  get a list of the fields in the current file load it with the BASE  program
  31. then press F-3.  Make the printout OLD.
  32.  
  33. Next,  it's  necessary to get the data into the new format by using  the  POWER
  34. COPY program to move it between the files.  Should anything go wrong during the
  35. process or the new file be found lacking in some manner the old file remains in
  36. tact.  You get to examine the new file before deleting the old.
  37.  
  38. To  perform  a reorganization start POWER COPY and select the old file  as  the
  39. first SOURCE file, and the new formatted, empty file as the second TARGET file.
  40.  
  41. Your  speaker will inform you that the target file has no records and ask  your
  42. approval, it's OK.  Since the target file has no records much of the POWER COPY
  43. program will be skipped over, and your next task will be to identify the source
  44. and  target  fields.  Opt for pairing by absolute field numbers.   The  program
  45. will find any fields you moved, re-named or re-sized.
  46.  
  47. After  the program performs automatic segment pairing you will browse the  move
  48. pairs.   You  have  full editing capabilities.  You may  edit  existing  moves,
  49. delete moves, add moves.  Looking at your lists, edit the move pairs until  you
  50. get your fields going where you wish.
  51.  
  52. Then, press F-9 to execute the inter-file update.
  53.  
  54. FILE FRAGMENTATION:
  55.  
  56. There  are  many reasons you might want a datafile containing  certain  records
  57. from  another  datafile.  They are the same reasons you might want  a  printout
  58. detailing certain records in a datafile.
  59.  
  60. You  have some customers that are behind on they're accounts.  Sally  can  call
  61. them,  and chat them up.  She has a computer on her desk and a  DATAMAGE.   She
  62. can use the file fragment as a basis for her calls better than a printout.
  63.  
  64. To make a file fragment you first need to identify the records to be  included.
  65. The  BASE  program  offers  the  means to do  this:   The  select  records  and
  66. calculation routines.  After you have your group write it into a MARKER FILE by
  67. pressing F-10.  This records the group to disk.
  68.  
  69. Then  exit the system to prepare a place for the file fragment.  Place a  blank
  70. floppy in A:.  Enter MD A:FRAG (or whatever).  Then, assuming your source  file
  71. is  C:\MAGE\FILE1,  enter  COPY C:\MAGE\FILE1\*.SAD A:\FRAG.   You  copied  the
  72. definition  files into the FRAG directory on A:, effectively creating an  empty
  73. DATAMAGE file.
  74.  
  75. Start  the DATAMAGE system and select POWER COPY from the first  menu.   Select
  76. your  source  file as C:\MAGE\FILE1.  When prompted for the target  file  press
  77. escape, then enter A:, and select FRAG from the menu.
  78.  
  79. Opt  to move data from records in a marker file and select the marker you  just
  80. made  from the menu.  You will see the segment pairing screen.  Since you  have
  81. not  edited the file's format option 2, automatic segment pairing is  bound  to
  82. find  all  the fields in both files.  When you see the browse  display  of  the
  83. segment pairs just press F-9, no need to check them.
  84.  
  85. PACKING DATAFILES:
  86.  
  87. DATAMAGE  files never get any smaller.  When records are deleted holes open  up
  88. in  the file.  The programs will fill these holes before allocating  more  disk
  89. space  for the file.  In the case of a file with many holes the  index  search,
  90. select  records and calculation routines are slowed by having to jump over  all
  91. the holes and disk space is wasted.
  92.  
  93. Packing  datafiles also offers an opportunity to order the records  however  we
  94. wish.   By using the BASE program to order the records, writing a marker  file,
  95. then  opting to use that marker file while transferring the records with  POWER
  96. COPY  we  can place the current records in the new file in  whatever  order  we
  97. like.  This comes in handy.
  98.  
  99. To  pack a datafile you make another directory to hold the new file.  Say  your
  100. old  file  was C:\MAGE\FILE1.  You might make a directory on  a  floppy  called
  101. junk.   Then  you  enter  COPY C:\MAGE\FILE1\*.SAD  A:JUNK.   This  copies  the
  102. definition  files into your directory, and effectively makes an empty  DATAMAGE
  103. file on the floppy.
  104.  
  105. Start POWER COPY and select your old file in C:\MAGE\FILE1 as the source  file.
  106. When prompted for the target file press escape, then enter A:.  Select the JUNK
  107. dir  you  just made.  The speaker will beep and you will be informed  that  the
  108. target file has no records, that's OK.
  109.  
  110. You will see the segment pairing screen.  Since you have not edited the  file's
  111. format  option 2, automatic segment pairing is bound to find all the fields  in
  112. both files.  When you see the browse display of the segment pairs just press F-
  113. 9, no need to check them.
  114.  
  115. The data is transferred to the floppy and a new index is built.  If any records
  116. should  fail the index check error messages will print and the record will  not
  117. be brought into the new file.
  118.  
  119. After  the POWER COPY program ends load the new file with the BASE program  and
  120. verify it by looking at the first, last and middle records.  If the file is  OK
  121. then delete C:\MAGE\FILE1\*.RAD.  Then COPY A:\JUNK\*.RAD C:\MAGE\FILE1.
  122.  
  123.  
  124.  
  125.                          MOVING DATA BETWEEN TWO FILES
  126.  
  127.  
  128.  
  129. The  task  of  moving  data from any file, to  any  file  (provided  they  have
  130. something in common) consists of four steps:
  131.  
  132. 1.  Identify the source and target files.
  133.  
  134. The  files are selected in the same manner as the BASE  programs, and  you  may
  135. opt  to  move data from the records contained in a MARKER file created  by  the
  136. base programs, or all records in the source file.
  137.  
  138. 2.  Identify the record pairs.
  139.  
  140. The record pairs can be entered from the keyboard, or automatically found.
  141.  
  142. 3.  Identify the data to be moved, and the format to be used.
  143.  
  144. If  you  are moving string data you may replace the current data  recorded,  if
  145. any,  with  the value being moved, or append that value to  the  current  value
  146. stored in the target record.
  147.  
  148. If  you  are  moving numeric data, you may  add,  subtract,  multiply,  divide,
  149. or replace the data now stored, if any.  If you divide, and there is a zero  in
  150. the source field ALL DATA TRANSFER within that record pair will be aborted, and
  151. an error message will be written to the printer.
  152.  
  153. 4.  Execute the inter-file update.
  154.  
  155. The screen will be active during execution, and tell you what's going on.
  156.  
  157. Since  numbers 1 and 4 above are fairly self-explanatory, the two  sections  to
  158. follow  describe number 2, IDENTIFY RECORD PAIRS, and number 3,  IDENTIFY  MOVE
  159. DATA in more detail.
  160.  
  161. RECORD PAIR IDENTIFICATION:
  162.  
  163. The  record pairs are a source record and a target record.  Some or all of  the
  164. data in the source record will be moved into the target record.  The records in
  165. the source and target files may be matched in several ways.
  166.  
  167. Automatic record pair definition can be done by the program.  The basis of  the
  168. pairs can be the user-assigned record numbers, or the content of a field in the
  169. source record, and the matching content of a field in a target record.
  170.  
  171. In  the  case of using record numbers the records in the source file  would  be
  172. matched  to a record in the target file by their record numbers and data  would
  173. be moved between records of the same number.
  174.  
  175. When  records are matched by the content of a field the specified field in  the
  176. source  record  is  searched for in the specified field  in  the  target  file.
  177. Multiple  matches  may  be found, i.e. more than one source  record  bears  the
  178. number of a target record in the specified field.
  179.  
  180. SELECTING THE DATA TO MOVE:
  181.  
  182. Once you have your record pairs like you want them, opt to continue the process
  183. and  select  the  data  to be moved from the source  records  into  the  target
  184. records.   Again, you may enter the segment pairings, or the program will  find
  185. fields of the same absolute record number and align them for you.
  186.  
  187. If you are moving numeric data you may include the operation to be done in  the
  188. source records.  The source file would include a numeric field to be tested  in
  189. each record, and action taken according to its' content.
  190.  
  191. The copy program refers to such a field as a TEST field.  You could use a  test
  192. field  to connote whether a record represented a receipt of stock, or an  order
  193. filled  from  stock.  The former would require the amount to be  added  to  the
  194. current balance, and the latter that it be subtracted.
  195.  
  196. The test filed must hold a code, 1 through 5.  1=add, 2=subt, 3=mult,  4=divide
  197. and  5=replace.   So,  the  copy program could  deal  with  a  file  containing
  198. receipts, orders filled, and manual inventory adjustments.  What you would  use
  199. multiply and divide for I don't know, but they're there if you think  something
  200. up to use them for!
  201.  
  202. You  can  BROWSE and edit the moves before execution. When you  have  the  data
  203. going where you want, execute the move.
  204.  
  205.  
  206.  
  207.                                 ERROR TRAPPING
  208.  
  209.  
  210.  
  211. The copy program can catch errors in the source and target files, and alert you
  212. to their presence before executing the inter-file update.  To do this it  finds
  213. DUPLICATIONS in the source, target, or both datafiles.
  214.  
  215. Suppose  we  were moving data from a batch of stock receipts to  our  inventory
  216. file.  On a floppy, we have a group of records, each representing something  we
  217. got,  checked,  and put in stock.  Maybe this floppy is for the first  week  in
  218. March,  or  whatever.  All week, when something came in, somebody  recorded  it
  219. onto a floppy in a computer downstairs.
  220.  
  221. In this case, the copy program would be directed to match records in the source
  222. file (the floppy) and records on the HD (the inventory file) by the contents of
  223. the fields that held our part number.
  224.  
  225. Duplicates  in  the source records would not constitute an  error,  because  we
  226. might  well  have received more than one shipment of a part in the  same  week.
  227. Duplicates in the TARGET file, however, would constitute a serious error.
  228.  
  229. So,  we  would  direct the program to process all  record  pairs  containing  a
  230. duplicated target as errors:  to ignore them and list them to the printer.
  231.  
  232. Many  scenarios  exist  where duplicates in th  source  file  would  constitute
  233. errors,  duplicates  in either file would be an error, or dupes in  both  files
  234. would be OK.
  235.  
  236. So,  the copy program will detect, ignore and list source, target, both  or  no
  237. dupes during the automatic record pairing process.
  238.  
  239. After record pairing is accomplished, the program allows BROWSING of the  pairs
  240. found, source records finding no match, target records not accessed by a  move,
  241. and  the entire source or target file.  You may find pairs the computer  didn't
  242. and add them, or you may delete/edit record pairs the computer did find.
  243.  
  244. Or,  you  may  opt to end power copy.  Presumably to make  corrections  in  the
  245. files, or if you were just checking their alignment on the screen.
  246.  
  247. RUN-TIME ERRORS:
  248.  
  249. During the execution of the inter-base update, several conditions can cause the
  250. movement  of  data between the source and target record to be aborted.   If  an
  251. error  occurs the program will list an error message to the  printer  detailing
  252. the error, and the affected source record and target record.
  253.  
  254. DIVISION BY ZERO ERROR:
  255.  
  256. When  moving data to a numeric segment the current value can be divided by  the
  257. data  selected to be moved from the target record.  If the value to be  divided
  258. BY  is  zero  the operation is impossible and, if left  alone,  would  cause  a
  259. machine  error  that would stop the program dead, and leave you  with  a  badly
  260. messed up target file.
  261.  
  262. ILLEGAL ACTION CODE ERROR:
  263.  
  264. The  copy program allows the testing of a field in the source record,  and  the
  265. selection of a numeric update process according to it's content.  The allowable
  266. values  in  the  test field are 1-5.  If a value other than 1-5  is  found  the
  267. transfer will be aborted.
  268.  
  269. TARGET DUPLICATION ON UNIQUE INDEX:
  270.  
  271. The  copy program will REFUSE to change a segment in a target record if  it  is
  272. indexed unique or cross-indexed.  It will, however, move data to indexed fields
  273. in  a record that is created during the inter-base update.  Before writing  new
  274. records in an indexed target file the record is checked for duplications on the
  275. indexes.  If a duplicate in a field indexed as unique is found the transfer  is
  276. aborted.  The number of the indexed field is listed to the printer.
  277.  
  278. TARGET DUPLICATION ON CROSS-INDEX:
  279.  
  280. If the index of the target file contains a cross-index it will also be checked.
  281. If a duplicate is found it will abort the creation of the new record, and print
  282. the proper error message.
  283.  
  284.  
  285.  
  286.  
  287.  
  288.                                 GETTING STARTED
  289.  
  290.  
  291.  
  292. The way to use this, or any other program is to practice a few times.  So, from
  293. DOS,  make a new directory off the MAGE directory of C:, or on a floppy.   Copy
  294. into it the datafile definition files of the CUSTOMER sample datafile  supplied
  295. with the package by entering "COPY ..\CUSTOMER\*.SAD".
  296.  
  297. Start DATAMAGE, load the copy program from the function selection menu, specify
  298. th original CUSTOMER sample datafile as the source, (load a marker if you wish)
  299. and  the  new datafile as the target.  The speaker will beep, and you  will  be
  300. informed that the target file has no records.  That's OK.
  301.  
  302. Select  automatic  segment pairing, then execute the copy  operation.   If  you
  303. loaded a marker file, you just made a fragment of the source file.  If not, you
  304. just made a copy of the CUSTOMER sample datafile, the hard way!
  305.  
  306. Load  the BASE program from the function selection screen, and access the  file
  307. you just created.  Examine the file to verify it is as it should be.
  308.  
  309. Now  that you have two files, end the BASE program and select the copy  program
  310. again.   This time, select as source the original CUSTOMER, and as  target  the
  311. new  file.   You  will be presented with a lot you didn't see  the  last  time,
  312. because now there are records in both files.
  313.  
  314. Opt  to  align the records first pass on the contents of  segment  one,  record
  315. name,  and  tell  the copy program not to ignore duplicates in  the  source  or
  316. target files, as there are none.
  317.  
  318. When  the  datafiles  are aligned, press escape to view  the  BROWSE  functions
  319. available,  and look at the list of record pairs being displayed.  Then opt  to
  320. end the program.
  321.  
  322. Select  power  copy again, and the same source and target  files.   This  time,
  323. align on segment three, title.  Take a pass through the program rejecting dupes
  324. in the source, target, and both datafiles, and browse the results.
  325.  
  326. You  can't  hurt the sample datafiles, you have plenty of copies of  them.   Go
  327. ahead and try the functions offered by the copy program, read the help  screens
  328. where offered, and try to familiarize yourself with the program as a tool, with
  329. certain  capabilities, without thinking about a specific task.  Later, you  can
  330. match  those capabilities to a task better if you understand them all,  instead
  331. of picking out what you need right now, and skipping over the rest.
  332.  
  333. There  are many options included in the copy program that are best  learned  by
  334. selecting them and viewing the results.
  335.