Professional Documents
Culture Documents
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.
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.
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.
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
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 :
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.
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:
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.