cobol2.hlp (Table of Contents; Topic list)
RDW Details (↑ Allowing Language Features)
 Key Summary                             Up Contents Index Back
────────────────────────────────────────────────────────────────────────────
 
     If you specify the RDW directive, a 4-byte record-length field is
     allocated immediately before the record area for the file. After
     a READ, the length (in binary) of the record just read is put in the
     first two bytes of this record area. The length returned includes the
     record-length field itself, so is four bytes longer than the actual
     record length.
 
     You can access this field by defining the record area as a table, and
     using negative or zero subscripting. For example:
 
       fd  file-1.
       01  rec-1           pic x(100).
       01  rec-2.
           03  rdw-table   pic x(4) occurs 25.
       Working-storage section.
       01  rdw-area.
           03  rec-length  pic 9(4) comp.
           03  filler      pic 9(4) comp.
       procedure division.
           ...
           read file-1
           move rdw-table (0) to rdw-area
 
 
     The RDW directive is intended only for mainframe compatibility;
     for new programs you should use the RECORD IS VARYING DEPENDING ON
     phrase of the FD statement.
 
     See also FD statement
                                    -♦-