Friday, 25 January 2013

Parameters

There are two types of parameters –
1)      Positional Parameters : These parameters have fixed position, Position cann’t be shifted.
a)      Accounting information
b)      Programmers name
c)       PGM
d)      PROC

Note : PGM & PROC are two execptional positional fields which have equal sign.


2)      Keyword Parameters   : These parameters have equal sign with some values, position of these fields can be shifted.
a)   CLASS
b)   MSGCLASS
c)    MSGLEVEL
d)    NOTIFY
e)    USER
f)     OWNER
g)    TIME
h)    REGION
i)    COND
j)    RESTART
k) PRTY
l) PARM
         
Some parameters can be coded on JOB statement and some can be  or EXEC statement like TIME, REGION, COND & PARM.

Accounting Information :
Accounting information is realted to billing, dollar cost of job will be decided on this parameter. Maximum size 142 charecters.

//OZA201AS JOB (GENERAL),
Note :If position of Acccounting information is changed then job will give syntax error.


Programmers name :
Programmer name filed tells the name of programmer. Maximum length is 20 charecters.

//OZA201AS JOB (GENERAL), 'SANDIP WALSINGE',
Note :If position of programmer's name is changed then job will give syntax error.


PGM  :
PGM is positional parameter which is coded on exec statement. It tells the system which program (Load module or Utility ) needs to be executed.

//STEP010  EXEC PGM=TESTPROG


PROC :
PROC is positional parameter which is coded on exec statement. It tell system which procedure needs to be executed.

//STEP010  EXEC PROC=CATPROC

//STEP010  EXEC CATPROC - It has same meaning as previous statement.


CLASS :
Class parameters tell system about nature of job, if job is simple I/O type then lower class can be allocated to the job, if job is complex calculation related then higher class can be allocated to the job.
Values : A to Z or 0(Zero) to 9.

//OZA201AS JOB (GENERAL),'SANDIP',CLASS=A


MSGCLASS :
MSGCLASS parameter tells system where output messages should or job should be routed/transfered after execution.
Values : A to Z or 0(zero) to 9.

//OZA201AS JOB (GENERAL),'SANDIP',MSGCLASS=J
This will route job & messages to JHS (JHS is CA tool ). If nothing is coded then job will go to spool area.


MSGLEVEL :
MSGLEVEL parameter tells system how JCL, allocation messages and termination messages are printed in job listing after execution of job.
MSGLEVEL=(x,y)

X can have below values -
x=0,1,2
0 - Only JOB statement will printed after execution JESJCL step.
1 - JOB, JCL and expanded procedures will be printed JESJCL step.
2 - JOB & JCL statements will be printed in JESJCL step.

y Can have below values -
y=0,1
0 - JCL messages & allocation will be printed if job terminates abnormally.
1 - JCL messages & allocation will be printed if job terminates normally or abnormally.

NOTIFY :
NOTIFY Parameter gives notification to the user on successful or unsuccessful completion of job. 

NOTIFY=USERID OR (It will notification to the user whose userid is provided here as a user id)
NOTIFY=&SYSUID (It will notification to user who is executing the job.)  

//OZA201AS  JOB (GENERAL),'SANDIP WALSINGE',NOTIFY=OZA201




USER :
This parameter is rarely used parameter. This is to identify user.
//OZA201AS  JOB (GENERAL),'SANDIP WALSINGE',USER=OZA201


OWNER :
Owner is same as USER parameter, it will tell about owner of the job.
//OZA201AS  JOB (GENERAL),'SANDIP WALSINGE',OWNER=OZA201


TIME :
TIME parameter allocates maximum CPU time to the job or step. If job/step takes more time to execute than time provided in TIME parameter then job will abend with S322 abend code.

Job parameter can be coded on both JOB and EXEC statement.

*TIME parameter coded on EXEC will override TIME parameter coded on JOB statement.

Syntax :
TIME=(min,sec) or
TIME=(,)              - It will give system defined time.
TIME=1440          - It will give unlimited time.
TIME=NOLIMIT  - It will give unlimited time.
TIME=MAXIMUM - Job will run maximum 248.55 days.

//OZA201AS  JOB (GENERAL),'SANDIP WALSINGE',TIME=(min,sec)

