COBOL/400 Language Help

Format 1 (Sequential Files)

Description
Sequential files are sequentially organized. ADVANCING and END-OF-PAGE control the vertical positioning of each line on a printed page. However, do not specify both ADVANCING and END-OF-PAGE in a single WRITE statement.

If the printed page is held on an intermediate device (a disk, for example), the format, when edited or browsed, may appear different than the expected output.

Format 1 (Sequential Files)
 
->->---WRITE record-name-1--*-------------------*---------------->
                          *-FROM identifier-1-*
 
->-*-------------------------------------------------------*---->
  **-BEFORE-*-*-----------*-*-*-identifier-2-*-*-------*-**
   *-AFTER--* *-ADVANCING-* + *-integer-1----* *-LINE--* +
                            +                  *-LINES-* +
                            *-mnemonic-name-1------------*
                            *-PAGE-----------------------*
 
->----*----------------------------------------------------*---->
     *-*-----*-*--END-OF-PAGE-*-imperative-statement-1----*
       *-AT--* *-----EOP------*
 
->----*----------------------------------------------------*---->
     *--NOT-*----**-END-OF-PAGE-*-imperative-statement-2--*
            *-AT-**----EOP------*
 
->----END-WRITE-------------------------------------------------><-
 

record-name-1

Record-name-1 must be defined in a Data Division FD entry. Record-name-1 may be qualified, but must not be associated with a sort or merge file.

FROM identifier-1

FROM identifier-1 makes the WRITE statement equivalent to the execution of the following two statements:

MOVE identifier-1 TO record-name-1
WRITE record-name-1

The MOVE is performed according to the rules for the MOVE statement without the CORRESPONDING phrase.

Identifier-1 must be the name of a Working-Storage Section or Linkage Section entry, or a record description for another previously opened file.

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

Identifier-1 and record-name-1 must not refer to the same storage area.

After the WRITE statement has successfully executed, the information is still available in identifier-1, even though it may not be in record-name-1.

ADVANCING, PAGE, mnemonic-name-1, or integer-1

The ADVANCING phrase controls the positioning of the output record on the page. If you omit this phrase, AFTER ADVANCING 1 LINE is assumed.

When you specify:

Integer-1 or the value in identifier-2 may be zero.

NOT, END-OF-PAGE, or imperative-statement-2

If the END-OF-PAGE condition does not exist after the processing of a WRITE statement with the NOT AT END-OF-PAGE phrase, control transfers to imperative-statement-2.

identifier-2

Identifier-2 must be an integer data item.

END-OF-PAGE or imperative-statement-1

When you specify END-OF-PAGE, and the logical end of the printed page is reached during execution of the WRITE statement, the END-OF-PAGE imperative statement is executed. When END-OF-PAGE is specified, the FD entry for this file must contain a LINAGE clause. The logical end of the printed page is specified in the associated LINAGE clause.


[ Top of Page | Previous Page | Next Page | Table of Contents ]