Procedures (PROCs)
Procedures (PROCs)
A procedure is a reusable set of JCL statements defined once and called multiple times within a job or across various jobs.
Procedures are used to simplify job processing by allowing frequently used sets of JCL statements to be stored in a library and called whenever required. The EXEC statement is used to call and execute a procedure at the step level.
The main advantage of the procedures are -
- Reusing the same JCL statements to produce different outputs with different inputs.
- Reducing the repetitive coding.
Syntax -
Calling PROC -
//[step-name] EXEC PROC=proc-name[,parameters [comments]]
or
//[step-name] EXEC proc-name[,parameters [comments]]
PROC Definition -
//proc-name PROC
- Procedure Name (proc-name) - proc-name specifies the user-defined 8 character procedure name. proc-name should be the same in PROC definition and PROC calling.
- Operation - Operation is PROC and is optional.
- Parameters - Parameters are used to pass the overriding value to the procedure. All the parameters are optional. If the parameter field is coded, there should be one blank after the PROC operation.
- Comment - Comment used to make a note of the current statement. The comment field should be preceded with a blank after the parameters.
Procedure Types -
Procedures are of two types based on their definition and usage -
We explained these topics in the immediate chapters.