//STEP1 EXEC  PGM=TESTPROG,TIME=(2,20)


REGION :
REGION parameter allocates space for execution of job. It can be coded on both JOB & EXEC statement. It can be coded either in Kilobytes (K) or Megabytes (M). When coded n Kilobytes, should be in multiple of 4.

*REGION coded on JOB statement will override REGION on EXEC statement.

//OZA201 JOB (GENERAL),'SANDIP WALSINGE',REGION=0M

//STEP1 EXEC PGM=TESTPROG,REGION=0M

COND :
COND parameter is coded to control execution of steps from job.

Ex : In 1st step account holder's transaction data is getting copied from transaction file to some output file for bkup purpose, in 2nd step transction file is getting deleted. 

If step1 fails due to some reason without copying data, but in step2 trandaction file will be deleted, so we will miss important data without taking bkup, in order to avoid such scenarios COND parameters are used.

*COND paramter can be coded on both JOB & EXEC statement.


Syntax :

COND=(comparision code, condition code)
EX: COND=(0,EQ)
Comparision code can have values like 0,4,8,6,12,16.
Condition code can be GT,LT,EQ,GE,LE.

COND=(comparision code, condition code, stepname)
EX: COND=(0,EQ,STEP1)

*IF Condition is TRUE then step will be skipped.
*IF condition is FALSE then step will be executed.

COND=EVEN - Step on which this condition is coded will execute when previous step terminates normally or abnormally.

COND=ONLY - Step on which this condition is coded will execute when previous step terminates only abnormally.


*COND coded on JOB statement will override COND on EXEC statement.

*If the tests on the JOB statement are not satisfied, the system then performs the return code tests on the EXEC statement. If a return code test is satisfied, the step is bypassed.


//OZA201AS JOB (GENERAL),'COND TEST',
//         CLASS=8,                  
//         PRTY=15,                  
//         TIME=(5),                 
//         MSGCLASS=Q,               
//         MSGLEVEL=(1,1),           
//         REGION=0M,                
//         COND=(0,NE),              
//         NOTIFY=&SYSUID            
//*                                  
//STEP1         EXEC  PGM=SORT            
//SYSPRINT DD    SYSOUT=*            
//SYSOUT   DD    SYSOUT=*            
//SORTIN    DD    *                   
STEP1   OUTPUT                       
//SORTOUT  DD    SYSOUT=*            
//SYSIN    DD    *                   
    SORT FIELDS=COPY                 
