Sie sind auf Seite 1von 49

Job Control Language

- Part 1

Prepared by - Tejas Shah (CSS-SRM Project)

What is a Job ?
Job is a independent unit of work Each job begins with a JOB card and contains one or more job steps Each step executes a program or a procedure

Job Control Language


Set of control statements (Cards) which take care of Job Management Task Management Data Management Specifies and directs execution / sequence of programs Describes the I/O devices used Requests needed system resources, facilities and provides information about who the Job belongs to, which account to charge, Priority of Job, Memory and Time required for the successful execution of the Job Serves as a means of communication between program & operating system (MVS)

Job Control Language


Basic layout of JCL statements : Identifier [name] [operation] [parameters] [comments]

Identif ier
1 2 3 4

Name field
5 6 7 8

SP AC Operation field E 9 10 11 12 13 14 15 16 17

SP AC Parameter field E 18 19 .. .. 70 71

SP Comment AC field E 72 .. .. 80

/ / Identifies this line as a executable JCL statement /

*
/ / / /

Identifies this line as a end of an in-stream data set

/ / / / / /

Provides comment // followed by spaces is referred to as NULL statement which marks the end of a job The name field associates a name with a JCL statement. It's mandatory for JOB statement and optional for EXEC and DD statements. It consists of from 1 to 8 characters and must begin in column 3. Characters used are letters, numbers or national characters and must start with letters or national characters

<spaces> A B C .. 0 1 2 3 # $ @

.. ..

.. Y .. 8

Z 9

Identif ier
1 2 3 / / J / / S / / S 4 O T Y

/ / / / / /

SP AC Operation field Name field E 5 6 7 8 9 10 11 12 13 14 15 16 17 B D C A J O B E P 0 1 0 E X E C S I N D D O U T P U T P R O C P E N D

SP AC Parameter field E 18 19 .. .. 70 71

SP Comment AC field E 72 .. .. 80

Operation field follows the name field and specifies the function to be performed by a statement. It can be coded anywhere on the card, as long as it's separated from the name field by at least one blank. It's always better to start operation field from 12

Identif ier
1 2 J S S 3 4 O T Y

Name field
5 B E S 6 D P I 7 C 0 N 8 A 1

SP AC Operation field E 9 10 11 12 13 14 15 16 17 J 0 E D O X D B E C

SP AC Parameter field E 18 19 .. .. 70 71

SP Comment AC field E 72 73 .. 80

/ / / / / / / / / / / /

Positional Parameter Keyword Parameter Symbolic Parameter

The parameters field begins at least one position after the end of the operation field. Parameters provide information that influences how the statement is processed. Parameter may be one of three types: (a) Positional (b) Keyword OR (c) Symbolic

The comment field begins in column 72 and it's content will be ignore by MVS.

Overview of JCL Statements


JOB First statement - marks beginning of job Contains accounting and job information EXEC Marks the beginning of job step or task Identifies program or procedure to be executed Contains job step control information DD (Data Definition) Identifies and describes the data set Requests allocation of I/O devices

Overview of JCL Statements (Contd.)


PROC (Procedure Start) Marks beginning of procedure (Subroutine) Assigns default values to parameters in procedure PEND (Procedure End) Marks end of instream procedure only

Overview of JCL Statements (Contd.)


COMMENT //* Used to document program and resource requirements Used in columns 4 to 80 DELIMITER /* Indicates end of data placed in input stream NULL // Marks the end of job

Parameter Field
Consists of parameters separated by commas Parameters are basically of three types

Positional Keyword Symbolic

Parameter Types
Positional parameters are characterized by their position in operand field. i.e. MVS interprets the meaning of a positional parameter based on it's position in the parameters field. If you need to omit a positional parameter, you may need to account for the missing parameter by coding an extra comma. Keyword parameter are positionaly independent and has the form keyword=value. Symbolic parameters represent variable names symbolically, and are replaced by the actual values at the time of execution. Multiple sub parameters are separated by commas and enclosed in ( )

Continuation of JCL Statements


The Parameter field can be continued to next line provided the last record is a complete parameter followed by a comma or a complete subparameter followed by a comma. The continuing line should have slashes in its first two columns and a blank in 3rd column. The continuing line text should start before the 16th column. e.g. //JOBA JOB MSGCLASS=A, TIME=5, // NOTIFY=XYZ

