How do you submit a batch job to JES from CICS?
There are a couple of ways to submit jobs from CICS. The easiest is through CICS' spool interface commands. Introduced in CICS/ESA 3.1 (the first version 3), these commands allow you to read and write directly to the JES spool. The general command sequence would be:
EXEC CICS SPOOLOPEN EXEC CICS SPOOLWRITE EXEC CICS SPOOLCLOSE
You tell CICS to submit the JCL by coding
USERID('INTRDR') on the
SPOOLOPEN command. In addition, you should not code
NODE('*'), but include a specific node or
NODE('LOCAL') if the job is to run local system. You must also be sure you specify the correct output class for the standards at your shop. Look in the Application Programming Reference for details about how the commands work.
Alternatively, you can use an extra partition transient data queue (TDQ). The JCL or definition of the TDQ should point to the correct SYSOUT class and an internal reader. Then your program writes the JCL statements to the queue and then closes it. Note the job will not be submitted until the queue is closed. You will also need to use serialization techniques to prevent concurrent tasks from interleaving their JCL as they write.
The advantage of the spool commands is each task gets its own file so you don't have to worry about interleaving the JCL from two tasks. You also avoid closing and re-opening the TDQ each time.
Either way you choose you should be careful to arrange things so the batch jobs get proper security credentials. Certain attributes (e.g. inheritance) might give the batch jobs the same access authority as CICS, which could be bad depending on how much you trust your programmers. You must always be sure to put a slash-star card ("/*") at the end of the job so it will be automatically submitted.
Dig Deeper on IBM system z and mainframe systems
Related Q&A from Robert Crawford
For better mainframe capacity planning, how do I convert CPU hours to MIPS? And is there a way to calculate the relationship between MIPS and MSUs? Continue Reading
I have two years of experience in mainframe technology, currently working as a mainframe developer. I want to change to Java technology. Continue Reading
I want to replicate DB2 from the mainframe to an AIX box since it's cheaper and the copy can be used for testing. Is this possible? Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.