The
WRITE statement releases a logical record for insertion in an output
file. Here is the general format of the WRITE statement:
WRITE record-name [FROM identifier-1]
[ {BEFORE | AFTER}
ADVANCING
{ {identifier-2 | integer | PAGE
| mnemonic-name}
[
LINE | LINES ]
}
]
If
the output is to a printer device, vertical positioning of lines can be
achieved using the ADVANCING option. The option allows the programmer to
refer to identifier-2, an integer, or PAGE.
Here
is an example of the use of identifer-2 with the advancing option to
cause the first detail line to be printed double-spaced. Then, all lines after
the first will be printed single-spaced:
In
the WORKING-STORAGE SECTION:
02 VAR-SPACING PIC 9 VALUE 2.
In
the PROCEDURE DIVISION:
WRITE
PRINT-LINE FROM DETAIL-LINE
AFTER
ADVANCING VAR-SPACING
MOVE
1 TO VAR-SPACING