Sample JCL
//SMPEF14A JOB SMPEF14, // 'KEVIN COLLACO', // MSGCLASS=A, // CLASS=A, // NOTIFY=SMPEF14, // MSGLEVEL=(1,1) //* Sample JCL to create a data set //STEP1 EXEC PGM=IEFBR14 //DD1 DD DSN=SMPEF14.TRNG.DATA, // DISP=(NEW,CATLG), // UNIT=SYSDA, // DCB=(RECFM=FB,LRECL=8,BLKSIZE=160) // SPACE=(TRK,(1,1)), // VOL=SER=BAGU01

Job Statement
The JOB statement, which must always be the first JCL statement coded for a job, Marks the beginning of a job JOB statement performs basic three functions:
Identifies a Job to MVS and supplies a job name that uses to refer to the job. Supplies accounting information so that MVS determines who should be billed. Supplies various option that influence the processing of the job.

Job Statement
Syntax used for JOB statement
//jobname JOB [positional,][keyword,] [cmts]

Positional Parameters are


Accounting information Programmer information

Accounting Information
Used for system accounting Installation defined First parameter Total length not to exceed 142 characters which include commas but excluding closing parenthesis Special characters to be enclosed in apostrophes Example : //EODJB01 JOB (ACCT),..

Programmer Information
Used to identify a person or group responsible for the job Total length not to exceed 20 characters including any special characters Special characters to be enclosed in apostrophes Example : //EODJB01 JOB (ACCT),TEJAS SHAH,.

Keyword Parameters
Follows the positional parameters The commonly used parameters are : CLASS MSGCLASS MSGLEVEL NOTIFY TYPRUN RESTART TIME REGION & ADDRSPC COND PRTY

CLASS
Specifies the class in which job is run Each class has unique characteristics and are installation defined Example : //EODJB01 JOB (ACCT),TEJAS SHAH,CLASS=A,.

MSGCLASS
Output class to which JOB output has to be sent Value range A - Z or 0 - 9 Example : //EODJB01 JOB (ACCT),TEJAS SHAH,CLASS=A,MSGCLASS=J,..

MSGLEVEL
Specifies printing of JCL submitted and allocation messages Allocation messages at beginning of each step describe dataset allocation to devices and show data set dispositions MSGLEVEL=(JCL,ALLOCATION) JCL 0 Only the JOB statement 1 All JCL statement & catalogued procedures 2 Only JCL statements in the input stream ALLOCATION 0 do not print allocation messages unless the job terminates abnormally 1 Print all messages Frequently used Value : MSGLEVEL=(1,1)

NOTIFY
Requests system to send a message to user-id specified on completion of background JOB process (normal/abnormal) Syntax NOTIFY=USER-ID User Id must be a valid user Id Example : //EODJB01 JOB (ACCT),TEJAS SHAH,CLASS=A,MSGCLASS=J,MSGLEVEL=(1,1), NOTIFY=LSTXS25,.

TYPRUN
TYPRUN=HOLD ; Job stream is put on hold status until an operator issues a command to release it. TYPRUN=SCAN ; Job stream is scan for syntax errors without scheduling it for execution. TYPRUN=COPY ; Job stream is printed as a SYSOUT data set, the class of which is determined by the MSGCLASS parameter and it is not processed. TYPRUN=JCLHOLD ; Job stream is put on hold status even before it is scan for syntax errors until an operator issues a command to release it.

TIME
Used to specify the maximum length of CPU time allowed for successful execution of job or step Syntax
TIME=[(minutes][,seconds)]

Minutes - ranges from 1 - 1439 Seconds - ranges from 1 - 59 1440 - specifies unlimited processor time Time is related to the installation defined class and can be overridden

Example
//STEP1 EXEC PGM=INVANL,TIME=5 //STEP2 EXEC PGM=REPORT,TIME=(,30) //STEP3 EXEC PROC=BILLING,TIME.PAID=(45,30), // TIME.BILL=(112,59)

Region
Specifies the maximum amount of main memory allocated Syntax REGION=(Value K|Value M) Job Statement Specifies memory for all steps in job Procstepname option is invalid Exec Statement Specifies memory for job step only Procstep option is applicable

