You are on page 1of 5

JCL spawning though CICS screens

JCL spawning through CICS screen

CICS screens are online screens which are basically used to retrieve, update or insert data from
or to our databases. Online is faster than batch and are mostly used in recent times for the
transactions to be reflected to database immediately. Sometimes when the number of records
is too large or you want a specific report to be generated to you at a specified time then you
may require some batch support for processing. We can do this by submitting a batch job from
an online screen. CICS provides you the facility to submit a JCL though a screen which can
then be used to trigger some reports or may be update the database accordingly. Lets discuss
how this process is achieved.

If you think of this process logically you will agree with the fact that if I need to submit a JCL
through an online program then this JCL must be written somewhere and that somewhere will
be no other than in that online program itself. That JCL will contain the values and parameters
from the online program. That data has to be stored at a place and later on used. For that we
require some sort of storage area. CICS provides some facilities which can be exploited to
achieve this. I would list a few of them here and discuss how they function.

Temporary Storage Control :- This CICS facility provides the application program with an
ability to store and retrieve the data in a temporary storage queue (TSQ). Typically TSQ is used
for passing of data among transactions.

Transient Data Queue


Another very widely used storage area which can be used for storing data is Transient Data
Control. The Transient Data Control Program (TDP) allows a CICS transaction to deal with
sequential data called transient data files. The transient data is sometimes called Transient
data queue. There are two types of TDQ Intrapartition and Extrapartition. Although the same
CICS commands are used for both but application of these two types are different.

The Intrapartition TDQ is a group of sequential records which are produced and processed by
the same or different transactions within a CICS region (ie amongst same CICS region).

The Extrapartition TDQ is a group of sequential records which interfaces between the
transactions of the CICS region and the systems (or batch jobs) outside of the CICS Region.
That is why the word Extrapartition. Each Extrapartition TDQ is a separate physical file, and it
may be on a disk, tape, printer , plotter. This implies that each file must be open within CICS
region when it is used by the CICS transaction.

The Extrapartition TDQ is typically used for the following two applications:

• Interface to batch (or TSO ,or PC) jobs. CICS Appl.Prog. -> TDQ -> File -> Batch Prog
• Interface from batch (TSO, pc) jobs. Batch Prog. -> File -> TDQ -> CICS AppL.Prog

So this is the utility which we can use for our submission of batch jobs from an online
transaction. Generally for writing out the records we use WRITEQ TD command to write the
records into TDQ.

Ex.
EXEC CICS WRITEQ TD
QUEUE (‘TRANSID’) <------- DESTINATION ID
FROM (AREA) <------ Would be preferably WS-AREA.
LENGTH(LEN)
END-EXEC.
JCL spawning though CICS screens

Another term which can be used here is DCT. The Transaction Id which is mentioned in the
queue has to be defined in the DCT.

Destination Control Table (DCT)


The primary function of DCT is to register control information of all TDQs. The CICS destination
control program uses this table for identifying all TDQs and performing input /output
operations against them. Format of a TDQ

DFHDCT TYPE=INTRA/EXTRA,
DESTID =NAME,
[TRANSID=NAME],
[TRIGLEV=NUMBER],
[REUSE= NO]

TYPE indicates the type of partition Intra or Extra. DESTID defines the destination id (1 TO 4
chars). REUSE defines space availability after a TDQ record has been read. For Automatic Task
Initiation, TRANSID and TRIGLEV must be specified. TRANSID is the Transaction Id and TRIGLEV
is the number of records in the TDQ which triggers the transaction to be initiated.

Automatic Task Intitiation (ATI)


The ATI facility is one through which a CICS transaction can be initiated automatically. The
number of records in the TDQ triggers the transaction initiation. The Transaction Id must be
specified in the DCT entry of the TDQ with nonzero trigger level.

After getting familiar with the above facilities which CICS provides we are all set to describe
how the process is achieved.

As I mentioned in my note earlier that we would require a storage area for holding the JCL
which would be written in the online program. For that we define the whole JCL in a working
storage variable So once the user has entered the fields in the screen then we need to pass all
the values to the JCl variables in the online program which will have the steps of the JCL in it.

Lets take an example. Suppose I have a screen, once all the entries are done we press the
submit key. The task gets initiated. All the processing starts taking place. The online program
should write a message in the screen that the job is spawned.
You can see the message in my screen. But internally once you hit the submit key it has put in
all these records into a JCL variable which is shown below.
JCL spawning though CICS screens

