Temporary Data Sets
Part of the Batch Jobs with JCL section of Coddy's COBOL Programming journey. Lesson 7 of 19.
Data handed from one step to the next is often not needed once the job ends. A temporary data set's name starts with &&, and the system deletes it when the job ends at the latest:
//BIGOUT DD DSN=&&BIG,DISP=(NEW,PASS)PASS keeps it for a later step of the same job. That step reads it with OLD and deletes it when it is done:
//CUSTIN DD DSN=&&BIG,DISP=(OLD,DELETE)The log follows it from step to step:
IEF285I &&BIG PASSED
IEF285I &&BIG DELETEDz/OS gives a temporary data set a long generated name, and its log prints that name. This course's log prints the && name.
A step that reads it with DISP=(OLD,PASS) passes it on again, so several steps can read it in turn. The last one deletes it.
Challenge
EasyHand the large balances from PICK to LIST in a temporary data set named &&BIG. Write the BIGOUT DD that creates and passes it, and LIST's CUSTIN DD that reads and deletes it.
Try it yourself
//TEMPJOB JOB (ACCT),'CODDY',CLASS=A,MSGCLASS=X
//PICK EXEC PGM=EXTRACT
//CUSTIN DD DSN=CODDY.CUST.MASTER,DISP=SHR
//* Add the BIGOUT DD here
//SYSOUT DD SYSOUT=*
//LIST EXEC PGM=LISTCUST
//* Add the CUSTIN DD here
//SYSOUT DD SYSOUT=*