Region (Contd)
Region parameter can be used in conjunction with address space parameter - ADDRSPC Syntax ADDRSPC=REAL ADDRSPC=VIRTUAL(Default) Example
//RUN JOB 175,SMITH,REGION=120K,ADDRSPC=REAL //STEP1 EXEC PGM=BILL,REGION=40K

COBOL Return Codes


COBOL compiler / linkage editor issue different return codes depending upon the error condition Value Condition 0 No errors or warnings 4 Warnings Detected 8 Serious errors, execution likely to fail 12 Severe errors, execution impossible 16 Terminal Error, execution cannot continue JOB & EXEC statement - If return code test on JOB statement is satisfied job terminates else system performs test on the EXEC statement

COND
When you specify the COND parameter in a JOB statement, you specify the conditions that cause the job to stop processing. Examples: COND=(4,LE) means that if 4 is less than or equal to the return code issued by any job step, the remaining job steps are to be bypassed. COND=(8,EQ) ; COND=((8,EQ),(16,LE)) COND=(8,EQ,EDSTEP) COND=((8,EQ,STEP1),(12,LE,STEP2))

Operators used are : GT, LT, GE, LE, NE, EQ

COND
RETURN CODE FROM ANY PREVIOUS STEP CURRENT STEP IS TO BE BYPASSED WHEN RETURN CODE OF ANY PREVIOUS STEP IS '8' CONDITION PARAMETER CODED FOR THE CURRENT STEP. 2

COND= (8,EQ)

FALSE

STEP WILL BE EXECUTED

COND
COND=EVEN (Execute current step even if previous step has abended) COND=ONLY (Execute current step only if previous step has abended) Unless a job contains a step that specifies EVEN or ONLY, an abend in any job step causes the rest of the job steps to be bypassed. Example:
//STEP4 EXEC PROC=BILLING, // COND.PAID=(20,LT), // COND.LATE=(60,GT,FIND), // COND.BILL=((20,GE),(30,LT,CHNG))

RESTART
This parameter allows you to start processing of your JOB from a particular JOBstep. Syntax RESTART=<stepname>

PRTY
This parameter allows you to set the priority of your JOB. This will be useful when two jobs of same class are submitted to an initiator. Syntax PRTY=<nn> nn can have values from 1 to 15.

How to specify program library


By default, all executable modules will be searched in a system libraries that are specified by system programmers when MVS is initialised. When these modules lie in private libraries it can be informed to the system through JOBLIB and STEPLIB DD statements. JOBLIB : programs to be searched for all job steps. It should follow JOB statement immediately if coded. JOBLIB will override search in system libraries. STEPLIB : Applicable for a particular job step only. It should follow the EXEC statement. STEPLIB overrides JOBLIB.

How to use JOB or STEP Catalog


As we know all the data sets on an MVS system must be cataloged. MVS uses the HLQ of a data set name to indicate the catalog that owns the file. You can, however, override the catalog indicated by the HLQ by coding JOBCAT or STEPCAT DD statements to indicate the catalog you want MVS to use. JOBCAT statement should follow JOBLIB statement and STEPCAT statement should follow STEPLIB statement.
//JOBCAT DD DSN=CSS.CICPR8A.APPL.SOURCE, DISP=SHR //STEPCAT DD DSN=LSTXS25.DV8D.APPL.SOURCE,DISP=SHR

EXEC
Marks the beginning of job step / task Identifies the program or procedure to be executed Describes how a job step is to be executed A job can have a maximum of 255 job steps which include job steps in called procedures Syntax //[STEPNAME] EXEC [POSITIONAL] [,KEYWORD] PGM and PROC are positional parameters and they identify the executable module.

EXEC
Keyword parameters are REGION, TIME, COND, PARM, ADDRSPC etc. When Keyword parameters are coded on both JOB and EXEC statements, EXEC statement parameters override JOB statement parameters. PARM parameter : PARM parameter is used to pass data from a JCL statement to an executing program. //STEP1 EXEC PGM=UPDATE,PARM=TEST$123

How to use the IF, ELSE, and ENDIF JCL statements


//[name] IF (relational expression) THEN {JCL statements to be executed if the condition is true} [//[name] ELSE] {JCL statements to be executed if the condition is false} //[name] ENDIF Operators can be used are GT(>), LT(<), GE(>=), LE(<=), EQ(=), NE( =), NG( >), NL( <), AND(&) and OR(|). Keywords can be used are RC, ABENDCC, stepname.RC, ABENDCC=xxxx etc...

