EJECT Statement
EJECT Statement
- EJECT statement specifies that the next source statement after it should be printed as the first statement of the next page while printing.
- It is a compiler-directive statement and does not affect the compilation and execution of the program.
- It can be written in either Area-A or Area-B.
Syntax -
EJECT[.]
Rules -
- It should be coded as the only statement on the entire line.
- It can be written in Area-A or Area-B and terminated with a separator period.
Examples -
Scenario - Coding EJECT statement in COBOL program.
Copybook - MATEPK.COBOL.COPYLIB(EMPREC)
----+----1----+----2----+----3----+----4----+
05 EMP-NUM PIC 9(05).
05 EMP-NAME PIC X(10).
05 EMP-DESG PIC X(15).
05 EMP-SALARY PIC 9(10).
Code -
----+----1----+----2----+----3----+----4----+
01 EMP-REC.
COPY EMPREC.
EJECT.
01 WS-VAR.
05 WS-INPUT1 PIC X(10).