This is how you would have that variable in the working storage section.

Eg:
1 JCL-DATA.
2 02 JCL01.
03 FILLER PIC X(02) VALUE '//'.
03 JCL01-JOBID PIC X(07) VALUE SPACES.
03 JCL01-JOB-CHAR PIC X(01) VALUE 'A'.
03 FILLER PIC X(06) VALUE ' JOB '.
03 JCL01-CHRG PIC X(05) VALUE '24207'.
03 JCL01-UNIT PIC X(03) VALUE 'MBS'.
03 FILLER PIC X(01) VALUE ','.
03 FILLER PIC X(01) VALUE QUOTE.
03 JCL01-BIN PIC X(03) VALUE '74-'.
03 JCL01-NAME8 PIC X(08) VALUE 'BUS SYST'.
03 JCL01-PHONE PIC X(04) VALUE SPACES.
03 FILLER PIC X(01) VALUE QUOTE.
03 FILLER PIC X(13) VALUE
',COND=(4,LT),'.
03 FILLER PIC X(25) VALUE SPACES.
3 JCL02.
03 FILLER PIC X(50) VALUE
'// CLASS=A,MSGCLASS=H,REGION=4096K,NOTIFY='.
JCL spawning though CICS screens

03 JCL02-NOTIFY PIC X(07) VALUE SPACES.


03 FILLER PIC X(23) VALUE SPACES.
02 JCL03.
03 FILLER PIC X(12) VALUE
'/*ROUTE XEQ '.
03 JCL03-CV PIC X(04) VALUE 'D2T1'.
03 FILLER PIC X(64) VALUE SPACES.
2 JCL04.

This way we can write the lines of the JCl and keep on populating this JCL from the program.
We populate the JCl values in the program like this :

MOVE JOBID OF SPAWN-COMM TO JCL16-JOBID.


MOVE 'J' TO JCL01-JOB-CHAR.
MOVE CHRG OF SPAWN-COMM TO JCL01-CHRG
JCL19-CHRG.
MOVE UNIT-CD OF SPAWN-COMM TO JCL01-UNIT
JCL20-UNIT.
MOVE BIN OF SPAWN-COMM TO JCL01-BIN
JCL21-BIN.

Once our JCL is constructed, this whole JCL is passed on to the Extrapartition TDQ which we
have mentioned earlier. The records get written into the TDQ. We can use the WRITEQ TD
write command to achieve this.

EXEC CICS WRITEQ TD QUEUE ('MATB') < --- Trans Id


FROM (JCL00)
LENGTH (80)
END-EXEC.

Once the JCL gets written into the TDQ. On the number of records being passed on the TDQ it
triggers the transaction to be initiated and the JCL gets submitted. This is where the ATI
facility comes into picture. It picks up the TRIGLEV and based on the number of records
initiates the transaction. Internally they have some assembler macros which gets activated and
they do the submission. The JCL which gets submitted looks something like this. Eg:

//NGPT1BSJ JOB 24208MBS,'000CHATTERJ ',COND=(4,LT),


// CLASS=A,MSGCLASS=H,REGION=4096K,NOTIFY=NGPT1BS
//* ACF01137 AMBSPMT LAST SYSTEM ACCESS 14.51-08/07/04 FROM X285 AE057
//*J0BFR0M $ACFJ201 ACF2 CONTROL CARD SUCCESSFULLY SCANNED
/*ROUTE XEQ D2P1
//*+JBS BIND D2P1
/*ROUTE PRINT AE057
//*L0G0NID $ACFJ201 ACF2 CONTROL CARD SUCCESSFULLY SCANNED
//ESYLIB JCLLIB ORDER=(AMBSLD.PROD.PROCLIB)
//STEP01 EXEC PROC=FAIDJCL,
// SPNHLQ='A0CFSGD',
// LOGID='NGPT1BS',
// RPTID='PMCU05',
// JCLDAY='D040808',
// JCLTIME='T041033',
// SKELJCL='PMCU05@0'
JCL spawning though CICS screens

XX*===================================================================
XX* FILEAID PROC - REPLACES VARIABLES IN SKELETON JCL
XX* - CREATES EXECUTABLE JCL FILE
XX* - CREATES CONTROL CARD INPUT FILE

Once this job runs successfully you can get the desired result in the output. Through these
JCLS you can update database, print lots of reports or in turn can submit another JCLs. This is
how an online screen can initiate batch operations.

You might also like