IBM MAINFRAMES Job control LanguageJCL 01 Introduction on

IBM MAINFRAMES Job control Language(JCL) - 01

Introduction on JCL § § JCL is used to compile and execute batch programs. To write any JCL we require 1. JOB Statement. 2. EXEC Statement. 3. DD Statement. 4. Null Statement. JOB : Execution of one or more programs is knows as a job.

JCL Statement’s § JOB STATEMENT: JOB statement is used to identify the JOB Name and JOB’s related parameters (accounting info, username, class, notify etc). § Syntax: § //JOBNAME JOB ACCTINFO, USERNAME, CLASS, NOTIFY. . § § Accounting Information: Is mainly used for billing purpose. User name: Is used to identify who has written the JCL. Class: Is used to provide resource constraint to the job. Notify: Is used to decided to which USER-ID the JOB has to be notify after successful or unsuccessful compilation.

JCL Statement’s § contd. . EXEC Statement: This statement is used to identify the step name and program name. A maximum we can write 255 statements in a single JOB. § Syntax: § //STEP 1 EXEC PGM=PROG NAME § DD statement: Is used to specify the input and output location required for a program execution/compilation. § Syntax: § //DDNAME DD PARAMETERS

Job CARD statement in Detail //JOBNAME JOB // ACCOUNTING-INFORMATION, // PROGRAMMER-NAME, // CLASS=JOB-CLASS, // PRTY=PRIORITY-NUMBER, // MSGCLASS=MESSAGE-CLASS, // MSGLEVEL=(STATEMENTS, MESSAGES), // REGION=REGION-SIZE(KB/MB), // COND=(RC, OPERATOR), // RESTART=STEPNAME, // TIME=(MM. SS), // TYPRUN=(HOLD, SCAN), // NOTIFY=&SYSUID

JCL Parameter § There are two kinds of parameters in the operand field : - POSITIONAL and KEYWORD parameters. § The operating system recognizes positional parameters by their position in the operand field. § Ex : Accounting Information and Programmer Name § Keyword parameters can be coded in any order, defined by a JCL reserved name. § Ex: TIME, CLASS, NOTIFY. . etc. § Positional parameters must be coded in a specific order before any keyword parameter.

Positional Parameter § Accounting Information Positional Parameter is used to supply any type of accounting information which may be required by a particular installation. § The entire Accounting Information Parameter may contain as many as 142 characters. § If Subparameters are used in the Accounting Information Parameters, they must be separated by commas and enclosed within parentheses. § Programmer Name: Identifies the individual or group responsible for the job. The Programmer Name positional parameter may be from 1 to 20 characters long, including any special characters.

Positional Parameter Example Assuming that your installation requires 4 subparameters - account number, billing date, billing code, and billing location-- //Jobname JOB (400 -234 -15678, ’ 05/30’, 4 B 16, // ‘ST. LOUIS, MO. ’), ’SAHA’, …

Key Word Parameters Class : These tell about how much time each jobs should run. Class are divided into executions of certain types from A to z category. Depending on installation the grades was given for each class type. A - 10 min’s the job has to complete B - 30 min’s C - 1 hour … O 24 hours… Why we need so many class because • Generating Reports for a year, may take 14 hrs to generate report. • Doing updation /deletion /addtion of records , may take 1 hour. • Doing some calculation , may take 3 to 4 min’s we have to provide the class for each job according to the work time.

Key Word Parameters PRTY: Three jobs was submitted at a time to the system so which job should submit first. To avoid the confusion the priority will help the system. PRTY range will start from (1 to 15) again it will depend on the installation.

Key Word Parameters MSGLEVEL: This parameter tells OS which messages you want to printed. The format of the parameter. MSGLEVEL = (Statement , messages) Statement : Refer to your coded JCL statement. Messages : To the system output messages generated by OS Use of MSGLEVEL: If you want to avoid some of the statements and messages which was generated by OS we can do by using MSGLEVEL. What will be happening if you omit the MSGLEVEL, the installation default will apply.

