The following COBOL program illustrates how to receive data from JCL in a COBOL program
       05 PARM-LENGTH          PIC S9(4) COMP.            PROCEDURE DIVISION USING INPUT-PARM.     * COBOL PROGRAM TO USE DATA RECEIVED FROM JCL        DISPLAY ‘DATA RECEIVED FROM JCL   :’ PARM-DATA.        DISPLAY ‘LENGTH OF DATA FROM JCL   :’ PARM-LENGTH.
Sample JCL to run the above program is as below
//TEST Â Â Â JOB (ACCINFO,,,,,XXXX),’ Â Â Â Â ‘,CLASS=M, // Â Â Â Â Â Â MSGCLASS=Y,NOTIFY=&SYSUID //STEP0010 EXEC PGM=LPGM048,PARM=’INPUT-PARM-HERE’
The output of the program isÂ
DATA RECEIVED FROM JCL Â Â :INPUT-PARM-HERE Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â LENGTH OF DATA FROM JCL Â Â :+00015 Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
; ; ; ;