JCL (Job Control Language)
Job Control Language(JCL) is a scripting language that describe jobs, to the Operating System that runs in the IBM large server(Mainframe) computers. JCL acts as an interface between your application programs (COBOL, PL/1 , Assembler etc) and Mainframe OS (MVS or Z/OS). It is mainly a set of control statements that provide the specifications necessary to run an application program. In mainframe environment, programs can be executed in batch and online modes. JCL is used for submitting a program for execution in batch mode.
For every job that you submit, you need to tell z/OS where to find the appropriate input, how to process that input, and what to do with the resulting output. JCL is used to convey this information to z/OS. JCL was originally designed for punched cards, the details of coding JCL statements can be complicated. However, the general concepts are quite simple, and most jobs can be run using a very small subset of these control statements.
All jobs require the three main types of JCL statements: JOB, EXEC, and DD.
JOB statement – It should be the first statement in the JCL. It indicates accounting information and JOB related information to the system. It also specifies the information required for SPOOLing of the job such as job id, priority of execution, user-id to be notified upon completion of the job.
EXEC statement – The name of the program or procedure to be executed is coded here. Specifies the PROC/Program to be executed. Every EXEC statement in a JOB identifies one step. Maximum of 255 EXEC statements can be coded in a JOB.
DD statement -Data Descriptor. The dataset details are coded here. Dataset contains the data that need to be processed by the program or data that is produced by the program. Maximum 3273 DD statements can be coded in a step.
//JCLSCHOOL JOB ,,,NOTIFY=&SYSUID
//STEP1 EXEC PGM=IEFBR14
//DD1 DD DSN=JCLSCHOOL.JCL.PS,
// UNIT=SYSDA, SPACE=(TRK,(2,2),RLSE),
//SYSPRINT DD SYSOUT=*
In this JCL, a PS file is created
Abnormal End (ABEND) & ERROR
Once the work to be done is defined in JCL, it can be submitted to the operating system using SUBMIT command. Usually before submission, JEM or JSCAN is issued to check any possible JCL Errors.
1. Errors before job starts execution: If there are syntax errors, then the whole job is rejected with error message in JES MESSAGES. Typically this needs correction and resubmission of the whole JOB.
2. Errors before step starts execution: If there is any allocation issues like (dataset not found, duplicate dataset), then the job will be error out but in this case there might be already n steps got executed. Typically this need correction and restart in the job.
Unlike JCL Errors, ABEND happens during the execution of a program in a step. ABENDS are classified into 2 categories.
System ABEND(Snnn) – System abend occurs when the system is not able to execute a statement that is instructed in the program. The OS throws error.
User ABEND(Unnn) – When some unexpected condition occurs in the data passed, the program will call an abend routine and abend the step with proper displays. This is thrown by application based on requirement.