FETCH directive

Purpose

This directive lets you include lines, fetched from a partitioned data set member or supplied by an exit, in your job.

Syntax


1  //*%OPC FETCH
1+ .,
2.1  MEMBER= member name
2.1  EXIT= exit name
1?  PHASE=
2.1! SUBMIT
2.1 SETUP
1?  COMP= ( + ., ( comparison expression ) )

Parameters

MEMBER=(member name)
Specifies the member name of a partitioned data set allocated to ddname EQQJBLIB. The lines in this member are included immediately after the FETCH directive.
EXIT=(exit name)
Specifies an exit to be called when the FETCH statement is invoked. This exit supplies lines to be inserted immediately after the FETCH directive in the job. For more details about exits, see Customization and Tuning.
PHASE=SETUP|SUBMIT
Specifies whether the FETCH should take effect during the setup or submit phase of the operation.
COMP=((comparison expression), (comparison expression),...)
Specifies comparison expressions used to decide whether the FETCH directive should be acted on. If the comparison expression is true, the FETCH directive is honored. For details on defining comparison expressions, see The COMP keyword on BEGIN and FETCH directives.

Usage Notes

The FETCH directive is used to include lines from other partitioned data sets or as supplied by an exit. Lines included by a FETCH directive cannot contain another FETCH directive. BEGIN and END directives with action INCLUDE or EXCLUDE cannot be included in lines inserted by a FETCH directive.

HCL Workload Automation for Z variables can be used to represent the values of any keywords, but not the keywords themselves. A FETCH directive cannot lie between a BEGIN/END directive pair that specifies ACTION=INCLUDE or ACTION=EXCLUDE.

Example

//*%OPC SCAN
//*%OPC FETCH PHASE=SUBMIT,
//*%OPC       MEMBER=JCL1,
//*%OPC       COMP=(&DAY..EQ.1)

FETCH directives can modify the structure of JCL from one run to another. For this reason, to apply again the same directives in a Restart and Cleanup path, ensure that they do not alter the structure of the JCL. For details, refer to JCL changes considerations.