SAVE

Syntax

── SAVE ───────────────────────────────────────────────────────────────►
►─┬──────────┬─┬──────────────────────────────────┬─┬────────────┬─────┤
  ├─ SOURCE ─┤ └─ AS ──<file name>─┬──────────────┤ └─ NOCRUNCH ─┤
  ├─ OBJECT ─┘                     └─ OVERRIDE ───┤              │
  ├─ OBJECT ── AS ── $ ──<file name>─┬────────────┤              │
  │                                  └─ OVERRIDE ─┘              │
  └─ RECOVERY ───────────────────────────────────────────────────┘

Explanation

The SAVE command saves the current work file, its associated object file, or both in the user's library.

The work file is saved in the user's library under the current work file name. The object file is saved as OBJECT/<file name>. Any other existing file of the same name is removed. If required, the work file is updated before the SAVE command is executed.

After a work file has been saved, it is still available for further editing. The recently saved file serves as the file part of the work file; therefore, it remains present and unmodified until the next SAVE command is executed.

The user is not allowed to save the work file by using the SAVE command if the data has been lost for a work file. For details, refer to the UPDATE command in this section.

SAVE SOURCE and SAVE OBJECT

When the SAVE command is used with no options specified, then both the work file and object file are saved. Specifying either SOURCE or OBJECT saves only the work file or its associated object file, respectively.

An object file that is saved (but not saved with the AS option) remains associated with the work file and is available to be run or executed until any changes to the work file are entered.

AS <file name> Option

The SAVE AS <file name> command form saves the work file in the user's library under the specified file name. If a work object file exists, it is saved as OBJECT/<file name>. A work object file exists if the work file has been compiled but not yet saved. The SAVE SOURCE AS <file name> or SAVE OBJECT AS <file name> forms save only the work source or work object, respectively.

A privileged user can create another file under another usercode or as an unusercoded file. The privileged user must be identified as such in the USERDATA file and must be logged on from a station configured to accept the privileged status of a user.

The security of a station is dependent on the options set by the SECOPT system command (see the MCP Security Overview and Implementation Guide for information about the SECOPT command) and the CANDE security option set for the types of stations available to users (that is, dial-in stations, Transaction Server pseudostations, and non-Transaction Server pseudostations). Although a user is defined as privileged in the USERDATAFILE, the CANDE security options SECDIALIN, SECPSEUDO, and SECALL of the ?OP network control command can prevent a user from assuming privileged status on certain stations.

The following combination of CANDE security options determine whether or not a user will have privilege status on a station.

  • If SECDIALIN is set to TRUE and USECOMSPRIV is set to FALSE, then the privileged user status is denied to all users of dial-in stations.

  • If SECPSEUDO is set to TRUE and USECOMSPRIV is set to FALSE, then the privileged user status is denied to all users of pseudostations.

  • If SECALL is set to TRUE and USECOMSPRIV is set to FALSE, then the privileged user status is denied to all users of all stations.

  • If USECOMSPRIV is set to TRUE, then the Transaction Server station is defined to acknowledge the user's security privileges, regardless of the settings of SECDIALIN, SECPSEUDO or SECALL.

For more information about CANDE security options, refer to the CANDE Configuration Reference Manual about the CANDE security options SECALL, SECDIALIN, SECPSEUDO, and USECOMSPRIV.

OBJECT AS $ <file name> Option

The SAVE OBJECT AS $<file name> form saves the work object as the specified file name without an OBJECT/ node preceding the file name. If file name exists, the SAVE operation is not performed, unless the OVERRRIDE option is used.

OVERRIDE Option

The OVERRIDE option can be used with either the AS <file name> or the OBJECT AS $ <file name> syntax. A user (privileged or otherwise) can use the OVERRIDE option to save a work file as the specified file name when a file with the same specified name under the same usercode already exists. The contents of the existing file is overwritten with the contents of the current work file.

The following example shows the way a user with no security privileges saves a work file named MEMO to an existing file named DEPTMEMO under his own usercode with the OVERRIDE option:

WHAT
#WORKFILE MEMO: SEQ
SAVE AS DEPTMEMO OVERRIDE
#UPDATING
#WORKSOURCE MEMO SAVED AS (DJT)DEPTMEMO ON USERPACK

Although the OVERRIDE option can be used by all users, security requirements apply if this option is used to attempt an overwrite of a file with an existing usercoded file name, but the usercode is different from that of the initiator of the SAVE command.

The existing file cannot be overwritten by the work file on a family pack other than the current primary family.

If the work file is either type DATA or CDATA, the DATA LOST message is displayed if the number of changes made to the work file approaches the maximum limit. You are allowed to save the work file by using the SAVE AS command or SAVE OVERRIDE command. See the UPDATE command in this section for information.

NOCRUNCH Option

If NOCRUNCH is specified, the files are not crunched when they are saved. The default is to crunch all files; that is, to return the unused portion of the last row of disk space of a disk file to the system.

RECOVERY Option

Entering SAVE RECOVERY saves the work file in the form of a recovery file. Because CANDE does not update the file in this case, larger files are stored more quickly than with other forms of the SAVE command. The recovery file must be retrieved with the RECOVER command.

Saving a File Whose LOCKEDFILE File Attribute Is Set

If an attempt is made to save a file that is to overwrite a file whose LOCKEDFILE file attribute is set to TRUE, that file is not saved and the following message is displayed:

<file name> NOT SAVED (LOCKEDFILE).

For more information about the LOCKEDFILE file attribute, refer to the File Attributes Reference Manual. See the ALTER command earlier in this section for information about changing the LOCKEDFILE attribute.

Examples

The following example shows the result of the SAVE command with the work file A.

WHAT
#WORKFILE A: ALGOL

SAVE
#UPDATING
#WORKSOURCE A SAVED

The following example shows the result of the SAVE command with the SOURCE AS <file name> option on the work file TEST.

WHAT
#WORKFILE TEST: ALGOL

SAVE SOURCE AS NEW/PROG
#UPDATING
#WORKSOURCE TEST SAVED AS (UZER)NEW/PROG ON USERPACK

The following example shows the result of the SAVE command with the OBJECT AS $ <file name> option on the work file TEST.

C
#COMPILING 5084
#ET=18.8 PT=0.5 IO=0.4

SA OBJECT AS $TEST
#WORKOBJECT TEST SAVED AS (UZER)TEST ON USERPACK

The following example shows the result of saving a work file NEWTEST with the NOCRUNCH option.

SAVE NOCRUNCH
#UPDATING
#WORKSOURCE NEWTEST SAVED

The following example shows the result of saving a work file LASTTEST with the RECOVERY option.

SAVE RECOVERY
#
REC
#RECOVERY DATA ON TESTPACK
  3231 LASTTEST (11/28/92)