+-------------------------------IBM Extension--------------------------------+
The REWRITE statement is used to replace a subfile record that already exists in the subfile.
REWRITE Statement - 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-'
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. 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.
Notes:
Literal-2 or identifier-3 must be a valid program device name. Literal-2, if specified, must be nonnumeric and 10 characters or less. Identifier-3, if specified, must refer to an alphanumeric data item, 10 characters or less in length.
If the TERMINAL phrase is omitted 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.
The REWRITE statement cannot be used for communications devices. If the REWRITE statement is used for a communications device, the operation fails and a file status of 90 is set.
For detailed information on the INDICATORS phrase, refer to Using Indicators with Transaction Files in the ILE COBOL for AS/400 Programmer's Guide .
Identifier-4 must be either an elementary Boolean data item specified without the OCCURS clause or a group item that has elementary Boolean data items subordinate to it.
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.
+----------------------------End of IBM Extension----------------------------+
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.