Master Mainframe Technologies - COBOL, JCL, DB2, VSAM, CICS & More
ABEND Codes SQLCODEs File Status Interview Prep Contact
← Back to JCL Basics
JCL Basics | Beginner | JCL

JCL with Input File

Problem Description

Write JCL that reads from dataset MY.INPUT.FILE.

Expected Output

JOB reads input file and runs

Hints

Use DD with DSN and DISP parameters.

Solution

//READJOB JOB (ACCT),'READ FILE',CLASS=A //* //STEP01 EXEC PGM=READPGM //STEPLIB DD DSN=MY.LOAD.LIB,DISP=SHR //INFILE DD DSN=MY.INPUT.FILE,DISP=SHR //SYSPRINT DD SYSOUT=* //

Explanation:

DISP=SHR allows shared read access. DD name must match SELECT in COBOL.