Menu
CoddyTech

DSN and DISP

Part of the Batch Jobs with JCL section of Coddy's COBOL Programming journey. Lesson 5 of 19.

A file on a mainframe is a data set, named by qualifiers joined with dots: CODDY.CUST.MASTER. Each qualifier is 1 to 8 characters and starts with a letter (or @, #, $), and the whole name is at most 44.

A DD statement ties a program's DD name to a data set:

//CUSTIN   DD DSN=CODDY.CUST.MASTER,DISP=SHR

The program reads ASSIGN TO CUSTIN; the job decides which data set that is.

DISP starts with the data set's status: SHR exists and other jobs may read it too, OLD exists and this job alone uses it, NEW is created by the step, and MOD adds records at its end (and creates it if it is missing).

When the step ends, the log says what happened to each data set:

IEF285I   CODDY.CUST.MASTER                            KEPT

A data set that already existed is kept.

A DSN that does not exist stops the job before the step runs:

IEF212I CUSTLIST LIST CUSTIN - DATA SET NOT FOUND
IEF453I CUSTLIST - JOB FAILED - JCL ERROR
challenge icon

Challenge

Easy

LISTCUST reads the DD name CUSTIN. Add a DD statement where the comment is that reads the data set CODDY.CUST.MASTER, shared with other jobs.

Try it yourself

//CUSTLIST JOB (ACCT),'CODDY',CLASS=A,MSGCLASS=X
//LIST     EXEC PGM=LISTCUST
//* Add the CUSTIN DD here
//SYSOUT   DD SYSOUT=*

All lessons in Batch Jobs with JCL

Practice on your own: Online COBOL compiler