Beruflich Dokumente
Kultur Dokumente
- Part 1
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
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
*
/ / / /
/ / / / / /
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 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
/ / / / / / / / / / / /
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.
Parameter Field
Consists of parameters separated by commas Parameters are basically of three types
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 ( )
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]
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
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))
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
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.
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
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
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
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