Replace: Difference between revisions

From BR Wiki
Jump to navigation Jump to search
No edit summary
 
Line 43: Line 43:
{|
{|
|-valign="top"
|-valign="top"
|width="10%"|'''"OBJECT"'''||saves the executable portion of the program; source information is omitted. Files which are saved in object code only are protected from alteration; the source code cannot be recovered from these files. The system appends the extension .BRO when you do not specify an extension or include a period with the file name.
|width="10%"|'''OBJECT'''||saves the executable portion of the program; source information is omitted. Files which are saved in object code only are protected from alteration; the source code cannot be recovered from these files. The system appends the extension .BRO when you do not specify an extension or include a period with the file name.
|-valign="top"
|-valign="top"
|}
|}
Line 49: Line 49:
{|
{|
|-valign="top"
|-valign="top"
|width="10%"|'''"SOURCE"'''||replaces the file in display (ASCII) format. If you do not specify an extension or include a period in the file name, Business Rules the extension .BRS.
|width="10%"|'''SOURCE'''||replaces the file in display (ASCII) format. If you do not specify an extension or include a period in the file name, Business Rules the extension .BRS.
|-valign="top"
|-valign="top"
|}
|}
  Example: replace MyProgram.wbo object


==Technical Considerations==
==Technical Considerations==

Latest revision as of 19:02, 14 November 2018

For disambiguation purposes, see also the Replace Parameter for file operations.

The Replace (REP) command replaces the contents of a specified file with the program lines currently in memory.

If no file name is specified for a REPLACE command, Business Rules now uses the file's complete original name (including the extension) for the file name. Previously, it would replace any existing extension with an extension of .BR.

CAUTION

The REPLACE command only saves a file in source format when one of two conditions is true:

1) When the file name extension is .BRS or
2) If the SOURCE (SO) parameter is used when the REPLACE command is specified.

e.g: For example, if the file ABC.XX were loaded from source (LOAD ABC.XX,SO), specifying REPLACE without a file name and without the SOURCE parameter would cause the file to be replaced as a program file rather than as source file.

Comments and Examples

The REPLACE command is most useful during program development; it allows you to save the updated version of a loaded program.

You must end program execution before using the REPLACE command. If it is necessary to save a program without ending it, you should use a LIST command in the form LIST >tempfile, then LOAD the listed-to file from source (see LIST and LOAD for more information)

REPLACE leaves program lines in memory when it saves them to a file.

REPLACE can send lines only to a file that already exists. The system overwrites the file's current contents with these lines. If you wish to send program lines to a new file, you must use either the SAVE or LIST commands.

The following example replaces, in display format, the file TEST.BRS with the lines currently in memory:

REPLACE B:TEST SOURCE

Syntax

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

Defaults

  1. Replace the current file.
  2. Replace both source and object code using the default extension .BR.

Parameters

The optional "file name" parameter specifies the file to be replaced. The system appends the extensions .BR or .BRO (according to the parameters) when you do not specify an extension or include a period with the file name.

OBJECT saves the executable portion of the program; source information is omitted. Files which are saved in object code only are protected from alteration; the source code cannot be recovered from these files. The system appends the extension .BRO when you do not specify an extension or include a period with the file name.
SOURCE replaces the file in display (ASCII) format. If you do not specify an extension or include a period in the file name, Business Rules the extension .BRS.
 Example: replace MyProgram.wbo object

Technical Considerations

1) Unless you specify a file name extension in the file name, or include a period at the end of the file name, the system appends a default extension when you use REPLACE. With the following command, the system saves the lines in memory to a file that becomes NAME.BR:
REPLACE NAME

But with the following command (which includes a period), the system replaces the file as NAME, with no extension:

REPLACE NAME.
2) In contrast to the System/23, Business Rules removes the impact of deleted DIM statements on a program before the program is stored with a SAVE or REPLACE command.
3) In contrast to the System/23, Business Rules variables that are no longer referenced in a program before SAVE or REPLACE commands are executed. This eliminates the need for reloading a program from source and saving it in order to reclaim space from unreferenced variables.
4) BR programs being replaced now FREE the original file, after creating the BAK copy, as opposed to DROPping them before writing the replacement program edition. This causes operating systems with salvage turned on to save a copy of the original program.
5) Programs are copied to a .BAK file before replacing them. This makes them recoverable from a failed Replace operation (out of space or corrupted file), provided another Replace command is NOT issued before attempting recovery. OPTION 26 suppresses the creation of .BAK files.

See Also

Name=