How do you submit a batch job to JES from CICS?

    Requires Free Membership to View

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 extrapartiion 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.

This was first published in September 2007

Join the conversationComment

Share
Comments

    Results

    Contribute to the conversation

    All fields are required. Comments will appear at the bottom of the article.