MERGE Verb - Merge Text into Current Workspace

Syntax

MERGE (channelno{,ERR=lineref}{,IND=index}{,END=lineref})

Description

For BBj-specific information, see the MERGE Verb - BBj.

The MERGE verb reads program text lines from a text or ASCII file that is already open on a channel and adds them to the current workspace program. PRO/5 adds the lines as though they were typed in console mode. The IND= option specifies a starting point in the file to begin the MERGE. The END= branch is taken if an end-of-file error (!ERROR=2) occurs. PRO/5 takes the ERR= branch if a general error occurs. The options can appear in any order. If both programs have a statement with the same number, the one in the MERGEing program replaces the existing one.

Once the merge begins, it continues until one of the following happens:

  • PRO/5 encounters an END statement as the first verb on the incoming line.

  • PRO/5 encounters line number 0 or a line without a number (!ERROR=21).

  • PRO/5 reaches the end of the file.

  • The user exits.

PRO/5 does not issue errors for lines with invalid syntax. These lines are made part of the program as error lines. Error lines will LIST with an error number along with the text for the line. Code corrections can then be made.

Example

>MERGE(1)

To merge one PRO/5 program file into another program file, LIST the program to be merged into a string file. For example:

STRING "TEMPFILE",0; OPEN (1) "TEMPFILE"
LOAD "PRG1"
LIST(1)
CLOSE (1); OPEN (1) "TEMPFILE"
LOAD "PROG2"
MERGE(1)
CLOSE(1)

See Also

Verbs - Alphabetical Listing