How do we submit JCL’s from CICS Online program?, we can use a TDQ or CICS SPOOL Verbs. So how these CICS SPOOL Verbs differs from TDQ?. The problem with TDQ is that in most of the sites, application developers are not authorized to create TDQ (its sysadmin task ) , not that much flexible, and we are responsible to read TDQ sequentially . So thats how CICS JES commands comes into picture. We can read the Spool data and write into spool. today we are gonna look only submitting the jobs.
The JES-CICS interface is totally depends on SPOOL initialization parm of CICS TS, check with your sysadmin guys whether CICS SPOOL parm is YES or NO. To use JES-CICS, SPOOL keyword must be YES.
Submitting a batch job has 3 steps
1. SPOOLOPEN OUTPUT
We are opening SPOOL for submitting JCL, we need to provide USERID and need to store TOKEN for the connection. We must use the same token till we close the spool. The userId is not RACF ID it must be INTRDR (Internal reader), the token is a 8 bit alphanumeric dataname (PIC x(8).
EXEC CICS SPOOLOPEN OUTPUT
Is for writing the lines of JCL statements into spool with INTRDR. we should define the data name which holds the JCL statements as a 80 bit length Alpha numeric field (PIC X(80). we must provide the length in FLENGTH of SPOOLWRITE. we must provide the token which we got when we opened spool.
EXEC CICS SPOOLWRITE
FLENGTH(LENGTH OF WS-LINE(WS-CNTR))
Okay, we have written our jcl statements to JES; now we need to close the spool connection so the JCL will get submitted. we must provide the token which we got when we opened spool.
EXEC CICS SPOOLCLOSE
occurs when Dynamic allocation rejected request to allocate input dataset.
Can occur if any of the following happens. Unsupported function, Unsupported language, From dataname is missing etc.
JES interface is used by another task.
Happens when the from dataname contents and FLENGTH value are mismatching, we can always make use of ‘LENGTH OF’ keyword to avoid this.
Spool report has not been opened.
this happens when we have no JES subsystem.
Sample program for Submitting JCL from CICS
When the application finished the execution you can see the job in SPOOL ( with SDSF or whatever).