JOB and EXEC
Part of the Batch Jobs with JCL section of Coddy's COBOL Programming journey. Lesson 2 of 19.
The JOB statement comes first:
//PAYJOB JOB (ACCT),'A PROGRAMMER',CLASS=A,MSGCLASS=XPAYJOB is the job's name. (ACCT) is accounting information, then the programmer's name in quotes. CLASS picks the queue the job waits in, and MSGCLASS where its log goes. This course's system reads these and changes nothing for them.
A statement has fields: the name right after //, a blank, the operation (JOB, EXEC, DD), a blank, then the operands, joined by commas with no blanks. A blank ends the operands. A line starting //* is a comment.
A name is 1 to 8 letters or digits and starts with a letter (or @, #, $). Each EXEC is a step, and the steps run from top to bottom:
//OPEN EXEC PGM=OPENDAY
//CLOSE EXEC PGM=CLOSEDAYPGM= names a program in a library. Here the library is the lesson's files: PGM=OPENDAY runs OPENDAY.cob. An EXEC can also run a procedure, a set of steps stored in a library; this course does not use them.
JES2 checks the whole job before it runs any step. A mistake such as EXCE for EXEC is a JCL error, and no step runs:
IEFC605I UNIDENTIFIED OPERATION FIELD (LINE 2)
IEF452I PAYJOB - JOB NOT RUN - JCL ERRORChallenge
EasyThe job has its steps but no JOB statement. Write it as the first line: job name BANKDAY, accounting (ACCT), programmer 'CODDY', CLASS=A and MSGCLASS=X.
Try it yourself
//* Write the JOB statement on the first line
//OPEN EXEC PGM=OPENDAY
//SYSOUT DD SYSOUT=*
//CLOSE EXEC PGM=CLOSEDAY
//SYSOUT DD SYSOUT=*
All lessons in Batch Jobs with JCL
Practice on your own: Online COBOL compiler