Here are the ideas to pass data from JCL to COBOL. I have explained in three steps.
1. How Many Ways You Can Pass Data
- From JCL we can pass data into COBOL program two ways.
- One is through PARM (maximum limit is 100 bytes), second through Input file, third through SYSIN card.
2. How to Pass Data From JCL
- Ensure you pass Data from JCL PARM or SYSIN to COBOL LINKAGE SECTION.
- In LINKAGE section, you need to give 2 bytes extra to store length, and give actual size of the data. Here is an article that tells how to use SYSIN card in JCL.
“The greatest glory in living lies not in never falling, but in rising every time we fall.”
— Nelson Mandela
3. Sample COBOL Logic
05 STRINGLEN PIC 9(4) USAGE COMP.
05 STRINGPARM PIC X(80).
PROCEDURE DIVISION USING PARMDATA.
IF STRINGLEN > 0 . . .
The logic tests that if string-len is greater than zero, we can validate the data from JCL.