ProvideX V8.20 > Language Reference > 2. Directives
205
MERGE Directive
              Read/Append Lines from File
Formats
1. Specify Source File by Channel: MERGE (chan,fileopt)
2. Specify Source File by Serial Filename: MERGE filename$
Where:
chan
Channel or logical file number of the file to reference.
Supported file options (see also, File Options, p.808):
fileopt
ERR=stmtref Error transfer
IND=num Record index
TBL=stmtref Record number.
filename
Name of the serial file to be used as the source file for the merge.
Description
Use the MERGE directive to add program statements from a source file to the current
(target) program. You can use a MERGE directive for serial or indexed files. You can
also use it with Memory files. The source file must contain records that are
statements in valid List format (i.e., with correct syntax, line numbers, etc.).
Warning: During the MERGE process, if a statement from the source file has a line
number matching a line number in the target program, the statement from the source
file will overwrite the corresponding statement in the target program.
You have to include line numbers in the source file, but you do not have to put them
in numeric order. ProvideX reads them into the target program in ascending
sequence as if they were entered in Command mode, but will place them in the
correct numeric sequence, using the source file's numbering.
If a source file contains a statement without a statement number, or with an invalid
statement number (outside of the allowed range), ProvideX generates Error #21:
Statement number is invalid and halts the MERGE process.
ProvideX terminates the MERGE process when it encounters an End-of-File status in
the source file.
Note: MERGE does not support code generated using the LIST EDIT format.
Format 1: Specify Source File by Channel
MERGE (chan,fileopt)
This opens the source file and use its current channel / logical file number to
identify it. You can use this format with a memory-resident file (i.e., *MEMORY*).