Key Word Parameters STATEMENTS 0 = Print only the job statement 1 = print all JCL statements including statements from cataloged procedures 2 = Print only the input JCL MESSAGES 0 = Print system messages only if the job abnormally terminates 1 = Print all system messages every time. For e. g MSGLEVEL(1, 1) all the messages and statements which was generated by OS are printed. MSGLEVEL = 0 No messages and statements.

Key Word Parameters MSGCLASS : The message class parameter is associated with an output writer that in turn, is associated with a specific output device. This enables you to route the system messages to a specific printer or other output device. As your job is executing it also provide you information if the system abnormally terminated and other information that will help you to analyze the results and also OS puts out so many system messages. Where this system messages should write/ dump. The MSGCLASS will help the system where it has to write/dump and also It tells you whether a file was kept or deleted after a job step was finished.

Key Word Parameters § Suppose we have submitted a job having 10 steps and after executing step 5 , step 6 got abend and when we submit for next time after resolving the step 6, but we need to start the job from step 6 but not from step 1 § RESTART parameter is one of most important parameter that used in real time § § Using this parameter we can start a job from a particular step Syntax § RESTART = STEPNAME

Key Word Parameters TYPRUN=SCAN/HOLD § The TYPRUN parameter allows the operating system to: § SCAN the JCL for errors. Once the scan is completed, a JCL listing, containing any errors found, will be printed. The Job will not be executed. HOLD – the job is submitted into the system but will not be executed. The job will stay in HOLD status until the TYPRUN parameter is deleted.

Key Word Parameters // COND=(RC. OPERATOR, STEPNAME), § This parameter is used to either to bypass a particular step or to execute a particular step. § The Return Code(RC) is a number from 0 through 4095 which is compared to the return code or completion code issued by a program. § The OPERATOR specifies the type of comparison to be made: i. e. , GT, LT, GE, LE, NE & EQ. § The STEPNAME refers to a particular step to which the RC is compared.

Key Word Parameters § If the COND is true them the particular step is bypassed and executes when failed. § We got Two other options here: EVEN and ONLY § EVEN – Specifies that the job step is to be executed if any preceding step abended and no other RC tests mentioned here are satisfied: § § If a RC test is specified here and it’s true, this step is bypassed. ONLY – Execute this step only if a previous step abended and no RC tests specified here are satisfied. § COND=ONLY/EVEN

Key Word Parameters REGION: The maximum amount of main storage allocated to your program. To execute are run a program we have provide some space for his job the region will tell to the system how much memory that the job required. Syntax REGION = N kb/MB Maximum region value is 0 MB

Key Word Parameters TIME=(MM, SS) § The TIME parameter specifies the total amount of CPU time the job will be allowed to run. § The TIME parameter has 2 subparameters - one which indicates the number of minutes and one which indicates the number of seconds the job will be allowed to run. § We can specify maximum by coding § TIME=NOLIMIT/ MAXIMUM/1440

The EXEC Statement EXEC : The EXEC statement as it is used to cause the execution of one program or a procedure. Its recommend that all your Job steps have meaningful step names. //STEPNAME EXEC PGM = SAMPLE, PARM =VALUE, // TIME=(0, 0), COND=(RC, OPER), REGION=RSIZE K/M Most of the system messages you will receive will refer to the step name. If you give blank step name it will show blank only. PGM : Exec statement identifies the program to be executed in each step.

PARM Parameter § § It is used to access the data that are external to the program. § Linkage section MUST be coded with a half word binary field, prior to actual field. If length field is not coded, the first two bytes of the field coded in the linkage section will be filled with length and so there are chances of 2 bytes data truncation in the actual field. JCL can send maximum 100 characters to a program thru PARM. 01 LK-DATA. 05 LK-LENGTH PIC S 9(04) COMP. 05 LK-VARIABLE PIC X(08).

Thank You Polsani Anil Kumar
- Slides: 22