home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
High Voltage Shareware
/
high1.zip
/
high1
/
DIR2
/
DINFO6.ZIP
/
1137
< prev
next >
Wrap
Text File
|
1994-01-10
|
6KB
|
174 lines
WordPerfect Corporation
InfoShare Information Fax Service
(800) 228-9960
Title: Merge: Creating a Fixed Length Secondary File
Product: WordPerfect 5.1 for DOS
Number: 1137-11/93
Problem
You want to create a fixed length data file from a WordPerfect
secondary merge file so that you can export the WordPerfect merge
file into a database.
Concept
Many databases set fixed lengths for each field. When you port a
merged file from WordPerfect into a database, each field needs to
have the correct number of characters, whether the characters are
text or blank spaces.
Solution
In order to put the file in fixed field length, you will need to
create a primary file with these commands. The steps below show
in detail how to create this primary file.
{ASSIGN}1~{LEN}{FIELD}1~~+1~{COMMENT}
~{FIELD}1~{FOR}X~{VARIABLE}1~~30~1~ {END FOR}{COMMENT}
~{PAGE OFF}
Note: You will need to know the specific length of each field
before you begin.
1 Press Merge Codes (Shift+F9), then choose More (6). Type a
to search for the {ASSIGN} command. Press Enter when it is
highlighted.
2 Type 1 and press Enter at the Enter Variable prompt, then
press Enter at the Enter Expression prompt.
3 Use the backspace key to delete the last tilde (~).
4 Press Merge Codes (Shift+F9), then choose More (6). Type le
to search for the {LEN} command. Press Enter when it is
highlighted.
5 Press Enter at the Enter Expression prompt. Then use the
backspace key to delete the tilde (~).
6 Press Merge Codes (Shift+F9). Choose Field (1). Type 1 and
press Enter, then type a tilde (~).
7 Type a plus sign (+), then the number 1, then type another
tilde (~).
The command line you have just created assigns the length of the
field to {VARIABLE}1~.
8 Press Merge Codes (Shift+F9), then choose More (6). Type co
to search for the {COMMENT} command. Press Enter when it is
highlighted.
9 Press Enter at the Enter Comment prompt.
10 Press Left Arrow, then Enter.
The {COMMENT} command allows you to go to the next line without
adding a [HRt] into the merged file.
11 Press Merge Codes (Shift+F9). Choose Field (1). Type 1,
then press Enter.
The contents of field 1 will be printed.
12 Press Merge Codes (Shift+F9), then choose More (6). Type fo
to search for the {FOR} command. Press Enter when it is
highlighted.
13 Type X at the Enter Variable prompt, then press Enter.
14 Press Enter at the Start, Stop, and Step prompts. Then use
the backspace key to delete the three tildes (~).
15 Press Merge Codes (Shift+F9), then choose More (6). Type v
to search for the {VARIABLE} command. Press Enter when it
is highlighted.
16 Type 1 and press Enter, then type a tilde (~).
You now need to use the specific field lengths. For our example,
we will use 30 as the length of field 1 and 20 for the length of
field 2.
17 Type 30, a tilde (~), then 1 and another tilde (~).
This command line is a loop: it will determine the number of text
characters in each field, then will fill the rest of the field
with blank spaces. {VARIABLE}X remembers where you are in the
loop. Start:({VARIABLE}1~) is the number of characters already
in the field. Stop:(30) is the length of the field (in this
example the field is 30 characters). Step:(1) tells the merge
how it is to increment each time through the loop. In this case
it increments one step at a time.
18 Press the space bar once. This will fill in the extra
characters with spaces.
19 Press Merge Codes (Shift+F9), then choose More (6). Type
end, press the space bar, and type for to search for the
{END FOR} command. Press Enter when it is highlighted.
The {END FOR} command designates the end of the {FOR} loop you
created earlier on the line.
20 Press Merge Codes (Shift+F9), then choose More (6). Type co
to search for the {COMMENT} command. Press Enter when it is
highlighted.
21 Press Enter at the Enter Comment prompt.
22 Press Left Arrow, then press Enter.
You now need to repeat steps 1 through 22 for each field. Make
sure to change the field number and the number of characters in
each field (in the first field, there were 30 characters). You
can use the Block and Copy features of WordPerfect to do this
quickly, but remember to make the necessary changes for each
field.
When you have finished adding merge information for each field,
23 Press Merge Codes (Shift+F9). Choose Page Off (4). (Make
sure that the tilde (~) is at the beginning of the row.)
24 Press Enter to place a hard return after the Page Off
command.
You are now ready to merge the files.
25 Save the primary file you have just created.
26 Merge the primary file with the secondary file.
If the merge doesn't work properly, make sure that all the tildes
(~) are in the correct place and that you have the correct number
of them. Also make sure that there is a {COMMENT} code at the
end of the first two lines and that the corresponding tildes (~)
are at the beginning of the second and third lines.
After the files are merged, you must save the new merged file as
an ASCII file so that it can be ported into other databases.
27 Press Text In/Out (Ctrl+F5), then choose Save As (3).
28 Choose Generic (1). Type the file name and press Enter.
The merged file will remain on the screen. When you exit that
screen, do not save the file again.
See Also
* Appendix K: Macros and Merge, Programming Commands in the
WordPerfect 5.1 for DOS reference manual
WordPerfect Corporation 1993
WordPerfect Corporation
1555 N. Technology Way
Orem, UT 84057-2399
WordPerfect is a registered trademark of WordPerfect Corporation
within the United States and other countries..