Using JCL to initiate CICS commands

If you have defined a console entry in your CSD as CONSNAME(INTERNAL), you can submit commands to your CICS® region by using JCL.

About this task

Edit your JCL as follows. The normal rules of JCL apply.

Procedure

  1. Edit your JCL to use the MVS™ command MODIFY.
  2. Follow the MODIFY command with the job name or task ID of the CICS region you are addressing, followed by the CICS commands.
  3. Submit the JCL.
    The following sample job shows how you might submit commands in this way.
    //IEFBR14 JOB (accounting information),CLASS=A,MSGCLASS=A,MSGLEVEL=1,…,…
    //*
    //*  Sample JOB to submit CICS commands using CONSNAME(INTERNAL)
    //*
    //IEFBR     EXEC PGM=IEFBR14
    // F CICSRUN,'CEMT INQ TER'
    // F CICSRUN,'CEMT INQ TAS'
    // F CICSRUN,'CEMT SET TER(L77C) ACQ'
    //

Results

If you omit the apostrophes around the CICS command, and there are sequence numbers at the end of the line, the numbers are passed to CICS as part of the command. This causes CICS to display a warning message on the console, but the command is still obeyed.

Troubleshooting:

For the batch job to work, it must have proper authority to issue console commands. If you run this batch job and you find that the MODIFY commands simply disappear and never make it to the CICS region, it could be a JES2 JOBCLASS issue.

On a JES2 system, job classes can be defined to allow or restrict commands from being issued. For this process to work, the batch job must run in a JES2 JOBCLASS that is defined with COMMAND=EXECUTE and AUTH=SYS, or higher. You can verify the current settings for a job class by issuing the following command on the console:
$DJOBCLASS(x),LONG
where x is the job class that your batch job is using.
You can see an example of the output below. (There would be additional, similar lines in the full output.)
$DJOBCLASS(A),LONG 
$HASP837 JOBCLASS(A) ACTIVE=YES,ACCT=NO,AUTH=(ALL), 
$HASP837      BLP=NO,COMMAND=EXECUTE,COPY=NO, 
$HASP837      DSENQSHR=ALLOW,DUPL_JOB=DELAY, 
In the above output, job class A is allowed to issue any command, and those commands will be executed.