JclIntroduction to JCL Jcl coding sheet JOB Statement Exec statement DD Statement Concatenating Datasets Referback in JCL Special DD statements Utility Programs Utility program IEBGENER Utility programs IEBCOPY and IEBCOMPR DFSort DFSort reformat dataset DFSort INCLUDE OMIT COND Procedures generation data group (GDG) JCL quick study JCL Interview questions
The JOB statement marks the beginning of the workload or the job to the OS and instruct how to process the job. The syntax for JOB statement is,
//Jobname JOB ,
The JOB statement is used to
- Mark the beginning of a job.
- When jobs are stacked in the input stream, the JOB statement marks the end of the preceding job.
- Tell the system how to process the job by coding parameters like accounting information, programmer id, requested time, region size, class etc.
Lets look into each and every parameter used in the JOB statement.
This is a mandatory field which provides an id to the job. The length of the job name is 1 to 8 bytes.
This is the keyword that identifies as JOB statement.
Account information and programmer's name are 2 types of positional parameters. Account information is an optional parameter.
This parameter refers to the id of the department or person to whom the CPU time is billed.
//* A JOB statement with account information //PROGPUB JOB (012)
This parameter identifies the person submitting the job.
//* A JOB statement with account information and programmer's name //PROGPUB JOB (012),'JOHN DOE'
There are wide range of keyword parameter. The most common are CLASS, PRTY, TIME, NOTIFY, MSGCLASS, MSGLEVEL, RESTART, ADDRSPC, REGION, TYPERUN. You can refer IBM manual for more keyword parameters.
//*A sample JCL to run a cobol program //PROGPUB JOB NOTIFY=&SYSUID,TIME=(,2) //STEP1 EXEC PGM=PROGRAM2 //STEPLIB DD DSN=PROGPUB.COBOL.LOADLIB,DISP=SHR //DD1 DD DSN=PROGPUB.FLATFILE.INPUT,DISP=SHR //DD2 DD DSN=DSRT061.FLATFILE.OUTPUT,DISP=SHR //SYSPRINT DD SYSOUT=* //SYSIN DD DUMMY
The JOB CLASS determines the importance of the job based on the CLASS value. The CLASS takes a single alphanumeric value (A-Z, 0-9), which is setup during installation. Syntax is
CLASS=(A-Z or 0-9)
//*JCL Statement with JOB Class 'A' //PROGPUB JOB (012),'JOHN DOE',NOTIFY=JOHN,CLASS=A
CLASS=A might have been setup for JOBs that need to be executed immediately. Typically, this setup is based on the organization.
This is the syntax for priority. This specifies the priority of the job within a job class. The value for priority ranges from 0-15 for JES2 and 0-14 for JES3. Higher the number, higher the priority. If the jobs are queued with same class and same priority, then the jobs are executed based on First In First Out (FIFO). Syntax is
PRTY=(0-15 or 0-14)
//*JOB statements with different priorities //PROGPUBA JOB (012),'JOHN DOE',NOTIFY=JOHN,CLASS=A,PRTY=10 //PROGPUBB JOB (012),'JOHN DOE',NOTIFY=JOHN,CLASS=A,PRTY=11
The TIME parameter when coded in the JOB statement, defines the time limit for the entire JOB to execute all its steps. The default time value is 1440. If the time limit is exceeded, the system abends the JOB with S322 abend code. The syntax is
Minutes range from 1 through 357912 (248.55 days)
Seconds range from 1 though 59
//*Different JCL statement with TIME parameter exmaples //*Maximum CPU time for this JOB is 2 minutes //PROGPUB JOB (012),'JOHN DOE',TIME=2 //*Maximum CPU time for this JOB is 2 seconds //PROGPUB JOB (012),'JOHN DOE',TIME=(,2) //*Maximum CPU time for this JOB is 5 minutes 20 seconds //PROGPUB JOB (012),'JOHN DOE',TIME=(5,20) //*Maximum CPU time for this JOB is maximum CPU time specified during installation //PROGPUB JOB (012),'JOHN DOE',TIME=MAXIMUM //*The following JOB statements removes any CPU time limit. //PROGPUB JOB (012),'JOHN DOE',TIME=1440 //PROGPUB JOB (012),'JOHN DOE',TIME=NOLIMIT
This parameter takes the value of a TSO user-id. The system sends the job completion and status (normal or abnormal end) to the user-id specified in the NOTIFY parameter. Syntax is,
//*TSO user id 'JOHN' is notified about the JOB status after completion //PROGPUB JOB (012),'JOHN DOE',NOTIFY=JOHN,CLASS=A
This parameter takes a single alphanumeric value (A-Z, 0-9) which is setup during installation. MSGCLASS value specifies the output destination of the JOB and system message. Syntax is,
MSGCLASS=(A-Z or 0-9)
//*JCL statement with message class 'A' //PROGPUBA JOB (012),'JOHN DOE',NOTIFY=JOHN,CLASS=A,PRTY=10,MSGCLASS=A
This parameter specifies the level of output message to be routed to output device specified in MSGCLASS. Default message level is (1,1) It has 2 sub parameters and the syntax is,
|0||Prints only JOB statement.|
|1||Prints entire JCL and expands procedure.|
|2||Prints entire JCL without expanding procedure.|
|0||Prints all the allocation messages only if the job ends abnormally.|
|1||Prints all the allocation messages whether the job ends normally or abnormally.|
//*JCL statement with message level (0,1) //PROGPUBA JOB (012),'JOHN DOE',NOTIFY=JOHN,CLASS=A,PRTY=10,MSGCLASS=A, // MSGLEVEL(0,1)
Usually this statement is used to restart an aborted job by specifying a step name. The syntax is
//PROGPUB JOB RESTART=STEP2,NOTIFY=JOHN,CLASS=A //STEP1 EXEC PGM=PROGRAM1 //DD ......... //STEP2 EXEC PGM=PROGRAM2 //.......
This parameter is used to specify the address space for the JOB to run. By default, it is virtaul address space. This allows or prohibits the job from being paged. It is not advised to use the REAL address space as it will reduce the system performance. Syntax is,
ADDRSPC=VIRT or REAL
//*JCL statement with address space set to use REAL storage //PROGPUBA JOB (012),'JOHN DOE',NOTIFY=JOHN,CLASS=A,PRTY=10,ADDRSPC=REAL
The REGION parameter specifies the amount of virtual storage a job can use. Every step in the job gets that amount of virtual storage as requested via the REGION parameter. Syntax is,
where n ranges from 1k to 2096128k in kilobytes and 1M to 2047M in Megabytes.
When the region parameter is coded with 0k or 0m, the system allocates optimum storage for that job.
If a job requires more storage than the one allocated via REGION parameter, the system abends with system code on 80A or 804.
//*List of different JCL statements with region parameter //PROGPUBA JOB (012),'JOHN DOE',NOTIFY=JOHN,REGION=0k //*Another example //PROGPUBA JOB (012),'JOHN DOE',NOTIFY=JOHN,REGION=4092K //*Another example //PROGPUBA JOB (012),'JOHN DOE',NOTIFY=JOHN,REGION=4M
This parameter has 3 values using which we can either check the JCL for error or hold the job for later execution.
This is used to scan the job for any error related to syntax, misspelled characters etc. The job is not run and the resouces are not allocated when using the SCAN value for TYPERUN parameter.
This is used to hold the JOB for later execution. The JOB remains in the input queue until the JOB is explicitly released by the operator.
This is to print the JCL without running the JOB.
//*List of different JCL statements with TYPERUN parameter //PROGPUBA JOB (012),'JOHN DOE',NOTIFY=JOHN,TYPERUN=SCAN //*Another example //PROGPUBA JOB (012),'JOHN DOE',NOTIFY=JOHN,TYPERUN=HOLD //*Another example //PROGPUBA JOB (012),'JOHN DOE',NOTIFY=JOHN,TYPERUN=COPY, MSGCLASS=A