Save

From BR Wiki
Jump to navigation Jump to search

The Save (SA) command writes the program in memory to a new file.

Comments and Examples

Save works only for storing programs that do not currently exist as files. If you have loaded a stored program, made some changes to it, and want to store it under the same file name, you must either use the Replace command or you must Free the saved file before using Save.

BR automatically appends a default extension to the file name when you use Save. To prevent this you must either specify a file name extension in the file name or include a period at the end of the file name. The following example saves the file NAME.BR:

SAVE NAME

In contrast, the next example (which includes a period) saves the file NAME with no extension:

SAVE NAME.

The following example saves the current file under the name SAMPLE.BR on the disk in drive B:

SAVE B:SAMPLE

Syntax

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

Defaults

  1. Save the program under the known file name (file name must be in memory but cannot be an existing file).
  2. Save both source and object using the default extension .BR.

Parameters

The "file name" parameter indicates the file name (and path, if necessary) of the new program. When you do not include an extension (or a period) with this file name, BR uses the extension .BR. The file name is required in most situations. However, if the file name already exists in memory but there is no existing file by that name (as sometimes occurs after a LOAD SOURCE or FREE command), the file name need not be specified.

OBJECT optional parameter saves only the executable portion of the current program; when no extension is specified and no period is included, it appends .BRO. A .BRO (object) program no longer contains the source code, and cannot list most of the program lines; it retains only the DIM and DATA statements. This feature affords a high degree of program security. Be sure to save a copy of the source code before saving the file as an object file: .BRO files can be changed and replaced, but this is difficult to do without an accurate listing.
SOURCE optional parameter saves the current program source data in display format; if no extension is specified and no period included in the file name, the system appends the extension .BRS.

Technical Considerations

The process of saving a file in source causes current STYLE formatting to be permanently save with the file. See STYLE in the BRConfig.sys chapter for additional information.

BR STORAGE FORMAT

BR began using a new format for saving programs that allows for the expanded capacities in version 4.2. This format cannot be processed correctly with prior versions of BR. However, during development, to be able to make changes to 4.1 programs while one is running version 4.2 OPTION 60 provides a way to do this.

Think of it as a mode setting. You are saving in 4.1 format or 4.2 format at any given point.

OPTION 60 [ ON | OFF ]	! saves programs in 4.1 loadable form

If an attempt is made to store 4.2 only code in 4.1 format, an error is generated.