A successful read operation on the record must be done prior to the rewrite operation. The record replaced in the subfile is that record accessed by the previous read operation.
You cannot use Format 2 for communications devices.
Format 2 (TRANSACTION Subfile) ->->---REWRITE SUBFILE record-name-1--------------------------> ->---*-------------------*-----------------------------------> *-FROM identifier-1-* ->----*--------------------------------*---------------------> *-FORMAT-*----*-*-identifier-2-*-* *-IS-* *-literal-1----* ->----*----------------------------------*-------------------> *-TERMINAL-*----*-*-identifier-3-*-* *-IS-* *-literal-2----* ->----*------------------------------------------*-----------> *-*-INDICATOR--*--*-----*--identifier-4----* *-INDICATORS-* *-IS--* *-INDIC------* *-ARE-* ->---*-----------------------------------------*-------------> *-INVALID-*-----*--imperative-statement-1-* *-KEY-* ->---*--------------------------------------------*----------> *-NOT INVALID-*-----*-imperative-statement-2-* *-KEY-* ->---*-------------*-----------------------------------------><- *-END-REWRITE-*
Record-name-1 must be the name of a logical record in a Data Division FD entry. It must have the same number of character positions as the record being replaced. Record-name-1 may be qualified but it must not be subscripted, indexed, or reference modified.
Identifier-1 and record-name-1 must not refer to the same storage area.
FROM identifier-1 makes the REWRITE statement equivalent to:
MOVE identifier TO record-name REWRITE record-name
The MOVE is performed according to the rules for the MOVE statement without the CORRESPONDING phrase.
Identifier-1 and record-name-1 must not refer to the same storage area.
After the REWRITE statement has successfully executed, the logical record is no longer available in record-name-1, but is still available in identifier-1.
The value specified in the FORMAT phrase contains the name of the record format to use for this I-O operation. The system uses this to specify or select which record format to operate on. The FORMAT phrase is optional when processing a file that has one record format.
Literal-1 or identifier-2 specifies the name of the record format to use for the rewrite operation. If you specify literal-1 it must be uppercase and 10 characters or less in length. If you specify identifier-2, it must be a character-string of 10 characters or less, and it must name one of the following:
A value of all blanks is treated as though the FORMAT phrase were not specified.
When an INVALID KEY condition exists, the updating operation does not take place. The data in record-name is unaffected.
An INVALID KEY condition exists when any one of the following conditions is true:
You must not specify the INVALID KEY phrase for a file with sequential organization. You can specify an EXCEPTION/ERROR procedure.
Click here for further information about the invalid key condition.
After successful completion of a REWRITE statement with the NOT INVALID KEY phrase, control transfers to the imperative statement associated with the phrase.
The number of character positions in the record referenced by record-name-1 must be equal to the number of character positions in the record being replaced. The record replaced in the subfile is that record accessed by the previous read operation.
Multiple data records, each with a different format, can be concurrently active for a TRANSACTION file. If you specify the FORMAT phrase, it must specify a valid format name that is defined to the system, and the I-O operation must be performed on a data record of the same format.
The record format specified in the FORMAT phrase must be the record format accessed on the previous read operation.
Literal-1 or the contents of identifier-2 must be the name of the subfile format accessed on the previous READ.
The TERMINAL phrase indicates which program device's subfile is to have a record rewritten. If the TERMINAL phrase is specified, literal-2 or identifier-3 must refer to a workstation that has been acquired by the TRANSACTION file. The program device specified by the TERMINAL phrase must have been acquired, either explicitly or implicitly, and must have a subfile associated with the device.
If you omit the TERMINAL phrase from a TRANSACTION file that has acquired multiple program devices, the subfile used is the subfile associated with the last program device from which a READ of the TRANSACTION file was attempted.
Literal-2 or identifier-3 must be a valid program device name. If you specify literal-2, it must be nonnumeric and 10 characters or less in length. If you specify identifier-3, it must refer to an alphanumeric data item 10 characters or less in length.
If literal-2 or identifier-3 contains blanks, the TERMINAL phrase has no effect.
The INDICATOR phrase specifies which indicators are to be rewritten. When a data record is rewritten, indicators can be rewritten with it. The indicators can be rewritten with a data record to control how the data record is displayed. INDICATOR, INDICATORS, and INDIC are equivalent.
The INVALID KEY condition exists at the time of the rewrite operation, if the RELATIVE KEY data item contains a value that does not correspond to the relative record number of the record from the previous read operation.
The INVALID KEY phrase should be specified for files for which an appropriate USE procedure is not specified. Undesirable results may occur if the INVALID KEY phrase is not specified, and no USE procedure is specified.
Click here for further information about the invalid key condition.
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.