CICS Transaction :
EIB Field PIC Clause Description
EIBAID X(1) Aid key Pressed
EIBCALEN S9(4) COMP It contains length of DFHCOMMAREA
EIBDATE S9(7) COMP-3 It contains Current System Date
EIBRCODE X(6) It contains Return code of the last transaction
EIBTASKN S9(7) COMP-3 It contains Task number
EIBTIME S9(7) COMP-3 It contains Current System Time
EIBTRMID X(4) Terminal Identifier
EIBTRNID X(4) Transaction Identifier
[Link] Code & Description
ASRA
1
Program Check Exception
AEI0
2
Program ID Error
AEI9
3
Map Fail condition
AEIO
4
Duplicate Key
5 AEIN
Duplicate Record
AEID
6
End of file reached
AEIS
7
File is not open
AEIP
8
Invalid request condition
AEY7
9
Not authorized to use the resource
APCT
10
Program not found
AFCA
11
Dataset not found
AKCT
12
Time out error
ABM0
13
Specified map not found
AICA
14
Program in infinite loop
AAOW
15
Internal logic error
TCP
TCP is known as Terminal Control Program.
TCP is used to receive messages from the terminal.
It maintains hardware communication requirements.
It requests CICS to initiate the tasks.
KCP
KCP is known as Task Control Program.
KCP is used to simultaneously control the execution of tasks and its related properties.
It handles all the issues related to multi-tasking.
PCP
PCP is known as Program Control Program.
PCP is used to locate and load programs for execution.
It transfers the control between programs and in the end, it returns the control back to the
CICS.
FCP
FCP is known as File Control Program.
FCP is used to provide application programs with services like read, insert, update or delete
records in a file.
It keeps exclusive control over the records in order to maintain data integrity during record
updates.
SCP
SCP is known as Storage Control Program. It is used to control allocation and deallocation of storage
within a CICS region.
Advertisement
Control Tables
CICS consists of IBM-supplied CICS control programs and tables. These tables need to be updated
accordingly with the application information for successful execution of CICS application programs.
Following are the important Control Tables −
TCT
TCT is known as Terminal Control Table.
When we login to a CICS terminal, an entry is made in the TCT table.
TCT contains the terminal ID's that are connected to current CICS region.
Terminal Control Program along with terminal control table recognize the incoming data
from the terminal.
PCT
PCT is known as Program Control Table.
It contains the Transaction IDs (TRANSID) and the corresponding program names or program
IDs.
TRANSID is unique in PCT table.
PPT
PPT is known as Processing Program Table. PPT contains Program name or Mapset name, Task Use
Counter, Language, Size, Main storage address, Load library address, etc.
Program or Mapset name is unique in a PPT table.
CICS receives the transaction and a corresponding program name is allocated to the
transaction from the PCT. It checks if the program is loaded or not. If it is loaded, then the
task use counter is increased by 1. If the program is not loaded, then the program is first
loaded and the task use counter is set to 1. It gets the load library address from the PPT
table.
FCT
FCT is known as File Control Table.
It contains File names, File type, record length, etc.
All the files used in a CICS program must be declared in FCT and they are opened and closed
by CICS itself.
Transaction
When a transaction identifier TP02 is entered on the CICS terminal, first it checks if there is a
program associated with this Transaction identifier in the PCT table. If it finds one, then it checks in
the PPT table to find the location of the Program to execute it.
If the program is already available in the memory, it starts executing that particular program; if not, it
loads the program to the memory from the secondary storage and then starts executing it.
Transaction Life Cycle
The transaction life cycle has the following steps −
Step 1
The terminal operator initiates the transaction by typing a 1 to 4 character transaction-id and
pressing the ENTER key.
Step 2
The TCP periodically checks all the terminals for input. When a message is received, it does the
following −
Instructs the SCP to create a TIOA.
Places the message in the TIOA.
Passes the control to the KCP.
Step 3
The KCP takes control from the TCP and does the following −
Validates the transaction-id and security.
Instructs the SCP to create a task control area.
Assigns priority to the task based on Terminal priority (Set in TCT), Operator priority (Set in
SNT), and Transaction priority (Set in PCT).
Adds the task to the queue of waiting programs.
Dispatches waiting programs in the order of priority.
Passes the control to the PCP.
Step 4
The PCP takes control from the KCP and does the following −
Locates the program and loads it, if necessary.
Transfers the control to the Application program.
Step 5
The Application program takes control from the PCP and does the following −
Requests the TCP to place the message into the programs WORKING STORAGE area.
Requests the FCP to retrieve records from the files.
Step 6
The FCP takes control from the Application program and does the following −
Requests a File work area from the SCP.
Informs the KCP that this task can wait until the I/O is complete.
Step 7
The KCP does the following −
Dispatches the next task in the queue.
Re-dispatches the old task when I/O is complete.
Transfers the control to the FCP.
Step 8
The FCP returns control to the Application program.
Step 9
The Application program does the following −
Processes the file data.
Requests TCP to send an I/O message.
Returns control to the PCP.
Step 10
The PCP returns the control back to the KCP requesting it to end the task.
Step 11
The KCP instructs the SCP to free all the storage allocated to the task (except TIOA).
Step 12
The TCP does the following −
Sends the output to the terminal.
Requests the SCP to release the TIOA.
The system sends a message to the screen and waits for the users response.
The time taken by user to respond is known as Think Time. This time is considerably high,
which is a major drawback of conversion programs.
The user provides the necessary input and presses an AID key.
The application processes the users input and sends the output.
The program is loaded into the main storage at the beginning and is retained till the task
ends.
Following are the two types of return statements which are used in
CICS −
Return-1
When the following unconditional return statement is issued, the
task and the transaction (program) is terminated.
EXEC CICS RETURN
END-EXEC.
Return-2
When the following conditional return, i.e., return with TRANSID
statement is issued, the control returns to the CICS with the next
transid to be executed. The next transaction starts when the user
presses an AID key.
EXEC CICS RETURN
TRANSID ('trans-id')
[COMMAREA(WS-COMMAREA)]
END-EXEC.
Advantages of Pseudo Conversion
Following are the advantages of pseudo conversion −
The resources are best utilized. Resources are released as soon as the program is suspended
temporarily.
It looks as if it is in conversational mode.
It has better response time.
Throughout my career, I have gained extensive experience in COBOL programming,
particularly in batch and online systems.
During my tenure at Cognizant, I worked on several projects where I developed and
enhanced COBOL programs for both batch processing and online transaction systems
using CICS.
For instance, in the Telstra-CDBoR project, I was responsible for coding and testing various
modules that handled customer data processing, which required a deep understanding
of COBOL and its integration with other technologies.
My role involved writing efficient code to ensure optimal performance and reliability, which
is crucial in a production environment.
Additionally, I have experience in debugging and troubleshooting COBOL applications, which
has honed my analytical skills and attention to detail.
------------------------------------------------------------------------------------------------------------------------------------
SORT JOIN – TO JOIN TWO FILES BASED ON A KEY
We can make use of SORT to join two files and writes records from both files
1. Both Files Matching Records (Inner Join)
Write only records that match on key from both files.
//STEP01 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTJNF1 DD DSN=[Link],DISP=SHR
//SORTJNF2 DD DSN=[Link],DISP=SHR
//SORTOUT DD DSN=[Link],
// DISP=(NEW,CATLG,DELETE),
// SPACE=(CYL,(100,200),RLSE),
// DCB=(RECFM=FB,BLKSIZE=0,LRECL=80)
//SYSIN DD *
SORT FIELDS=COPY
JOINKEYS FILES=F1,FIELDS=(1,10,A)
JOINKEYS FILES=F2,FIELDS=(1,10,A)
REFORMAT FIELDS=(F1:1,71,F2:1,9)
/*
Here both the files have keys at 1-10. And only the matching records are written into output file.
REFORMAT fields tells the sort on what fields to be written into output file from the input files.
2. Both Files Matching Records + Non Matching from File1 (Left outer join)
//SYSIN DD *
SORT FIELDS=COPY
JOINKEYS FILES=F1,FIELDS=(1,10,A)
JOINKEYS FILES=F2,FIELDS=(1,10,A)
JOIN UNPAIRED,F1
REFORMAT FIELDS=(F1:1,71,F2:1,9)
/*
3. Non Matching from File1
//SYSIN DD * SORT FIELDS=COPY
JOINKEYS FILES=F1,FIELDS=(1,10,A)
JOINKEYS FILES=F2,FIELDS=(1,10,A)
JOIN UNPAIRED,F1,ONLY
REFORMAT FIELDS=(F1:1,71)
/*
4. Both Files Matching Records + Non Matching from File2(Right outer join)
//SYSIN DD *
SORT FIELDS=COPY
JOINKEYS FILES=F1,FIELDS=(1,10,A)
JOINKEYS FILES=F2,FIELDS=(1,10,A)
JOIN UNPAIRED,F2
REFORMAT FIELDS=(F1:1,71,F2:1,9)
/*
5. Non Matching from File2
//SYSIN DD *
SORT FIELDS=COPY
JOINKEYS FILES=F1,FIELDS=(1,10,A)
JOINKEYS FILES=F2,FIELDS=(1,10,A)
JOIN UNPAIRED,F2,ONLY
REFORMAT FIELDS=(F2:1,9)
/*
6. Both Files Matching Records + Non Matching from both files
//SYSIN DD *
SORT FIELDS=COPY
JOINKEYS FILES=F1,FIELDS=(1,10,A)
JOINKEYS FILES=F2,FIELDS=(1,10,A)
JOIN UNPAIRED,F1,F2
REFORMAT FIELDS=(F1:1,71,F2:1,9)
/*