Procedures, symbols and overrides
A procedure is reusable JCL kept in a library. You call it, and optionally change parts of it from outside. Almost all production JCL is a short job calling a long procedure, so reading overrides is a core skill.
Two kinds of procedure
- Catalogued — stored as a member of a procedure library. Called by name.
- Instream — written inside the job itself between
PROCandPEND, then called. Useful when developing.
* member PAYPROC in PROD.PAY.PROCLIB //PAYPROC PROC ENV=PROD,RUNDT=00000000 //CALC EXEC PGM=PAYCALC,PARM='RUNDATE=&RUNDT' //STEPLIB DD DSN=&ENV..PAY.LOADLIB,DISP=SHR //INFILE DD DSN=&ENV..PAY.MASTER,DISP=SHR //OUTFILE DD DSN=&ENV..PAY.CALC,DISP=(NEW,CATLG,DELETE), // SPACE=(CYL,(50,10),RLSE) //SYSOUT DD SYSOUT=*
Calling it, and changing it
//PAYRUN01 JOB (ACCT01),'MONTHLY PAY',CLASS=A,MSGCLASS=X //RUN EXEC PAYPROC,ENV=TEST,RUNDT=20260930 //* override just the input file inside the CALC step //RUN.CALC.INFILE DD DSN=TEST.PAY.SMALLSET,DISP=SHR //* add a DD that the procedure does not have //RUN.CALC.DEBUG DD SYSOUT=*
The override rules
- Overrides are written as
stepname.ddname DD …where stepname is the step *inside* the procedure. - An override replaces the whole DD statement, not just the parameter you mention. Anything you omit is lost.
- Overrides must appear in the same order as the steps in the procedure.
- A DD name that does not exist in the procedure is added to that step.
- Symbols supplied on the EXEC replace the defaults on the PROC statement.
Seeing what actually ran
Because a procedure hides most of the JCL, the expanded version in JESJCL is the only reliable record of what the system did. Expanded lines are marked so you can tell procedure text from your own. When a job behaves unexpectedly, reading JESJCL is usually faster than reasoning about the override rules.
Symbols the system supplies
| Symbol | Value |
|---|---|
| &SYSUID | The userid that submitted the job |
| &SYSDATE / &SYSTIME | Date and time the job started |
| &SYSJOBNAME | The job name |
| &SYSPLEX | The sysplex name |
Common mistakes
Copy the whole DD from the procedure, then change what you need. Never write a short override and hope the rest is inherited.
They must follow the procedure's step order or the job fails with a JCL error that names the wrong statement.
&ENV.PAY.MASTER looks for a symbol named ENV.PAY. You need &ENV..PAY.MASTER.
Procedures are shared. Change the job, not the procedure, unless every caller should change.
What you will see at work
- Production jobs are frequently three lines calling a procedure with twenty steps. Always open the procedure before you judge what a job does.
- The environment symbol pattern (&ENV=PROD/TEST/DEV) is nearly universal and is what lets the same procedure run in every environment.
- When something 'works in test but not production', diff the two JESJCL listings. It is nearly always an override or a symbol.
Key terms
Check your understanding.
Take this lesson's quiz and save your progress. Free.