Using a procedure

To execute a procedure, call it on an EXEC statement in an in-stream job. Specify the name of the procedure in the PROC parameter of the EXEC statement. The step uses the JCL statements in the procedure as if the JCL statements appeared in the input stream immediately following the EXEC statement. If necessary, you can modify the procedure for the current execution of the job step.

When you call a procedure, the system retrieves it using the following search order:
  1. From the input stream

    If the called procedure is an in-stream procedure, the system retrieves it from the job input stream. You must place the in-stream procedure before the EXEC statement that calls it.

  2. From a private library

    If the called procedure is cataloged in a private library, the system retrieves it from the private library that you specify on the JCLLIB statement that appears earlier in the job stream.

  3. From the system library (in a non-APPC scheduling environment)
    If the called procedure is cataloged in a system library, the subsystem retrieves it as follows:
    • In JES2, from the library name on the PROCLIB= parameter on a JES2 /*JOBPARM statement. See /*JOBPARM statement for more information.
    • In JES3, from the library name on the PROC= parameter of the JES3 //*MAIN statement. See //*MAIN statement for more information.
    • In MSTR, the data set specified by the IEFPDSI DD statement in the currently active master JCL is searched for procedures. The default master JCL specifies SYS1.PROCLIB.