/*                  
//STEP2     EXEC PGM=SORT,COND=(0,EQ)
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN DD *
STEP2   OUTPUT
//SORTOUT DD SYSOUT=*
//SYSIN DD *
     SORT FIELDS=COPY
/*                                    

//STEP3   EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN DD *
STEP3  OUTPUT
//SORTOUT DD SYSOUT=*
//SYSIN DD *
     SORT FIELDS=COPY
/*                                    



Output : 
1) STEP1 will execute with MAXCC=0,
2) For STEP2 execution it will check JOB condition 0 NE 0, condition does not satisfy, so it will check EXEC condition 0 EQ 0, here condition satisfies so it will not execute STEP2.
3) For STEP3 execution again it will check JOB cond 0 NE 0 (STEP1 return code), condition not satisfied, so it will execute STEP3.

 EX 2:

//OZA201AS JOB (GENERAL),'COND TEST',
// CLASS=8,
// PRTY=15,
// TIME=(5),
// MSGCLASS=Q,
// MSGLEVEL=(1,1),
// REGION=0M,
// COND=(0,EQ),
// NOTIFY=&SYSUID
//*
//STEP1 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN DD *
STEP1 OUTPUT
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
/*
//STEP2 EXEC PGM=SORT,COND=(0,NE)
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN DD *
STEP2 OUTPUT
//SORTOUT DD SYSOUT=*
//SYSIN DD *
     SORT FIELDS=COPY
/*

//STEP3 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN DD *
STEP3 OUTPUT
//SORTOUT DD SYSOUT=*
//SYSIN DD *
     SORT FIELDS=COPY
/*









Output :
1) STEP1 will execute with MAXCC=0.

2) For STEP2 execution it will check JOB cond 0 EQ 0, here condition satifies so it will not execute STEP2 though EXEC cond is false ( 0 NE 0), it ignores EXEC cond as JOB cond is satisfied.

3) STEP3 will not execute as JOB cond (0 EQ 0) is true.                                   


RESTART :
Restart parameter is used to restart the job from perticular step.

Syntax : RESTART=stepname or procname.stepname

ex:
//JOB1      JOB (GENERAL),'SANDIP',RESTART=STEP2
//STEP1   EXEC PGM=PROG1
//STEP2   EXEC PGM=PROG2
//STEP3   EXEC PGM=PROG3

Here job will be restarted from step2.




PRTY :
//OZA201AS  JOB (GENERAL),'SANDIP',PRTY=15

It decides priority of the job, higher the priority job will execute sooner, if priority is same for jobs then job will execute on first come first serve basis.

Value ranges from 0 to 15, (14 & 15 are higher Priority). It is coded on JOB statement.



PARM :
//STEP010 EXEC PGM=TESTPRG,PARM='WELCOME TO COBOL'

It is used to pass value from JCL to application program, it is coded on EXEC statement. Maximum 100 characters can be passed thru this parameter. 

Receive PARM value in COB program :
LINKAGE SECTION.
01 PARM-VAR.
       05 PARM-LN             PIC S9(04) COMP.
       05 PARM-TX             PIC X(25).
PROCEDURE DIVISION USING PARM-VAR.
        DISPLAY PARM-TX.


DD statement Parameters :
1) DISP
2) UNIT
3) DCB
4) SPACE
5) VOLUME
6) DATACLASS


DISP=(x,y,z)

x- Indicates status of job
x can have values NEW, SHR, OLD or MOD.
y - Can have values CATLG, DELETE,UNCATLG,KEEP,PASS
z - Can have values CATLG, DELETE,UNCATLG,KEEP.

NEW  - It indicates dataset is new.

SHR   - It's used for already existing dataset, generally coded for input 
datasets, so that other jobs can share the dataset simultaneously.

OLD   - 
It's used for already existing dataset, generally coded for output datasets so that other jobs can not use this datasets. If records are already present in output file and tried to copy the data in the same file then existing data will be overriden.
  
MOD - It's used for already existing dataset, generally coded for output datasets so that other jobs can not use this datasets. If records are already present in output file and tried to copy the data in the same file then existing data will be apended.

UNIT=SYADA or TAPE
UNIT parameters tells the system where dataset is residing or where datasets needs to created.


DCB :
DCB parameter gives information of dataset related record length, record format, blocksize, dataset organization.

DCB=(LRECL=80,RECFM=FB,BLKSIZE=800,DSORG=PS)

LRECL -  
It tells information about length of record. 80 bytes is standard record length. Generally all source libs copylibs will have record length as 80 and RECFM as FB.

RECFM - 
It tells information about record format of dataset. 

RECFM Can be FB,VB,U,FBA,VBA.
FB - Fixed blocked (Records will have same length). 
VB - Variable blocked ( Records will be of variable length) 
         4 bytes will be reserved for storing information about record length. 
U - Undefined. This RECFM is used for loadlibs. 
FBA - Fixed blocked attirbute. This RECFM is used for report gengeration purpose.
VBA - Variable blocked attribute.

BLKSIZE - 
BLKSIZE parameter gives information about how many records can be stored in one block.

if BLKSIZE=800 and LRECL=80 then one block will contain 10 records. 
When BLKSIZE=0 is provided it means that system will allocated best BLKSIZE on it's own.

DSORG - 
DSORG=PS - Sequential dataset (PS)
DSORG=PO - Partitioned dataset (PDS)

SPACE : 
SPACE=(a,(x,y,z)) 

a - Can have values TRK,CYL,BYTE
x - Priamry space allocation ( in numbers like 1 2 3 )   
y - Seconday space allocation ( in numbers like 1 2 3 )
z - space for directory block (Required for PDS file only not applicable in case of PS files.

SPACE Calculation :
SAPCE=(CYL,(2,3)) - PS
2 * 1 + 3 * 15 = 2 + 45 = 47 Cyclinders will be acllocated.

SPACE=(CYL,(2,3,4)) - PDS
2 * 1 + 3 * 15 = 47 cylinders will be allocated and
4 * 5 = 20  maximum members can be allocated in one dataset.



 





























5 comments: