Cobol-People

COBOL Subprogram

COBOL Subprogram

COBOL nested programs and WHEN-COMPILED

*+-------------------------------------------------+
*| This program calls a nested program to display |
*| the compiled date. |
*+-------------------------------------------------+
IDENTIFICATION DIVISION.
PROGRAM-ID. MAIN.
AUTHOR. T-REXY.
DATE-WRITTEN. 2020-11-11.
DATE-COMPILED. Ask the nested program.
PROCEDURE DIVISION.
DISPLAY "Start of MAIN program"
CALL "NESTED" END-CALL
GOBACK
.
IDENTIFICATION DIVISION.
PROGRAM-ID. NESTED.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-WHEN-COMPILED.
05 WS-COMPILE-DATE PIC X(8) VALUE 'MM/DD/YY'.
05 WS-COMPILE-TIME PIC X(8) VALUE 'HH.MM.SS'.
PROCEDURE DIVISION.
DISPLAY "Start of NESTED program"
MOVE WHEN-COMPILED TO WS-WHEN-COMPILED
DISPLAY "Compiled on " WS-WHEN-COMPILED
EXIT PROGRAM
.
END PROGRAM NESTED.
END PROGRAM MAIN.

Tags : COBOL SUBPROGRAM WHEN-COMPILED

Edit this page on GitHub