How to use the IF, ELSE, and ENDIF JCL statements


Examples: // // IF RC > 0 THEN IF STEP010.RC = 6 AND STEP020.RC < 16 THEN Nesting of IF statement can be done up to 15 levels, but it is not advisable to do nesting more than a couple of levels.

PGM (Program Execution)


Syntax PGM=programname Identifies program to be executed Program is a member of a PDS (system, private or temporary) //STEP1 PGM=PAYSLIP //STEPLIB DD DSN=SMPEF14.PAYROLL.LOAD,DISP=SHR

Procedures
JCL procedure is a set of frequently used JCL statements to perform specific tasks May be Instream or Catalogued Instream Procedures Set of JCL statements placed in an input stream within a job A PROC statement is the first line and PEND statement is the last line of an Instream procedure Catalogued procedures Set of tested JCL statements stored within a system or installation defined procedure library. A PROC statement must precede all other JCL statement

Using Procedures
Procedure can not contain : EXEC statement requesting catalogued procedure JOB, Delimiter, NULL statements - JOBLIB DD statement - DD * or DD DATA statements
Catalogued procedure syntax : //<name> PROC <parameter list> // . // <procedure body> // . Instream procedure syntax : //<name> PROC <parameter list> // . // <procedure body> // . //<name> PEND

Using Procedures
Instream procedure should always be placed before the EXEC statement that calls in Catalogued procedure is retrieved from the system library or installation defined procedure library Parameters are passed to a procedure via symbolic variables

Using Procedures (Contd.)


Keyword Parameters Assign default value to symbolic parameters on procedure statements Symbolic Parameters Used for parameters that may vary during execution Length of 1 - 7 alphanumeric or national characters Preceded by ampersand symbol & Increased procedure flexibility Value can be assigned in PROC or calling EXEC statement Sequence of parameters is immaterial EXEC statement overwrites PROC statement parameters

Example
//BP630 PROC LODLIB1='CULLPR.LOADLIB', // LODLIB2='CSSA100.BATCH.LOADLIB', // PARMS=, // PREFIX=CSSBATCH, // PREFIX1=CSSBATCH, // SIZE=2500K, // SOUT=J // SYSCTL='IDMSPR.SYSCTL', //********************************************************** //STEP010 EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=&SOUT //SYSIN DD DSN=&PREFIX1..PARMS(BP6301), // DISP=SHR //********************************************************** 04680000 04690000 04700000 04710000 04720000 04730000 04740000 04750000 04780000 04790000 04800000 04810000 04820000 04850000

In the above procedure, PARMS, PREFIX, LODLIB1, LODLIB2, PREFIX1 are all symbolic variables.

Example
//STEP020 EXEC PGM=BP630BC, // PARM='&PARMS', // REGION=&SIZE //STEPLIB DD DSN=&LODLIB1, // DISP=SHR // DD DSN=&LODLIB2, // DISP=SHR //SYSCTL DD DSN=&SYSCTL, // DISP=SHR //SYSOUT DD SYSOUT=&SOUT //SYSUDUMP DD SYSOUT=&SOUT //SYSDBOUT DD SYSOUT=&SOUT //SYSABOUT DD SYSOUT=&SOUT //SYS001 DD DSN=&PREFIX..BP63015D.OUTFILE, // DISP=OLD //SYSIN DD DUMMY //* * //********************************************************* 04860000 04870000 04880000 04890000 04900000 04910000 04920000 04930000 04940000 04950000 04960000 04970000 04980000 04990000 05000000 05010000 05030000

PROC (Procedure Execution)


Syntax PROC=procedure-name Identifies a catalogued or instream procedure to be executed Procedure name may be Member of a catalogued procedure i.e. SYS1.PROCLIB or installation defined library An instream procedure which appears earlier in the JOB Example
//SP3 EXEC PROC=PAYWKS //SP3 EXEC PAYWKS

PARM
Used to pass variable information (parameters) into a program or procedure executed by job step Syntax : PARM[.procstepname]=information Information length not to exceed 100 characters which include commas, excludes parenthesis or apostrophes procstepname may be a catalogued or instream procedure

Das könnte Ihnen auch gefallen