UPDATE

Syntax

── UPDATE ─────────────────────────────────────────────────────────────┤

Explanation

The UPDATE command forces the system to update the work file immediately. All changes, additions, and deletions accumulated are applied to the work file, and an updated work file is generated. CANDE acknowledges the request by displaying “#UPDATING” and then signifies completion of the update by displaying a number sign (#).

The UPDATE command is invoked implicitly whenever needed to permit another command to function properly; therefore, the UPDATE command is not usually entered on the terminal. The UPDATE command is implicitly invoked when any of the following commands are encountered: BIND, COMPILE, EXCLUDE, EXECUTE, INSERT, MERGE, MOVE, RANGE, REPLACE, RESEQ, RMERGE, RUN, SAVE, START, TYPE, WRITE, and UTILITY.

However, at least three situations require the user to enter the UPDATE command on the terminal. These three cases are as follows:

  • The UPDATE can be explicitly invoked to ensure that a work file is a private copy. If user X gets a file from a library other than the library for his usercode (for example, GET (Y)HISFILE), the work file source resides in the library of user Y and is subject to any change or removal done by Y on that file until an UPDATE is invoked (either explicitly or implicitly) by user X. The update action creates a separate copy of the file for user X in a work file area.

  • The UPDATE can be explicitly invoked to ensure a complete work file recovery in the event of a system failure. If the system fails during the modification of a work file, the last several changes to the work file (a maximum of four) may be lost. This loss occurs because CANDE defers changes to a work file as long as possible before invoking the time-consuming UPDATE. If the work file is updated when a system failure occurs, the work file is recovered completely.

  • The UPDATE can be explicitly invoked to ensure that a complete update of the file is accomplished. That is, the implementation of CANDE is such that if enough changes(none requiring an update) are made to the work file, more than one update may be required to accomplish a complete update of the file. This UPDATE use produces a file that represents all outstanding work file changes. In the case where the work file is either type DATA or CDATA, this process sometimes results in an incorrect update. CANDE discards any outstanding work file changes that cannot be made with one update of the file and displays the following error message:

    DATA LOST, LIMITED CHANGES ALLOWED TO DATA FILES

To prevent an incorrect update from occurring, a periodic update of a DATA or CDATA file must be performed using the UPDATE verb.

For files of type CDATA and DATA, an update causes CANDE internal sequence numbers to be recalculated. These numbers are computed by multiplying the relative record number by 100.

CANDE allows only a limited number of changes to the work file between updates. If the number of changes to the work file exceeds the limit, CANDE performs an update action. If the work file is either type DATA or CDATA, CANDE does not perform an update because of the dynamic nature of the sequence numbers used for these file types. Instead, you are warned when the number of changes approaches the maximum limit. The warning displayed is as follows:

#WARNING: <the number of changes made> OF <the maximum limit>
Maximum possible changes to data files have been made;
Issue an "UPDATE" to avoid losing data.

Once data has been lost for a work file, you are not allowed to save the work file by using the SAVE command. If you attempt to use the SAVE command, the following error message is displayed:

#DATA LOST; PLEASE USE "SAVE AS" OR "SAVE OVERRIDE"

Example

UPDATE
#UPDATING
#