Directives
MERGE 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.
fileopt Supported file options (see also, File Options):
ERR=stmtref Error transfer
IND=num Record index
TBL=stmtref Data translation table
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.

   
See Also INDEXED Create Indexed File,
*MEMORY* Create & Use Memory File,
SERIAL Create a Sequential File


*Note* MERGE does not support code generated using the LIST EDIT format.


Format 1 Specify Source File by Channel

MERGE (chan,options)

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*).

   
Format 2 Specify Source File by Serial Filename

MERGE filename$

You can use a serial filename to identify it as the source for the MERGE (instead of opening it and referring to the channel).

   
Example The following is a sample terminal session using the MERGE directive to combine two programs:

->LOAD "TIME.PRT"
->LIST

1000 REM Time output routine
1010 T$=STR(INT(TIM)*100+FPT(TIM)*60:"00:00")
1020 RETURN
->SERIAL "WORKFILE"
->OPEN (1)"WORKFILE"; LOCK(1)
->LIST (1)
->CLOSE (1) ! WORKFILE has list of program
->LOAD "PASS.CTRL"
->LIST
0010 GOSUB 1000; PRINT "1st pass: ",T$
0020 CALL "PASS1"
0030 GOSUB 1000; PRINT "2nd pass: ",T$
0040 CALL "PASS2"
0050 GOSUB 1000; PRINT "End both: ",T$
0060 STOP
->OPEN (1)"WORKFILE"
->MERGE (1)
->CLOSE (1)
->LIST
0010 GOSUB 1000; PRINT "1st pass: ",T$
0020 CALL "PASS1"
0030 GOSUB 1000; PRINT "2nd pass: ",T$
0040 CALL "PASS2"
0050 GOSUB 1000; PRINT "End both: ",T$
0060 STOP
1000 REM Time output routine
1010 T$=STR(INT(TIM)*100+FPT(TIM)*60:"00:00")
1020 RETURN