Q
Problem solve Get help with specific problems with your technologies, process and projects.

Submitting a batch job from CICS

Expert Robert Crawford explains to a reader how to use CICS' spool interface commands and an extrapartiion transient data queue to submit batch jobs.

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.

This was last published in September 2007

Dig Deeper on IBM system z and mainframe systems

PRO+

Content

Find more PRO+ content and other member only offers, here.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Join the conversation

1 comment

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

Running a job under the CICS region id is a nightmare waiting to happen, and also a violation of accepted security practices. Surrogate is no better.
Our problem is we can get the userid from the CICS TCT but not the password (which is as it should be ).  We don't want to prompt the user each time for their password.
So is there a way to submitted a job from CICS and have it inherit the credentials of the signed-on user?
Cancel

-ADS BY GOOGLE

SearchWindowsServer

SearchServerVirtualization

SearchCloudComputing

Close