DD and SYSOUT
Part of the Batch Jobs with JCL section of Coddy's COBOL Programming journey. Lesson 3 of 19.
A COBOL program never names a real file. Its SELECT names a DD name:
SELECT RPT-FILE ASSIGN TO RPTOUTThe job's DD statement with that name says what RPTOUT is when the step runs:
//RPTOUT DD SYSOUT=*SYSOUT=* sends the file to the job's output, in the same class as the log. IBM's COBOL writes DISPLAY to the DD named SYSOUT, which is why each step so far had //SYSOUT DD SYSOUT=*.
DD DUMMY throws output away, and a program reading a dummy file finds it empty:
//ERROUT DD DUMMYA step's DD statements follow its EXEC, in any order. Below the log, its outputs are listed in the order of their DD statements. With no DD statement for RPTOUT, the report never reaches the job's output.
Challenge
EasyDAYRPT writes its report to the DD name RPTOUT, but the job has no DD statement for it. Add //RPTOUT DD SYSOUT=* where the comment is, so the report prints with the job.
Try it yourself
//DAYRPT JOB (ACCT),'CODDY',CLASS=A,MSGCLASS=X
//REPORT EXEC PGM=DAYRPT
//* Add the RPTOUT DD here
//SYSOUT DD SYSOUT=*
All lessons in Batch Jobs with JCL
Practice on your own: Online COBOL compiler