Let's understand Mainframe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

Module 5: JCL PROCs Statement


Overriding Parameters in Procedure

In some cases, we may need to modify or override one or more parameters coded in the procedure. IBM provided a convenient way to override parameter instead of rewriting whole procedure. It should be remembered that the modified content of a procedure which has overrides in it are activated only for the duration of the job in which they exist; the original contents remains intact

Syntax:-

//stepName EXEC procName //procStep.ddName DD modified_paramter1,modified_paramter2....

Where,

  • stepName is the step name in the job that the procedure will be executed from
  • procName is the name of procedure which will be called and executed
  • procStep identifies the procedure step whose parameters will be overridden
  • ddName is the dd name of the DD statement having those parameters.
  • One or more parameters can follow the DD operation field

Example 1:-

Let say we have proc CATALOGE defined as follows:-

//CATALOGE PROC //STEP1 EXEC PGM=PROG1 //DATA1 DD DSN=DEPT1.EMP1.DATA5, // DISP=SHR //STEP2 EXEC PGM=PROG2 //DATA2 DD DSN=DEPT1.EMP1.DATA6, // DISP=SHR //PEND

Assume we have requirement that for one of the job we need to call above proc but DISP for file DATA1 need is OLD and for file DATA2 we have to use DSN=DEPT1.EMP1.DATA7, in such case it’s not fair to change the procedure as it is possible that is getting used in other jobs too, so in such case we can use ‘Overriding parameter’ feature provided by IBM

Here’s the JCL that needs to be written to meet out requirement specified above:-

//DEPTJOB JOB A123,’STEVE’ //PROCLIB DD DSN=USER.DEPT.PROCLIB, // DISP=SHR //STEP100 EXEC CATALOGE //STEP1.DATA1 DD DSN=DEPT1.EMP1.DATA5,DISP=OLD //STEP2.DATA2 DD DSN=DEPT1.EMP1.DATA7,DISP=SHR //

Example 2:-

Proc:-

//CATALOGE PROC //STEP1 EXEC PGM=PROG1 //DATA1 DD DSN=DEPT.EMP.DATA1, DISP=SHR // DD DSN=DEPT.EMP.DATA2, DISP=OLD // DD DSN=DEPT.EMP.DATA3, DISP=SHR // DD DSN=DEPT.EMP.DATA4, DISP=OLD //PEND

Now, assume I have requirement for my Job such that I have to override DSN name DEPT.EMP.DATA2 and DEPT.EMP.DATA4 with DEPT.EMP.DATA22 and DEPT.EMP.DATA44 respectively. Below is JCL to achieve same:-

//DEPTJOB JOB A123,’STEVE’ //PROCLIB DD DSN=USER.DEPT.PROCLIB, // DISP=SHR //STEP100 EXEC CATALOGE //STEP1.DATA1 DD // DD DSN=DEPT.EMP.DATA22,DISP=OLD // DD // DD DSN=DEPT.EMP.DATA44,DISP=OLD //

When you carefully observe above JCL, you will encounter that the dataset names which are not being overridden are kept blank. However, for each data set name included in the concatenation, the DD operand must be coded

Nested procedures

  • As name suggests, IBM allows nesting of procedure, which means we can call a procedure from within another procedure.
  • Nesting of procedure is allowed up to 15 levels.
  • Add/ override/ nullification is applicable at only one level.Meaning, if PROC1 calls PROC2 and PROC2 call PROC3, then no statement in PROC3 can be overridden from PROC1 invocation. Only PROC2 can do that.






© copyright mainframebug.com
Privacy Policy