home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR2 / DINFO6.ZIP / 1137 < prev    next >
Text File  |  1994-01-10  |  6KB  |  174 lines

  1.                      WordPerfect Corporation
  2.                 InfoShare Information Fax Service
  3.                          (800) 228-9960
  4.  
  5. Title:   Merge: Creating a Fixed Length Secondary File
  6. Product: WordPerfect 5.1 for DOS 
  7. Number:  1137-11/93 
  8.  
  9. Problem
  10. You want to create a fixed length data file from a WordPerfect
  11. secondary merge file so that you can export the WordPerfect merge
  12. file into a database.
  13.  
  14.  
  15. Concept
  16. Many databases set fixed lengths for each field.  When you port a
  17. merged file from WordPerfect into a database, each field needs to
  18. have the correct number of characters, whether the characters are
  19. text or blank spaces.
  20.  
  21.  
  22. Solution
  23. In order to put the file in fixed field length, you will need to
  24. create a primary file with these commands.  The steps below show
  25. in detail how to create this primary file.
  26.  
  27.           {ASSIGN}1~{LEN}{FIELD}1~~+1~{COMMENT}
  28.           ~{FIELD}1~{FOR}X~{VARIABLE}1~~30~1~ {END FOR}{COMMENT}
  29.           ~{PAGE OFF}
  30.  
  31. Note:  You will need to know the specific length of each field
  32. before you begin.
  33.  
  34. 1    Press Merge Codes (Shift+F9), then choose More (6).  Type a
  35.      to search for the {ASSIGN} command.  Press Enter when it is
  36.      highlighted.
  37.  
  38. 2    Type 1 and press Enter at the Enter Variable prompt, then
  39.      press Enter at the Enter Expression prompt.
  40.  
  41. 3    Use the backspace key to delete the last tilde (~).
  42.  
  43. 4    Press Merge Codes (Shift+F9), then choose More (6).  Type le
  44.      to search for the {LEN} command.  Press Enter when it is
  45.      highlighted.
  46.  
  47. 5    Press Enter at the Enter Expression prompt.  Then use the
  48.      backspace key to delete the tilde (~).
  49.  
  50. 6    Press Merge Codes (Shift+F9).  Choose Field (1).  Type 1 and
  51.      press Enter, then type a tilde (~).
  52.  
  53. 7    Type a plus sign (+), then the number 1, then type another
  54.      tilde (~).
  55.  
  56. The command line you have just created assigns the length of the
  57. field to {VARIABLE}1~.
  58.  
  59. 8    Press Merge Codes (Shift+F9), then choose More (6).  Type co
  60.      to search for the {COMMENT} command.  Press Enter when it is
  61.      highlighted.
  62.  
  63. 9    Press Enter at the Enter Comment prompt.
  64.  
  65. 10   Press Left Arrow, then Enter.
  66.  
  67. The {COMMENT} command allows you to go to the next line without
  68. adding a [HRt] into the merged file.
  69.  
  70. 11   Press Merge Codes (Shift+F9).  Choose Field (1).  Type 1,
  71.      then press Enter.
  72.  
  73. The contents of field 1 will be printed.
  74.  
  75. 12   Press Merge Codes (Shift+F9), then choose More (6).  Type fo
  76.      to search for the {FOR} command.  Press Enter when it is
  77.      highlighted.
  78.  
  79. 13   Type X at the Enter Variable prompt, then press Enter.
  80.  
  81. 14   Press Enter at the Start, Stop, and Step prompts.  Then use
  82.      the backspace key to delete the three tildes (~).
  83.  
  84. 15   Press Merge Codes (Shift+F9), then choose More (6).  Type v
  85.      to search for the {VARIABLE} command.  Press Enter when it
  86.      is highlighted.
  87.  
  88. 16   Type 1 and press Enter, then type a tilde (~).  
  89.  
  90. You now need to use the specific field lengths.  For our example,
  91. we will use 30 as the length of field 1 and 20 for the length of
  92. field 2.
  93.  
  94. 17   Type 30, a tilde (~), then 1 and another tilde (~).
  95.  
  96. This command line is a loop: it will determine the number of text
  97. characters in each field, then will fill the rest of the field
  98. with blank spaces. {VARIABLE}X remembers where you are in the
  99. loop.  Start:({VARIABLE}1~) is the number of characters already
  100. in the field.  Stop:(30) is the length of the field (in this
  101. example the field is 30 characters).  Step:(1) tells the merge
  102. how it is to increment each time through the loop.  In this case
  103. it increments one step at a time.
  104.  
  105. 18   Press the space bar once.  This will fill in the extra
  106.      characters with spaces.
  107.  
  108. 19   Press Merge Codes (Shift+F9), then choose More (6).  Type
  109.      end, press the space bar, and type for to search for the
  110.      {END FOR} command.  Press Enter when it is highlighted.
  111.  
  112. The {END FOR} command designates the end of the {FOR} loop you
  113. created earlier on the line.
  114.  
  115. 20   Press Merge Codes (Shift+F9), then choose More (6).  Type co
  116.      to search for the {COMMENT} command.  Press Enter when it is
  117.      highlighted.
  118.  
  119. 21   Press Enter at the Enter Comment prompt.  
  120.  
  121. 22   Press Left Arrow, then press Enter.
  122.  
  123. You now need to repeat steps 1 through 22 for each field.  Make
  124. sure to change the field number and the number of characters in
  125. each field (in the first field, there were 30 characters).  You
  126. can use the Block and Copy features of WordPerfect to do this
  127. quickly, but remember to make the necessary changes for each
  128. field.
  129.  
  130. When you have finished adding merge information for each field, 
  131.  
  132. 23   Press Merge Codes (Shift+F9).  Choose Page Off (4).  (Make
  133.      sure that the tilde (~) is at the beginning of the row.)
  134.  
  135. 24   Press Enter to place a hard return after the Page Off
  136.      command.
  137.  
  138. You are now ready to merge the files.
  139.  
  140. 25   Save the primary file you have just created.
  141.  
  142. 26   Merge the primary file with the secondary file.
  143.  
  144. If the merge doesn't work properly, make sure that all the tildes
  145. (~) are in the correct place and that you have the correct number
  146. of them.  Also make sure that there is a {COMMENT} code at the
  147. end of the first two lines and that the corresponding tildes (~)
  148. are at the beginning of the second and third lines.
  149.  
  150. After the files are merged, you must save the new merged file as
  151. an ASCII file so that it can be ported into other databases.
  152.  
  153. 27   Press Text In/Out (Ctrl+F5), then choose Save As (3).
  154.  
  155. 28   Choose Generic (1).  Type the file name and press Enter.
  156.  
  157. The merged file will remain on the screen.  When you exit that
  158. screen, do not save the file again.
  159.  
  160.  
  161. See Also
  162. *    Appendix K: Macros and Merge, Programming Commands in the
  163.      WordPerfect 5.1 for DOS reference manual
  164.  
  165.  
  166.  
  167. WordPerfect Corporation 1993
  168.  
  169. WordPerfect Corporation
  170. 1555 N. Technology Way
  171. Orem, UT 84057-2399
  172.  
  173. WordPerfect is a registered trademark of WordPerfect Corporation
  174. within the United States and other countries..