Load

From BR Wiki
Jump to navigation Jump to search

The Load (LO) command loads a program file from disk to memory. The Load command has been enhanced to load a specified library as resident.

Comments and Examples

When executing the Load command, BR finds the file to load, performs a Clear operation and then loads the specified file. If the specified file cannot be found, BR leaves memory intact.

BR automatically searches for a file with the appropriate default extension for the parameters you specify with the Load command. To prevent this you must include a period (or an extension) after the file name. To load the file NAME (with no extension), then, you would use the following command:

LOAD NAME.

The following example loads PROG.BRS, a program source file located on the disk in drive B:

LOAD B:PROG SOURCE

Syntax

LOAD <file name> [{SOURCE|OBJECT}]

Defaults

Load the executable portion of a saved program. If the file does not specify an extension, use .BR or .BRO (see also the ChainDflt configuration specification in the BRConfig.sys).

Parameters

Load requires the file name parameter, which tells BR which file to load into memory. If you do not provide an extension with the file-ref, BR looks for a file with the extension .BR.

The optional OBJECT parameter loads the object portion of a saved program. If no extension is specified in the file-ref, BR looks for a file with the extension .BRO.

The optional SOURCE parameter indicates that the file to be loaded is an ASCII text file (a BR display file) filled with BR program lines. BR must enter these lines into memory, one by one, just as if they were being typed in from the keyboard. If no extension is provided in the file-ref, BR looks for a file with the extension .BRS.

RESIDENT indicates that the specified program should be loaded as a resident library.

Technical Considerations

1) Syntax error checking occurs for each individual line (as if it were entered at the keyboard) when LOAD is executed on a source file. Syntax errors encountered during a LOAD SOURCE command cause BR to stop processing and wait for a correction from the keyboard.
2) Stopping on syntax errors when LOAD SOURCE is initiated from a procedure is prevented when PROCERR RETURN is in effect. This allows greater flexibility in automating conversions between different major releases of BR. When PROCERR RETURN is in effect, BR returns the error code to the procedure by setting the function ERR. The function LINE is also set to the line number preceding the error. The procedure can test ERR with a SKIP command to determine whether or not the LOAD SOURCE was successful.

If ERR is nonzero (ERR will be nonzero if the LOAD failed, as a successful LOAD automatically sets ERR to zero), the procedure can print a message including the error code and the number of the line before the error. The syntax error must still be corrected before the file can be loaded, but the procedure can continue its process of loading other files in the meantime.