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

Module 5: JCL PROCs Statement


Symbolic Parameters

Symbolic parameter offers convenient way of assigning different parameters to frequently used JCL procedures. It overrides parameters in a procedure. Symbolic parameters can be used in both cataloged and in-stream procedure. Most common task such as opening, reading and writing of dataset can be coded in procedure, but now challenge is each programmers may have their own dataset specification requirements. In such case symbolic parameter can be used which enables programmers to assign parameters according to their requirements.

A symbolic parameter on a DD statement can be coded by preceding the parameter that will be assigned a value with an ampersand sign (&). Values are assigned in the operand field for both the PROC and EXEC statement.

Let’s see example, to understand how we can use symbolic parameters

Example 1:-

//DEPTJOB JOB A123,’STEVE’ //INSTREAM PROC //STEP1 EXEC PGM=PROG1 //DATA1 DD DSN=&FILE1, // DISP=SHR //PEND //STEP2 EXEC INSTREAM,FILE1=DEPTFILE

In above example, DEPTJOB is submitted. The next statement indicates starts of procedure. The statement after that call program PROG1 and accessed a data set whose name is defined as the symbolic parameter &FILE1. After the PROC ends, next statement is calling instream procedure INSTREAM and also passing value for symbolic parameter as FILE1=DEPTFILE, thus at the time of Job execution DD statement DATA1 inside of INSTREAM proc will be substituted as follow:-

//DATA1 DD DSN=DEPTFILE, // DISP=SHR

Example 2:-

Cataloged proc:-

//CATALOGE PROC //STEP1 EXEC PGM=PROG1,PARM=&PARM1 //DATA1 DD DSN=DEPT1.EMP1.DATA1, // DISP=SHR //PEND

Job:-

//DEPTJOB JOB A123,’STEVE’ //STEP100 EXEC CATALOGE,PARM1=’28-08-1993’

At the time of execution, the statement whose name is STEP1 will look like below:

//STEP1 EXEC PGM=PROG1,PARM=’28-08-1993’

Example 3:-

//DEPTJOB JOB A123,’STEVE’ //INSTREAM PROC PDSPART1=USER, // PDSPART2=DEPT, // PDSPART3=LIB //STEP1 EXEC PGM=PROG1 //DATA1 DD DSN=&PDSPART1..&PDSPART2..&PDSPART3, // DISP=SHR //PEND //STEP100 EXEC INSTREAM

Since, no parameters passed in STEP100 while calling proc INSTREAM, values for symbolic parameters for DATA1 DD statement will be taken from PROC statement and thus during execution Dataset whose name is DATA1 will be substituted as follows:-

//DATA1 DD DSN=USER.DEPT.LIB, // DISP=SHR

Rules for coding symbolic parameter:-

  • One to eight alphanumeric or national characters (including ampersand) are allowed while coding symbolic parameter. However the first letter must be an ampersand (&), second letter must be alphabetic and rest of letters can be alphanumeric or national.
  • They should only be coded in operand field
  • It’s not allowed to code symbolic parameters for the keywords on EXEC statement. For example PGM, COND, TIME and PARM are keywords for EXEC statement. However, symbolic parameters can be coded for value associated with a keyword.
  • A value passed to a symbolic parameter may be overridden by yet another value, to the extent that redefinition is within the scope of same job. Suppose that if it is not overridden, the same value will be passed every time it is called
  • There is no limit on the length of the value assigned to a symbolic parameter. However, the assignment must fit on the same line; it cannot continue on the next line.
  • When we code positional parameter as symbolic, then a period should be added between them.
  • If a symbolic parameter is defined, make sure that the value is assigned and used in the procedure that defines the parameter.
  • Special character such as blank space, comma, period (.), slash (/), apostrophe (‘), opening/closing braces, ampersand (&), asterisk (*), plus (+), minus (-), equal (=) can be coded as is, if they are assigned to symbolic parameter.
  • Except above mentioned special characters, all other special characters must be enclosed within apostrophes. An apostrophe must be preceded by yet another apostrophe, if it is part of the value assigned to a symbolic parameter.






© copyright mainframebug.com
Privacy Policy