Indexed and Relative Files

Read syntax diagramSkip visual syntax diagram
WRITE - Format 2 - Indexed and Relative Files

>>-WRITE--record-name-1--+--------------------+----------------->
                         '-FROM--identifier-1-'   

>--+--------------------------------------+--------------------->
   |        (1)                           |   
   '-FORMAT------+----+--+-identifier-2-+-'   
                 '-IS-'  '-literal-1----'     

>--+----------------------------------------+------------------->
   |              (1)                       |   
   '-NULL-KEY-MAP------+----+--identifier-8-'   
                       '-IS-'                   

>--+------------------------------------+----------------------->
   |          (1)                       |   
   '-NULL-MAP------+----+--identifier-9-'   
                   '-IS-'                   

>--+------------------------------------------+----------------->
   '-INVALID--+-----+--imperative-statement-1-'   
              '-KEY-'                             

>--+----------------------------------------------+------------->
   '-NOT INVALID--+-----+--imperative-statement-2-'   
                  '-KEY-'                             

>--+-----------+-----------------------------------------------><
   '-END-WRITE-'   

Notes:
  1. IBM Extension
Related Information:
record-name-1
Must be defined in a Data Division FD entry. Record-name-1 may be qualified. It must not be associated with a sort or merge file.

You must ensure that the size of an OCCURS DEPENDING ON (ODO) array has been set to a valid numeric value before doing a WRITE of a record containing the ODO array.

In the case of relative files, only, the number of character positions in record-name-1 must equal the number of character positions in the record being replaced. It must not be associated with a sort or merge file.

FROM
When FROM is specified, the result is the same as:
MOVE identifier-1 TO record-name-1
WRITE record-name-1

After the WRITE statement is executed, the information is still available in identifier-1, even though it may not be in record-name-1. (See INTO/FROM Identifier Phrase.)

identifier-1
Must be an alphanumeric or numeric-edited data item. Data is transferred from this field to the receiving fields.

Record-name-1 and identifier-1 cannot both refer to the same storage area.

Identifier-1 can be the name of an alphanumeric or DBCS function identifier.