These three commands you need to submit JCL from CICS

Occasionally you may wish to submit a batch job to JES from CICS through internal reader. You submit JCL using SPOOLOPEN, SPOOLWRITE and SPOOLCLOSE commands.

How to send…

The first point is…

EXEC CICS
SPOOLOPEN OUTPUT MODE('*') USERID(INTRDR)
TOKEN(report_token) RESP(response field)
END-EXEC.

The explanation is NODE(‘*’) specifies a destination node to JCL to. The USERID is set to the name of internal reader.

A unique token will be allocated by CICS when the SPOOLOPEN is executed and placed in the field you specify using TOKEN(report_token). The token will be used as a sending field on subsequent commands. The token will be 8 bytes long. RESP must be coded to check return code.

The second point is…

To write each line of the JCL use SPOOLWRITE command

EXEC CICS
SPOOLWRITE FROM(io_area) TOKEN(report_token)
RESP(response field)
END-EXEC.

The io-area field should be the name of a data item containing the line of JCL. The 8 byte token field is same as the token returned from SPOOLOPEN.

At the end of the job statement write either ‘//’ or ‘//*’.

JCL from CICS tips to submit it.
JCL from CICS tips to submit it.

The third point is…

Finally you must close the spool using SPOOLCLOSE. It is good practice to close it explicitly.

EXEC CICS
SPOOLCLOSE TOKEN(report_token) RESP(response field)
END-EXEC.

The report_token field is same as the one allocated to SPOOLOPEN.

Advertisements

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.