Format 2 (Indexed and Relative Files) ->->---WRITE record-name-1--*-----------------*-------------> *FROM identifier-1* ->----*--------------------------------*-------------------> *-FORMAT-*----*-*-identifier-2-*-* *-IS-* *-literal-1----* ->----*-----------------------------------------*----------> *-INVALID--*-----*-imperative-statement-1-* *-KEY-* ->----*--------------------------------------*-*---------*-><- *NOT INVALID*---*imperative-statement-2* *END-WRITE* *KEY*
Literal-1 or identifier-1 specifies the name of the record format to use for the write operation. If you specify literal-1 it must be uppercase and 10 characters or less in length. If you specify identifier-1, 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.
The INVALID KEY phrase must be specified for files for which there is not an appropriate EXCEPTION/ERROR procedure.
When an attempt is made to write beyond the externally defined boundaries of the file, WRITE statement execution is unsuccessful and an EXCEPTION/ERROR condition exists.
For indexed files, an invalid key condition is caused by any of the following:
For relative files, an invalid key condition is caused by any of the following:
When the invalid key condition is recognized, WRITE statement execution is unsuccessful, and the contents of the record are unaffected. Program execution proceeds according to the rules described under invalid key condition.
If you specify the NOT INVALID KEY phrase and a valid key condition exists at the end of the execution of the WRITE statement, control passes to the imperative statement associated with this phrase.
Click here for further information about the invalid key condition.
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.