cics overview
Post on 23-Oct-2015
48 Views
Preview:
DESCRIPTION
TRANSCRIPT
04/17/23 Prepared by: Ratnaker M
CICS Overview
04/17/23 Prepared by: Ratnaker M
ONLINE vs. BATCH Input:• Data from Terminal. No preparation required.• Data from Card, Tape, Disk. Need preparation of data.Start of a Job:• User initiates the job/task by entering Transaction-Id in
the CICS region and pressing and AID.• Operator initiates the job by submitting a JOB/JCL.Update of Files:• More than one job/task can update a file concurrently
& instantly.• Reserved for one job. Others job has to wait for the job
updating the file to complete.
04/17/23 Prepared by: Ratnaker M
ONLINE vs. BATCH contd…
Processing Mode:• Multi-task; Multi-thread; Priority processing.• Single task; Single-thread; Priority in Job Scheduling.Resource Usage:• More.• Less.File I/O:• I/O can be concurrent.• I/O must be in a sequence.Turn Around Time:• Almost instantaneous.• Usually much longer.
04/17/23 Prepared by: Ratnaker M
An Example
Computerized Banking SystemOnline Activities:• Opening of Account(s)• Modification of Account(s)• Credits/Debits to/from Account(s)Batch Activities:• Maintenance charges• Weekly, Fortnight, Monthly, Quarterly, Yearly
Statements• Daily, Weekly, Monthly Statistics & Financial
Summary for Management Purposes
04/17/23 Prepared by: Ratnaker M
CICS in MVS • An address space with in MVS that controls all the
processing done with in that address space. (CICS is like an interface between the Appl’n Pgm & OS)
• The region/address space is activated by submitting a JOB. This job continues to execute till it is manually aborted/ended.
• The region is said to be up/active as long as the Job is executing. While the region is up, all the transactions can be executed in the region.
• The Heart of CICS is a set a Control programs and Control Tables which in conjunction with one another, achieve/perform all functionalities of CICS.
04/17/23 Prepared by: Ratnaker M
CICS in MVS contd..
• Control Tables have definitions of all the resources that the region uses.
MVS
Appl’n Pgm
CICS
Region (1)CICS
Region (2)
DB
T1
T2
04/17/23 Prepared by: Ratnaker M
CICS COMPONENTS CICS is made up of 5 major components:• Data-Communication Functions - Communication between CICS and Terminals/other
Systems - Device Independence & Format Independence• Data-Handling Functions - Interface with data access methods - VSAM, BDAM &
IMS - Interface with database access methods like DB2• Application Programming Services - Interface between CICS & Application programs
04/17/23 Prepared by: Ratnaker M
CICS COMPONENTS Contd..
• System Services
- Interface between CICS & Operating System (Program/Storage/Task Control)
• Monitoring Functions
- Monitors various events with in CICS and provides a series of statistics
04/17/23 Prepared by: Ratnaker M
CICS CONTROL PROGRAMS & TABLES
• Terminal Control
- TCT (Terminal Control Table) has entries of all valid terminal ids of the region. When data is received from a terminal, TCP (Terminal Control Program) uses TCT to validate the terminal.
Note: When ever a user connects to CICS using a terminal, a terminal ID is automatically generated and its entry is made into TCT.
• Storage Control
- SCP (Storage Control Program) handles the allocation of storage as required for the execution of the tasks.
04/17/23 Prepared by: Ratnaker M
CICS CONTROL PROGRAMS & TABLES Contd..
• Task Control - KCP (Task Control Program) controls the execution of all
the tasks in the region by tracking the task level data for each and every task independently.
• Program Control - PCT (Program Control Table) has entries of all the valid
transaction-ids along with their associated program name. - PPT (Processing Program Table) has entries of all the
program names along with their location (load module). - PCP (Program Control Program) uses the PCT to validate
the trans-id received from the terminal and to get the name of the program to be executed. It then uses PCP to locate the program and passes control back to KCP.
04/17/23 Prepared by: Ratnaker M
CICS CONTROL PROGRAMS & TABLES Contd..
• File Control
- FCT (File Control Table) has entries of all the valid File Names (DDNAMES), their associated physical file names and their properties/characteristics.
- FCP (File Control Program) uses the FCT to validate the File DDNAME passed from the program and to get the physical file name. It then passes control to the MVS supervisor to retrieve the data record.
• Data Base
- RCT (Resource Control Table) has entries of all the valid DB2 connections that the region can communicate with.
04/17/23 Prepared by: Ratnaker M
CICS TERMINOLOGY
• Task – Logical Unit of Work (Ex: One execution of a program)• Transaction – One to four byte identifier used to trigger the
execution of an associated program by pressing an AID key• AID (Attention Identifier key) – Keys used to initiate a
transaction in CICS (PF1 – PF24, PA1, PA2, PA3, ENTER, CLEAR/ESC)
• COMMAREA – The Communication area used to communicate (pass data) between 2 programs (while transferring the control)
• DFHCOMMAREA – A Linkage section variable in which the COMMAREA of an invoking program is received. If not coded, automatically inserted by translator with PIC X(01).
• EIB (Exec Interface Block) – CICS provided system area for every task which has details specific to that task.
04/17/23 Prepared by: Ratnaker M
EIB – Exec Interface Block
• DFHEIBLK – CICS provides a system area to every task it is executing through a linkage copybook DFHEIBLK included in the application program.
• If this copy book is not included, the translator will automatically insert this during the translation of the program
• This is the very first copybook/variable of the linkage section in all CICS programs.
• Once the execution of the task starts, the fields of the copybook will be populated with the details specific to the task that is getting executed.
04/17/23 Prepared by: Ratnaker M
Some Important EIB fields
• EIBCALEN – The actual length of DFHCOMMAREA received in the program/task.
• EIBAID – The AID Key that initiated the transaction/task.
• EIBRESP – The response code of the last executed CICS command in the task.
• EIBDATE – The date when the task got initiated.
• EIBTIME – The time when the task got initiated.
• EIBTRMID – The terminal id on which the task is executing.
• EIBTRNID – The transaction-id which initiated this task.
04/17/23 Prepared by: Ratnaker M
CICS UNIQUE FEATURES
• Multi-Tasking: - Execution of more than one tasks at the same time• Multi-Threading: - A Sub-set/Special case of Multi-tasking - Execution of more than one tasks using the same program
at the same time (a given instance)• Quasi-Reentrancy: - A program which does not modify itself in any manner - Separate working and linkage storage areas for different
tasks executing the same program - To achieve multi-threading, a program should be quasi-
reentrant
04/17/23 Prepared by: Ratnaker M
Modes of Programming
• Non-Conversational Mode:
- Execution of a program with out any user interaction. All the input is supplied to the program through a file or tape.
• Conversational Mode:
- Execution of a program with user interaction. Whenever user I/P is expected, the execution of the program is held.
- All the resources used by the program/task are locked.
- Execution of the pgm resumes on completion of use I/P.
- Resources used by the program only when execution of the task is completed.
04/17/23 Prepared by: Ratnaker M
Modes of Programming Contd..
Psuedo-Conversational Mode:
- Execution of a program with user interaction.
- A concept of terminating the task whenever user I/P is expected.
- All resources are freed during user input as task is terminated.
- After the input, pressing an AID initiates a new task for the same program (Execution of the program does not resume. It starts from the beginning).
- The working storage of the terminated task should be stored and passed to the new task.
04/17/23 Prepared by: Ratnaker M
Initiation of a CICS Transaction
TRN1 TCP &
TCT
SCP
KCP
PCP
PCT
PCP
Task Control Area
Execution of the Pgm/task
TIOA
04/17/23 Prepared by: Ratnaker M
5 Different ways of Initiating a Transaction
• By entering the transaction id in the region and pressing an AID
• By pressing an AID after the successful execution of a RETURN with TRANSID CICS Command
• By Using START Command
• ATI - Automatic Transaction Initiation (by defining a trigger level for an intra-partition TDQ)
• By Defining any PF Key in PCT
04/17/23 Prepared by: Ratnaker M
CICS Program
• A normal COBOL program with some embedded CICS commands. The following are the differences of a CICS program as compared to a normal COBOL program.
- File Control and File Section entries will not be present as the Files and its characteristics are defined in FCT.
- Copybooks DFHBMSCA & DFHAID should be copied in working storage to use BMS Macros & to use the EIBAID pre-defined values in the program.
- Copybook DFHEIBLK should be copied in the Linkage Section. If not copied translator automatically inserts this at the start of Linkage Section.
- Code DFHCOMMAREA linkage variable immediately after DFHEIBLK. If not coded translator automatically inserts this with PIC X(01).
- Contains CICS Commands. EXEC CICS marks the start & END-EXEC marks the end of the command.
04/17/23 Prepared by: Ratnaker M
Program Control Commands
• LINK
• XCTL
• CALL
• RETURN
• RETURN with TRANSID
LINK, CALL & XCTL are used to modularize big programs
04/17/23 Prepared by: Ratnaker M
LINK & CALL
• LINK is functionally same as a CALL statement of normal COBOL program
• Equivalent to a dynamic CALL in COBOL
• The linking program expects the control back
• Linked program is one logical level lower to the linking program
• Any working storage data-area of the linking pgm is passed to the linked pgm mentioning/using a key word COMMAREA. This area gets received in the DFHCOMMAREA of the linked pgm.
04/17/23 Prepared by: Ratnaker M
LINK & CALL Contd..
• On return of control to the linking program, the working storage data-area (not the DFHCOMMAREA) passed through COMMAREA gets reflected with the changes done in the linked program
• All resources & locked of Linking program are held.
• CALL is same as LINK except for the difference in Syntax.
EXEC CICS LINK
PROGRAM (WS-PGMNAME)
COMMAREA (WS-DATA-AREA)
LENGTH (LENGTH of WS-DATA-AREA)
RESP (WS-RESP)
END-EXEC.
04/17/23 Prepared by: Ratnaker M
LINK & CALL Contd..
CALL WS-PGMNAME USING
DFHEIBLK
WS-DATA-AREA.
Note: While using a CALL statement care should be taken to mention using DFHEIBLK as in all the CICS program DFHEIBLK is the very first linkage variable.
- Immediately followed by DFHEIBLK is the DFHCOMMAREA. Hence the data passed through WS-DATA-AREA is received in DFHCOMMAREA of called pgm.
- In a LINK, CICS automatically places the data-area mentioned against COMMAREA of the linking program into the DFHCOMMAREA of the linked program.
04/17/23 Prepared by: Ratnaker M
XCTL
• Using XCTL the control is passed from one program to other.
• The XCTLing program does not expect the control back.
• Once the XCTL command is executed, the execution of the XCTLing program terminates.
• All the working storage is lost
• Any data that needs to be passed to XCTL’ed program should be done by mentioning against the COMMAREA key word, the data-area of the XCTLing program containing the data to be passed.
04/17/23 Prepared by: Ratnaker M
XCTL Contd..
• The data passed gets received in the DFHCOMMAREA of the XCTL’ed program.
• When a RETURN is issued from the XCTL’ed program, the control goes back to logically one higher level (generally CICS).
EXEC CICS XCTL
PROGRAM (‘XCTLPGM’)
COMMAREA(WS-COMMAREA)
LENGTH (LENGTH of WS-COMMAREA)
RESP (WS-RESP)
END-EXEC.
04/17/23 Prepared by: Ratnaker M
RETURN Command
RETURN - Passes Control back to logically one higher level
RETURN with TRANSID
- Passes Control back to CICS and specifies the TRANSACTION that needs to be initiated (on the same terminal) when any of the AID is pressed next.
- Can be issued only from a program which is logically at the highest level.
EXEC CICS RETURN
{TRANSID(‘TRNX’)}
{COMMAREA(WS-COMMAREA)}
END-EXEC.
04/17/23 Prepared by: Ratnaker M
CICS Logical Level of Programs
CICS
PGM1Highest Level (1)
PGM2Highest Level (1)
TRN1
XCTL
Termination of PGM1
RETURN from PGM2
PGM3Logical Level (2)
LINK
RETURN from PGM3
04/17/23 Prepared by: Ratnaker M
File Handling Commands
• READ
• READ for UPDATE
• REWRITE
• WRITE
• DELETE
• STARTBR
• ENDBR
• RESETBR
• READNEXT
• READPREV
• UNLOCK
File Handling Commands & TSQ Commands Ex
04/17/23 Prepared by: Ratnaker M
READ Command
EXEC CICS READ
DATASET (DDNAME)
INTO (RECORD-LAYOUT)
RIDFLD (KEY-NAME)
KEYLENGTH (LENGTH of KEY-NAME)
LENGTH (LENGTH of RECORD-LAYOUT)
EQUAL|GTEQ|GENERIC
[RBA|RRN]
[SYSID(System-name)]
[UPDATE]
RESP (WS-RESP)
END-EXEC.
04/17/23 Prepared by: Ratnaker M
REWRITE
EXEC CICS REWRITE
DATASET (DDNAME)
FROM (RECORD-AREA)
LENGTH (LENGTH of RECORD-AREA)
[SYSID (System-name)]
RESP (WS-RESP)
END-EXEC.
• Record should be READ with UPDATE option before doing a REWRITE
04/17/23 Prepared by: Ratnaker M
WRITE Command
EXEC CICS WRITE
DATASET (DDNAME)
FROM (RECORD-AREA)
RIDFLD (KEY-NAME)
LENGTH (LENGTH of RECORD-AREA)
[SYSID (System-name)]
RESP (WS-RESP)
[RBA|RRN]
[MASSINSERT]
END-EXEC.
• If Mass Insert is used, the Dataset should be released by UNLOCK explicitly.
04/17/23 Prepared by: Ratnaker M
DELETE Command• If Deleting after a READ with UPDATE
EXEC CICS DELETEDATASET (DDNAME)RESP (WS-RESP)
END-EXEC.• If deleting directly without READ with UPDATE
EXEC CICS DELETEDATASET (DDNAME)RIDFLD (PART-KEY-NAME)KETLENGTH (LENGTH of PART-KEY-
NAME)[GENERIC]NUMREC (WS-NUM-REC-DELETED)RESP (WS-RESP)
END-EXEC.
04/17/23 Prepared by: Ratnaker M
UNLOCK Command
• To Release the lock put in by READ with UPDATE or a MASSINSERT.
EXEC CICS UNLOCK
DATASET (DDNAME)
RESP (WS-RESP)
END-EXEC.
• WAYS TO RELEASE A LOCK ON A RECORD after READ with UPDATE
- REWRITE
- DELETE
- UNLOCK
04/17/23 Prepared by: Ratnaker M
STARTBR Command
EXEC CICS STARTBR
DATASET (DDNAME)
RIDFLD (Key-Name)
GTEQ|EQUAL|GENERIC
KEYLENGTH (LENGTH of Key-Name-Part)
REQID (Browse-Number-on-Same-file)
RBA|RRN
SYSID (System-Name)
END-EXEC.
• Locates the File Pointer ahead of the record to be read. THIS DOES NOT READ THE RECORD
04/17/23 Prepared by: Ratnaker M
READNEXT Command
EXEC CICS READNEXT
DATASET (DDNAME)
INTO (Record-Layout)
LENGTH (LENGTH of Record-Layout)
RIDFLD (Key-Name)
REQID (Request-ID-No)
SYSID (System-Name)
RESP (WS-RESP)
END-EXEC
• READS THE RECORD PHISICALLY INTO MEMORY & PLACES THE POINTER AHEAD OF THE NEXT RECORD.
04/17/23 Prepared by: Ratnaker M
READPREV Command
EXEC CICS READPREV
DATASET (DDNAME)
INTO (Record-Layout)
LENGTH (LENGTH of Record-Layout)
RIDFLD (Key-Name)
REQID (Request-ID-No)
SYSID (System-Name)
RESP (WS-RESP)
END-EXEC
• Reads the record in a backward fashion phisically into memory & places the pointer ahead of the record read.
• Can be issued only after a successful STARTBR (ex: not after a STARTBR with GENERIC)
04/17/23 Prepared by: Ratnaker M
Other Browse Commands
• ENDBR
EXEC CICS ENDBR
DATASET (DDNAME)
REQID (Request-ID-No)
END-EXEC.
- Closes the Browser Opened With a STARTBR• RESETBR - To reset the browser either above or below the
current location (Equivalent to a ENDBR + STARTBR)
• SKIPSEQUENTIAL - To skip reading of some records while reading records in forward direction
04/17/23 Prepared by: Ratnaker M
Handling Error Conditions in CICS
• HANDLE CONDITION - To pass control to a specified paragraph on occurrence of the specified error
- option of a generic error handling routine• NOHANDLE - To discard all errors and pass control to next
executable statement• RESP - Same as NOHANDLE but have an advantage of
getting a return code which describes the result of execution of the command
• IGNORE CONDITION - To ignore the specified error conditions in all subsequent commands & execute the next sequential statement following the respective command
- Valid till another handle condition is issued.
04/17/23 Prepared by: Ratnaker M
HANDLE AID
• To specify the paragraph where the control should flow to, based on the aid key pressed
• Equivalent to a combination of IF & GOTO statements.• This gets activated after terminal I/O commands EXEC CICS HANDLE AID
ENTER (AID-ENTER-PARA)PF3 (AID-PF3-PARA)ANY (AID-ANY-EXCEPT-ENTER-PF3-PARA)
END-EXEC.
Alternative: Usage of EIBAID to know the aid key pressed.IF EIBAID = DFHENTER
PERFORM AID-ENTER-PARAELSE IF EIBAID = DFHPF3
…
04/17/23 Prepared by: Ratnaker M
Temporary Storage Queues (TSQ)
• Like a scratch pad
• Created dynamically
• Identified by a 8 or 16 byte long id – should be unique for each queue created
• Not transaction/program specific
• Region specific
• Alive till region goes down or exclusively deleted
• No entry in any tables required unless the record needs to recovered
• Records can be accessed sequentially, randomly, dynamically
• Queue-id not a part of the record
04/17/23 Prepared by: Ratnaker M
TSQ Commands
WRITEQ Command
EXEC CICS WRITEQ TS
QUEUE (Queue-name)
FROM (Queue-record-layout)
LENGTH (length of Queue-record-layout)
ITEM (data-area)
REWRITE
MAIN|AUXILIARY
END-EXEC
04/17/23 Prepared by: Ratnaker M
TSQ Commands Contd..
• READQ Command
EXEC CICS READQ TS
QUEUE (Queue-name)
INTO (record-layout)
LENGTH (length of record-layout)
ITEM (data-value)/NEXT
END-EXEC
• DELETEQ Command
EXEC CICS DELETEQ TS
QUEUE (Queue-name)
END-EXEC
04/17/23 Prepared by: Ratnaker M
ASKTIME & FORMATTIME
• The execution of the command (ASKTIME) updates EIBDATE & EIBTIME variables of the task with the current date and time. • EXEC CICS ASKTIME
ABSTIME (WS-TIME)
END-EXEC.
• EXEC CICS FORMATTIME
ABSTIME (WS-TIME)
MMDDYY (WS-DATE)
DATESEP (‘/’)
TIME (WS-Format-TIME)
TIMESEP (:)
END-EXEC.WS-TIME PIC S9(15) COMP-3.; WS-DATE PIC X(08).; WS-FORMAT-TIME PIC X(08).
04/17/23 Prepared by: Ratnaker M
START Command
• Triggers execution of the transaction specified• The terminal on which the transaction should be triggered can be specified (by default the same terminal)• The program issuing the START command & the program associated with the STARTed transaction run simultaneously and independently• The STARTED transaction/program needs to be handled appropriately by the programmer.• Even the absolute time when the transaction should be started or the interval after which the transaction should be started can also be specified.• Data can be passed from the program issuing START command to the program that is being STARTed.
04/17/23 Prepared by: Ratnaker M
RETRIEVE Command
• The data passed to a program whose execution is triggered by issuing a START command will not be received in the DFHCOMMAREA.
• That data should be received into the STARTed program by issuing a RETRIEVE command.
04/17/23 Prepared by: Ratnaker M
START & RETRIEVE Command
EXEC CICS START
TRANSID (‘XXXX’)
FROM (WS-PASS-AREA)
TERMID (Term-ID)
TIME (hhmmss)|INTERVAL (hhmmss)
LENGTH (Length-of-pass-area)
END-EXEC.
EXEC CICS RETRIEVE
INTO (WS-RECEIVE-AREA)
LENGTH (Length-of-receive-area)
END-EXEC.
04/17/23 Prepared by: Ratnaker M
CICS SKELETON PGM IDENTIFICATION DIVISION.
PROGRAM-ID. SKELETON.
*COMMENTS
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
INPUT-OUTPUT SECTION
*SELECT & ASSIGN CLAUSE SHOULD NOT BE MENTIONED AS THESE WILL BE
*TAKEN CARE BY FCT ENTRIES
*
DATA DIVISION.
FILE SECTION.
*FD ENTRIES SHOULD NOT BE MENTIONED AS THESE ARE TAKEN CARE BY FCT
*
WORKING-STORAGE SECTION.
*
01 TEMPORARY-VAR PIC X(20).
01 WS-DATA-AREA PIC X(50).
*
04/17/23 Prepared by: Ratnaker M
**MAP ATTRIBUTES WHILE USING BMS MACROS
COPY DFHBMSCA.
*
**EIBAID VALUES TO CHECK THE AID KEY PRESSED
COPY DFHAID.
*
LINKAGE SECTION.
*
** DFHEIBLK WILL BE INSERTED BY TRANSLATOR IF INCLUDED BY PRGMR.
COPY DFHEIBLK.
*
* DFHCOMMAREA IF NOT CODED, IT WILL B AUTOMATICALLY INSERTED AS
*01 DFHCOMMAREA PIC X(01).
01 DFHCOMMAREA PIC X(50).
*
04/17/23 Prepared by: Ratnaker M
**START OF PROCEDURE DIVISION **
PROCEDURE DIVISION.
*
0000-MAIN-LINE-PARA.
*CHECK THE LENGTH OF COMMAREA PASSED TO THIS PROGRAM
IF EIBCALEN = ZERO
PERFORM 1000-FIRST-TIME-PARA THRU 1000-EXIT
ELSE
MOVE DFHCOMMAREA TO WS-USERDATA
PERFORM RM00-RECEIVE-MAP THRU RM00-EXIT
PERFORM 2000-PROCESS-PARA THRU 2000-EXIT
END-IF.
PERFORM SM00-SEND-MAP THRU SM00-EXIT.
EXEC CICS
RETURN
TRANSID(EIBTRNID)
COMMAREA(WS-DATA-AREA)
END-EXEC.
0000-EXIT.
EXIT.
*
04/17/23 Prepared by: Ratnaker M
**
RM00-RECEIVE-MAP.
EXEC CICS RECEIVE MAP…. END-EXEC.
RM00-EXIT.
EXIT.
**
2000-PROCESS-PARA.
IF DFHAID = DFHENTER
CONTINUE
ELSE
IF DFHAID = DFHPF3
EXEC CICS
RETURN
END-EXEC
ELSE
Error Message
GO TO 2000-EXIT.
PROCESS…
2000-EXIT.
EXIT.
04/17/23 Prepared by: Ratnaker M
CREATING EXECUTABLE FOR A CICS PGM
SOURCE CODE (COBOL + EXEC CICS Commands)
Translated Source Code (CICS Commands Commented out and equivalent CALL statements inserted) =
Equivalent to normal COBOL Code
OBJECT MODULE
LOAD MODULE
TRANSLATION STEP
COMPILATION STEP
LINK-EDIT STEP
top related