RESTORE


The RESTORE statement restores the contents of a field or a record from the area assigned as the store or default area for the field or record.

    ••••• RESTORE  ••• •••••••••••••••••••••• ••• ••••••••••••••
    (1)            (2) (3)                    (4) (5)

(1) T/F execution conditions

(2) Application ID

(3) File name, field name, or predefined field

(4) Occurrence (constant/index)

(5) Area type (RECORD, FIELD, DEFAULT RECORD, DEFAULT FIELD,
               ORIGINAL RECORD, ORIGINAL FIELD)

Using the Statement

The RESTORE statement can recover data values from the store, default, or original record area. The contents of the store record area are established by the STORE command. If no STORE command was executed, the store record area contains the default values, which are defined in the data dictionary. The RESTORE statement does not alter the contents of the store, default, or original area.

Fields that are part of a record do not have an independent store or default area. All fields that are part of a record are restored from their proper location in the area assigned for the record. Therefore, it is possible to store an entire record and then restore specific fields, or to store only some fields and then restore the entire record. A field or record can be stored any number of times, and can also be restored any number of times, independently. These statements only cause the contents of the specified field or record to be stored in, or restored from, the store or default area assigned to the field or record. The store and default areas are allocated if a STORE or RESTORE statement is present. They are initialized to the default value and, therefore, a RESTORE statement can be executed even if no STORE statement is present for the field or record.

The contents of predefined fields can also be restored using the RESTORE statement.

No editing or justification is performed. All data is copied unchanged.

Restrictions

If the FIELD option is specified as the data item type, the data item to be restored must be a field name in the data dictionary. If the RECORD option is specified, the data item to be restored must be a file name in the data dictionary.

Related Statements

STORE

Example

In the following example, the record MTDPOST is filled with its default values from the data dictionary, so that you only have to supply those values that are different for this particular routine.

          RESTORE  TAR MTDPOST                    DEFAULT RECORD
          SET      TAR MTDPOST ACCOUNT            =  TAR ADJUST2 ACCOUNT
          SET      TAR MTDPOST POST YEAR          =  TAR ADJUST2 POST YEAR
          SET      TAR MTDPOST POST MONTH         =  TAR ADJUST2 POST MONTH