JCL – How to Execute a JCL

JCL is run for many purposes. At a high level, JCL is executed to run program/s or utility or list of utilities or procedure/s.

Steps to execute a JCL

STEP1 – Create the JCL

//CREATEPS JOB S12345,SALES, //*ACCCOUNTING INFORMATION
// CLASS=A, //*ASSIGN INPUT CLASS ACCOUNTING
// MSGCLASS=A, //*PROVIDE FORMAT OF OUTPUT MSGS
// MSGLEVEL=(1,1), //*MSGS THAT NEEDS TO BE PRINTED
// TYPRUN=SCAN, //*USED AS SCAN OR HOLD
// TIME=(10,20), //*AMOUNT OF MAXIMUM CPU TIME
// PRTY=10, //*IMPORTANCE OF JOB IN CLASS
// REGION=4096K, //*AMOUNT OF STORAGE REQUIRED FOR JOB
// NOTIFY=&SYSUID //*TO NOTIFY THE STATUS OF THE JOB
//*******************************************************************
//* JCL to create a PS file
//*******************************************************************
//STEPCRPS EXEC PGM=IEFBR14, //*PGM OR PROC OR PROCEDURE IS CODED
// REGION=2048K, //*AMOUNT OF STORAGE FOR THIS STEP
// TIME=(5,2), //*MAX CPU TIME FOR THIS STEP
// ACCT=(123,SLS) //*ACCOUNTING INFO FOR THIS STEP
//DD1 DD DSN=MATEKS.TEST.FILE, //*PHYSICAL DATASET NAME
// DISP=(NEW,CATLG,CATLG), //*DEFIND CS,ND AND AD
// SPACE=(TRK,(2,3),RLSE), //*SPACE DETAILS ARE DEFINED
// UNIT=SYSDA, //*LOCATION OF DATASET
// DCB=(DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=800)
//SYSPRINT DD SYSOUT=* //*PRINT OUTPUT MSGS IN SPOOL
//SYSOUT DD SYSOUT=* //*DISPLAYS OUTPUT MSGS IN SPOOL
//SYSDUMP DD SYSOUT=* //*DISPLAY DUMPS IN SPOOL AREA

We can check for any syntax errors. It can be done in multiple ways. Common ways to check for syntax errors are – self review, peer review, or by submitting the JCL with ‘TYPRUN=SCAN‘. Submitting a job with ‘TYPRUN=SCAN’ is optional and depends upon the individual’s choice.

TutorialBrain - TYPRUN-SCAN
TutorialBrain - TYPRUN SCAN

STEP2 – Check for syntax error(optional)

STEP 3 -Submit the JCL by issuing the command ‘SUB’ or ‘SUBMIT’ in the command line which is present at either the top or bottom of the JCL. 

If we submit the JCL with ‘TYPRUN=SCAN’, you can see if there is any syntax error in the JCL. This is a great way to test your JCL for any syntax error and this will not actually run the JCL

TutorialBrain-TYPERUN-SCAN-submit-jcl

To submit the JCL actually, you have to remove or comment out ‘TYPRUN=SCAN’ if you have coded it. You have to give ‘SUB’ or ‘SUBMIT’ in the command line.

TutorialBrain - Submiting a JCL using SUB command
TutorialBrain - notification of the status of the JCL

JCL Interview Question and Answers

1. Order of Job Execution is determined by

Answer: JOBCLASS and PRTY

2. The statement that supply accounting information for jobs sent to remote nodes for execution is :

a. /*NET
b. /*REMOTE
c. /*NETACCT
d. /*XEQ

c.  /*NETACCT

Tutorials for all brains!