cics notes

54
Customer Information control system Sridhar Babu Purama

Upload: sravan-reddy-uppula

Post on 11-Jan-2016

52 views

Category:

Documents


5 download

DESCRIPTION

Cics Notes

TRANSCRIPT

Page 1: Cics Notes

Customer Information control system

Sridhar Babu Purama

Page 2: Cics Notes

Topics to be covered

- Introduction to CICS

- Task & Transaction

- Batch Vs Online Processing

- Steps involved in developing a CICS program

- Ways to initiate a transaction

- CICS Control tables

- BMS Macros

- CICS Setup process

Page 3: Cics Notes

Introduction to CICS

CICS (Customer Information Control System)

CICS is used for developing Online applications on Mainframes.

CICS itself acts as an Operating System under z/OS.

z/OS

CICS

P1 P2 P3 P4 P5

Page 4: Cics Notes

Introduction to CICS

CICS supports both multitasking and multithreading.

Multitasking : Executing different programs simultaneously is Multitasking.

Multithreading : Executing different programs simultaneously and copies of the same program simultaneously is Multithreading.

z/OS

CICS

P1 P2 P3 P1 P1

Page 5: Cics Notes

Task & Transaction

Transaction is a set of tasks.Task is an instance of a transaction.

Eg : Tasks in ATM Transaction

1. Once the card is inserted, User is asked to enter the PIN.2. PIN is validated.

If Valid 3. User is send OPTIONS screenOtherwise4. User is prompted to enter CORRECT PIN

Page 6: Cics Notes

Batch Vs Online Processing

BATCH1. No User Interaction.2. No CICS is used.3. Batch processing is fast as there is no

user interaction.4. Batch programs are compiled using

JCL.5. Batch programs are executed using

JCL.6. Eg : Payroll, Business Analysis &

Reporting application.

ONLINE1. User Interaction will be there.2. CICS is used.3. Online processing is slow as there is user

interaction.4. Online programs are compiled using JCL.

5. Online programs are executed using Transaction ID (max. 4 Characters long).

6. Eg : ATM, Railway & Airline reservations.

Page 7: Cics Notes

Steps involved in developing a Online program

1. Design the map layout (screen layout).2. Code the BMS macros for developing the map.3. Compile the BMS macros to generate the physical and symbolic maps.4. Setup the maps in CICS region using CEDA command.5. Test the map layout using CECI command.6. Design the program logic for the map layout.7. Code the program for the corresponding map.8. Compile the program to generate the load module.9. Setup the program, transaction id, files, DB2 plans in CICS region using CEDA.10. Test the program by initiating the transaction id.11. Each time the BMS macros or the program is modified & compiled, the latest load

modules must be uploaded into CICS region using CEMT command.12. To debug the CICS commands in the program, use CEDF command.

Page 8: Cics Notes

Ways to initiate a transaction

We can trigger a transaction / execute a CICS program in the below 5 ways :

• By specifying the transaction id at the left topmost corner of the screen.• By using Pseudo-conversational programming i.e., using RETURN command.• By using XCTL and LINK commands.• By using ATI (Automatic Transaction Initiation).• By using START command.

Page 9: Cics Notes

CICS Control Tables

PCT (Program Control Table) : It holds the Transaction IDs and the corresponding Program IDs.

PPT (Processing Program Table) : It holds the Program IDs and the corresponding Load libraries.

FCT (File Control Table) : It holds the logical & physical file names.

RCT (Resource Control Table) : It holds the Program ID and the corresponding DB2 Plan.

Page 10: Cics Notes

CICS Control Tables

TR01 PROG1TR02 PROG2TR03 PROG3

PCT

PROG1 FSSADM.CICS.LOADLIBPROG2 FSSADM.CICS.LOADLIB

TR01

PPT

ACCTFL FSS142.ACCTS.FILEPOLFL FSS146.POL.FILE

FCT

PROG1 PLN1PROG2 PLN1PROG3 PLN1

RCT

LIC

USER ID : PASSWORD :

ENTER:LOGIN

Page 11: Cics Notes

Designing maps using BMS Macros

BMS is Basic Mapping Support

BMS is a set of assembly language macros used to develop a map.

MAP is a single CICS screen layout.MAPSET is a set of related maps.

There are 3 important macros :1. DFHMSD (Defined Field Hierarchy MapSet Definition)

It is used to define the mapset.

2. DFHMDI (Defined Field Hierarchy Map Definition Interpreter)It is used to define the define the map in the mapset.

3. DFHMDF (Defined Field Hierarchy Map Definition Field)It is used to define the fields in the maps.

Page 12: Cics Notes

ICIMST1 DFHMSD TYPE=&SYSPARM/MAP/DSECT, MODE=INOUT/IN/OUT, XSTORAGE=AUTO, LANG=COBOL / PL/1/ ASM, X

TIOAPFX=YES, CTRL=(FRSET,FREEKB)

ICIMP1 DFHMDI SIZE=(24,80), LINE=1, COLUMN=1

DFHMDF INITIAL=‘ICICI', POS=(1,38), LENGTH=05, ATTRB=ASKIP DFHMDF INITIAL=‘- - - - - ', POS=(2,38), LENGTH=05, ATTRB=ASKIP

DFHMDF INITIAL='USER ID :', POS=(10,31), LENGTH=10, ATTRB=ASKIP UID DFHMDF POS=(10,42), LENGTH=10, ATTRB=(UNPROT, FSET, IC) DFHMDF POS=(10,53), LENGTH=01, ATTRB=ASKIP

DFHMDF INITIAL='PASSWORD : ', POS=(11,31), LENGTH=10, ATTRB=ASKIP PWD DFHMDF POS=(11,42),LENGTH=10, ATTRB=(UNPROT, FSET, DRK) DFHMDF POS=(11,53),LENGTH=01, ATTRB=PROT

DFHMDF INITIAL='ENTER:LOGIN F5:REFRESH', POS=(20,21), X LENGTH=50, ATTRB=ASKIP

ERRMSG DFHMDF POS=(22,11), LENGTH=50, ATTRB=(ASKIP, BRT)ICIMST1 DFHMSD TYPE=FINAL END

BMS Macros for LOGIN map

Page 13: Cics Notes

TYPE : It specifies the type of map to be generated.

TYPE=MAP Only Physical map is generated.TYPE=DSECT Only Symbolic map is generated.TYPE=&SYSPARM Both Physical & Symbolic maps are generated.

BMS Macros

Page 14: Cics Notes

Compilation of BMS macros

Once BMS macros are written, compile it using CICSMAP JCL.

It will generate Physical and Symbolic maps.

Physical Map is the load module to be executed.

Symbolic Map is the copybook with the map variables.

Page 15: Cics Notes

MODE : It specifies the type of usage of map.

MODE=INOUT Map can be used for both input & output purpose.MODE=IN Map can be used for ONLY input purpose.MODE=OUT Map can be used for ONLY output purpose.

STORAGE=AUTO It will allocate separate memories for each map in the mapset. This will avoid any overlapping of maps.

LANG It specifies the programming language with which the map can be used.

TIOAPFX (Terminal Input Output Area Prefix) : When TIOPFX=YES is specified, then a 12-byte filler is generated for holding the control information(function key information).

FREEKB It unlocks the keyboard before sending the map.

SIZE It specifies the size of the map to be displayed.

LINE & COLUMN Specify the position of the map on the CICS screen.

BMS Macros

Page 16: Cics Notes

INITIAL It is similar to VALUE clause in assigning the data statically to a field.

LENGTH It specifies the length of the field.

POS It specifies the position of the field in the map.

ATTRB It specifies the characteristics of a field.ASKIP(Autoskip) It skips the control over the field.UNPROT It stops the control at the field and allows the user to enter the data.PROT It stops the control at the field but does not allow the user to enter the

data.BRT It displays the field with Bright intensity.DRK It darkens the field making it invisible.

BMS Macros

Page 17: Cics Notes

01 ICIMP1I. 02 FILLER PIC X(12). 02 UIDL PIC S9(4) COMP. 02 UIDF PIC X. 02 FILLER REDEFINES UIDF. 03 UIDA PIC X. 02 UIDI PIC X(10). 02 PWDL PIC S9(4) COMP. 02 PWDF PIC X. 02 FILLER REDEFINES PWDF. 03 PWDA PIC X. 02 PWDI PIC X(10). 02 ERRMSGL PIC S9(4) COMP. 02 ERRMSGF PIC X. 02 FILLER REDEFINES ERRMSGF. 03 ERRMSGA PIC X. 02 ERRMSGI PIC X(50). 01 ICIMP1O REDEFINES ICIMP1I. 02 FILLER PIC X(12). 02 FILLER PIC X(3). 02 UIDO PIC X(10). 02 FILLER PIC X(3). 02 PWDO PIC X(10). 02 FILLER PIC X(3). 02 ERRMSGO PIC X(50).

Symbolic Map

Page 18: Cics Notes

For every field declared in the BMS, 5 variables are generated.

FIELD + L It is the length field which stores the count of characters entered by user in the field.FIELD + F It is the flag field which is used to know whether user has entered data or not in the field.FIELD + A It is the Attribute field which is used to dynamically change the attributes of a field.FIELD + I It is the Input field which is used to receive the data from Map to program.FIELD + O It is the Output field which is used to pass the data from program to map.

Symbolic map variables

Page 19: Cics Notes

Topics to be covered

- SEND & RECEIVE commands

- DFHAID & EIBAID

- XCTL & LINK commands

- Accessing VSAM KSDS Files in CICS programs

- Cursor Positioning Techniques

- Exception Handling

- Queues – TSQs & TDQs

- CICS Transactions

- CICS program compilation process

Page 20: Cics Notes

Pseudo Conversational Programming

This programming technique is used to terminate the program till the user responds. Once user responds by pressing a function key, the program again initiates its execution.

This way, no CPU resources are wasted till the user responds.

Pseudo-conversation is handled using RETURN command.

RETURN command : It is used to terminate the CICS program and pass the control to the next immediate higher level.

EXEC CICS RETURN

END-EXEC.

Pseudo-conversation syntax :EXEC CICS RETURN TRANSID(HD01)

END-EXEC.

Page 21: Cics Notes

COMMAREA

It is the communication area between COBOL and CICS.It is used to pass data between two CICS programs. We can pass a maximum of 32K data.While using pseudo-conversation, data keyed in by the user is initially held in COMMAREA.

COMMAREA is used in the program as follows :DATA DIVISION. LINKAGE SECTION.01 DFHCOMMAREA PIC X(100).

EIBCALEN (Exec Interface Block Communication Area Length) : EIBCALEN is used to know whether user has entered data on the map or not. It stores the count of characters.

If EIBCALEN = 0, it indicates user has NOT entered data on the map.If EIBCALEN > 0, it indicates user has entered data on the map.

Page 22: Cics Notes

IDENTIFICATION DIVISION. PROGRAM-ID. LOGPGM. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-COMMAREA PIC X(8) VALUE 'LOGIN1'.COPY DFHAID. COPY HDFCMST. EXEC SQL INCLUDE SQLCA END-EXEC. EXEC SQL INCLUDE LTAB END-EXEC. LINKAGE SECTION. 01 DFHCOMMAREA PIC X(100). PROCEDURE DIVISION. MAIN-PARA. IF EIBCALEN = 0 MOVE LOW-VALUES TO HDFCMP1I, HDFCMPIO PERFORM 1500-SEND-HDFCMPI ELSE PERFORM 3000-PROCESS-PARA END-IF. EXEC CICS RETURN TRANSID('HD01') COMMAREA(WS-COMMAREA) END-EXEC. 1500-SEND-HDFCMPI. EXEC CICS SEND MAP('HDFCMPI') MAPSET('HDFCMST') END-EXEC.2000-RECEIVE-PARA. EXEC CICS RECEIVE MAP('HDFCMPI') MAPSET('HDFCMST') INTO(HDFCMP1I) END-EXEC.

3000-PROCESS-PARA. EVALUATE EIBAID WHEN DFHENTER PERFORM 2000-RECEIVE-PARA PERFORM 3500-VALIDATE-PARA WHEN DFHPF5 MOVE LOW-VALUES TO HDFCMPII PERFORM 1500-SEND-HDFCMPI WHEN OTHER MOVE 'INVALID KEYPRESSED' TO ERRMSGO PERFORM 1500-SEND-HDFCMPI END-EVALUATE. 3500-VALIDATE-PARA. MOVE UIDI TO HV-UID. EXEC SQL SELECT PASSWORD INTO :HV-PASSWORD FROM LTAB WHERE UID = :HV-UID END-EXEC. EVALUATE SQLCODE WHEN 0 IF PWDI = HV-PASSWORD MOVE LOW-VALUES TO ERRMSGO PERFORM 1500-SEND-HDFCMPI EXEC CICS XCTL PROGRAM('HDFCP02') END-EXEC ELSE MOVE 'INVLALID PASSWORD ENTERED' TO ERRMSGO PERFORM 1500-SEND-HDFCMPI END-IF WHEN 100 MOVE 'INVALID USER ID ENTERED' TO ERRMSGO PERFORM 1500-SEND-HDFCMPI END-EVALUATE.

Page 23: Cics Notes

DFHAID & EIBAIDDFHAID (Defined Field Hierarchy Attention Identifier)It is a system defined copybook which holds the function key information.

COPY DFHAID.The above statement is resolved during compilation as follows :

01 DFHAID. 03 DFHENTER PIC - - - - VALUE ‘?’. 03 DFHPF1 PIC - - - - VALUE ‘/’. 03 DFHPF2 PIC - - - - VALUE ‘;’. 03 DFHPF3 PIC - - - - VALUE ‘)’. 03 DFHPF4 PIC - - - - VALUE ‘,’.

EIBAID holds the function key information which User has pressed.Suppose, User presses ENTER key, then ‘?’ is stored in EIBAID.

EVALUATE EIBAID WHEN ENTER

PERFORM - - - - - WHEN DFHPF1 PERFORM - - - - -

Page 24: Cics Notes

SEND Command

SEND command is used to send both Physical & Symbolic maps

EXEC CICS SEND MAP(‘ICIMP1’)

MAPSET(‘ICIMST1’) END-EXEC.

EXEC CICS SEND MAP(‘ICIMP1’)

MAPSET(‘ICIMST1’)MAPONLY

END-EXEC.

MAPONLY is used to send only Physical map

EXEC CICS SEND MAP(‘ICIMP1’)

MAPSET(‘ICIMST1’)DATAONLY

END-EXEC.

DATAONLY is used to send only Symbolic map

Page 25: Cics Notes

SEND Command

ERASE will clear the CICS screen before sending the map

EXEC CICS SEND MAP(‘ICIMP1’)

MAPSET(‘ICIMST1’) ERASE/ERASEUPALARM

END-EXEC.

ERASEAUP will clear the fields before sending the map

ALARM will give a beep sound once the map is displayed.

Page 26: Cics Notes

RECEIVE Command

RECEIVE command is used to receive the data from map into INPUT variables of the map.

EXEC CICS RECEIVE MAP(‘ICIMP1’)

MAPSET(‘ICIMST1’) INTO(ICIMP1I)

END-EXEC.

RECEIVE command executes successfully when all the fields’ MDT value is turned to ‘ON’ or set to 1.If any of the fields’ MDT is still ‘OFF’ or 0, then it abends with MAPFAIL.

Page 27: Cics Notes

XCTL & LINK Commands

XCTL command is used to pass the control from one program to another program but does not expect the control to return.

LINK command is used to pass the control from one program to another program but expects the control to return.

Page 28: Cics Notes

Cursor Positioning Techniques

In 3 ways, we can set the cursor position at a particular field.

1. Static Cursor Positioning Technique2. Dynamic Cursor Positioning Technique3. Relative Cursor Positioning Technique

Page 29: Cics Notes

Static Cursor Positioning Technique

Statically, we can set the cursor position using IC.

Example :

UID DFHMDF POS=(10,42), LENGTH=10, ATTRB=(UNPROT,FSET,IC)

Note 1 : Each time map is displayed cursor is always positioned at the same field where IC is specified.

Note 2 : When IC is NOT specified, then cursor is positioned at the 1st byte in the map.

Note 3 : When IC is specified for more than one field, then cursor is positioned at the last UNPROT and IC specified field.

Page 30: Cics Notes

Dynamic Cursor Positioning Technique

Dynamically i.e., during execution we can change the cursor position by moving -1 to the variable’s length field..

Example :

EVALUATE SQLCODEWHEN 0

IF PWDI = :HV-PASSWORD EXEC CICS XCTL PROGRAM(‘OPTPGM’) END-EXEC

ELSEMOVE ‘INVALID PASSWORD ENTERED’ TO ERRMSGOMOVE -1 TO PDWLPERFORM 1500-SEND-HDFCMP1

END-IFWHEN 100

END-EVALUATE.

Page 31: Cics Notes

Relative Cursor Positioning Technique

Dynamically i.e., during execution we can change the cursor position by specifying the relative byte number while sending the map.

Example :

EVALUATE SQLCODEWHEN 0

IF PWDI = :HV-PASSWORD EXEC CICS XCTL PROGRAM(‘OPTPGM’) END-EXEC

ELSEMOVE ‘INVALID PASSWORD ENTERED’ TO ERRMSGOEXEC CICS SEND MAP(HDFCMP1)

MAPSET(HDFCMST1)CURSOR(842)

END-EXEC END-IFWHEN 100

END-EVALUATE.

Page 32: Cics Notes

Accessing VSAM KSDS Files

VSAM KSDS files are used in online programming for storing & accessing data efficiently.

Records are stored in sorted order of key field.

These files support Sequential, Random and Dynamic access to records.

Page 33: Cics Notes

Writing new record

EXEC CICS WRITE FILE(‘ACCTFL’)

RIDFLD(ACCT-NUM) FROM(ACCT-REC)

END-EXEC.

RIDFLD (Record Identification Field)It is used to specify the key field value based on which records are accessed.

Page 34: Cics Notes

Reading records sequentially

Reading the records sequentially from 1st record

MOVE LOW-VALUES TO ACCT-NUM.EXEC CICS STARTBR FILE(‘ACCTFL’)

RIDFLD(ACCT-NUM) KEYLEN(0)

END-EXEC.

PERFORM UNTIL WS-EOF = ‘Y’ EXEC CICS HANDLE CONDITION

ENDFILE(9100-ENDFILE-PARA) END-EXEC - - - - - - - - - - EXEC CICS READNEXT FILE(‘ACCTFL’) INTO(ACCT-REC) END-EXECEND-PERFORM.

EXEC CICS ENDBR FILE(‘ACCTFL’)END-EXEC.

9100-ENDFILE-PARA. MOVE ‘Y’ TO WS-EOF.

Page 35: Cics Notes

Reading records sequentially

Reading the records sequentially from LAST record

MOVE HIGH-VALUES TO ACCT-NUM.EXEC CICS STARTBR FILE(‘ACCTFL’)

RIDFLD(ACCT-NUM) KEYLEN(0)

END-EXEC.

PERFORM UNTIL WS-EOF = ‘Y’ EXEC CICS HANDLE CONDITION

ENDFILE(9100-ENDFILE-PARA) END-EXEC - - - - - - - - - - EXEC CICS READPREV FILE(‘ACCTFL’) INTO(ACCT-REC) END-EXECEND-PERFORM.

EXEC CICS ENDBR FILE(‘ACCTFL’)END-EXEC.

9100-ENDFILE-PARA. MOVE ‘Y’ TO WS-EOF.

Page 36: Cics Notes

Reading records randomly

EXEC CICS READ FILE(‘ACCTFL’)

RIDFLD(ACCT-NUM) INTO(ACCT-REC) LENGTH(90) GENERIC

END-EXEC.

LENGTH specifies the length of the record.GENERIC just allows to read the data.

STARTBR sets the cursor position at a desired record. To set the cursor position at the first record, move LOW-VALUES to key field. To set the cursor position at the last record, move HIGH-VALUES to key field.

KEYLEN specifies the length of the key field.

READNEXT retrieves the records sequentially in FORWARD direction.READPREV retrieves the records sequentially in REVERSE direction.

ENDBR terminates the sequential access to file data.

Page 37: Cics Notes

Updating a record

EXEC CICS READ FILE(‘ACCTFL’)

RIDFLD(ACCT-NUM) INTO(ACCT-REC) LENGTH(90) UPDATE

END-EXEC.

MOVE ‘AMEERPET ‘ TO ACCT-HLDR-ADDR.EXEC CICS REWRITE FILE(‘ACCTFL’)

RIDFLD(ACCT-NUM) FROM(ACCT-REC)END-EXEC.

UPDATE allows to modify the read data.

Page 38: Cics Notes

Deleting a record

EXEC CICS DELETE FILE(‘ACCTFL’)

RIDFLD(ACCT-NUM)END-EXEC.

Page 39: Cics Notes

ID DIVISION. PROGRAM-ID. HDFCP03. DATA DIVISION. WORKING-STORAGE SECTION. COPY DFHAID. COPY HDFCMP3. 01 WS-COMMAREA. 03 FILLER PIC X(50). 03 WS-COMM-PGM-ID PIC X(10). 03 WS-COMM-POL-NUM PIC X(20). 03 WS-COMM-ERRMSG PIC X(50). LINKAGE SECTION. 01 DFHCOMMAREA PIC X(130). PROCEDURE DIVISION. MAIN-PARA. IF EIBCALEN = 0 PERFORM 1500-SEND-HDFCMP3 ELSE MOVE DFHCOMMAREA TO WS-COMMAREA IF WS-COMM-PGM-ID = ‘HDFCP04' MOVE SPACES TO WS-COMM-PGM-ID MOVE WS-COMM-ERRMSG TO ERRMSGO PERFORM 1500-SEND-HDFCMP3 ELSE PERFORM 3000-PROCESS-PARA END-IF END-IF. EXEC CICS RETURN TRANSID(‘HDO3') COMMAREA(WS-COMMAREA) END-EXEC. 3000-PROCESS-PARA. EVALUATE EIBAID WHEN DFHENTER PERFORM 2000-RECEIVE-HDFCMP3 MOVE POLNUMI TO WS-COMM-POL-NUM MOVE ‘P3' TO WS-COMM-PGM-ID EXEC CICS XCTL PROGRAM(‘HDFCP04') COMMAREA(WS-COMMAREA) END-EXEC END-EVALUATE.

ID DIVISION. PROGRAM-ID. HDFCP04 DATA DIVISION. WORKING-STORAGE SECTION. 01 POL-REC. 03 POL-NUM PIC X(10). 03 POL-HLDR-NAME PIC X(20). 03 POL-AMT PIC 9(15). COPY DFHAID. COPY HDFCMP4. 01 WS-COMMAREA. 03 FILLER PIC X(50). 03 WS-COMM-PGM-ID PIC X(10). 03 WS-COMM-POL-NUM PIC X(20). 03 WS-COMM-ERRMSG PIC X(50). LINKAGE SECTION. 01 DFHCOMMAREA PIC X(130).PROCEDURE DIVISION. MAIN-PARA. MOVE DFHCOMMAREA TO WS-COMMAREA. IF WS-COMM-PGM-ID = ‘HDFCP03' MOVE SPACES TO WS-COMM-PGM-ID PERFORM 2500-RETRIEVE-POL-DET ELSE PERFORM 3000-PROCESS-PARA END-IF. EXEC CICS RETURN TRANSID(‘HDO4') COMMAREA(WS-COMMAREA) END-EXEC.2500-RETRIEVE-POL-DET. MOVE WS-COMM-POL-NUM TO POL-NUM. EXEC CICS READ FILE('FILE') RIDFLD(POL-NUM) INTO(POL-REC) END-EXEC. EVALUATE EIBRESP WHEN DFHRESP(NORMAL) MOVE POL-NUM TO POLNUMO MOVE POL-HLDR-NAME TO POLHDR1O MOVE POL-AMT TO POLAMT1O PERFORM 1500-SEND-HDFCMP4

WHEN DFHRESP(NOTFND) MOVE 'INVALID POL NUM' TO WS-COMM-ERRMSG MOVE ‘P4‘ TO WS-COMM-PGM-ID EXEC CICS XCTL PROGRAM(‘HDFCP03') COMMAREA(WS-COMMAREA) END-EXEC END-EVALUATE.3000-PROCESS-PARA. EVALUATE EIBAID WHEN DFHPF3 EXEC CICS XCTL PROGRAM(‘HDFCP03') END-EXEC WHEN DFHPF12 EXEC CICS XCTL PROGRAM(‘HDFCP01') END-EXEC WHEN OTHER MOVE 'INVALID KEY PRESSED' TO

ERRMS3O PERFORM 1500-SEND-HDFCMP4 END-EVALUATE.

Page 40: Cics Notes

Queues

Queue is a storage area similar to file in storing records.A Queue is identified using a Queue ID, which can be of maximum 8 characters long.

Queues are of two types :1. TSQ (Temporary Storage Queue)2. TDQ (Transient Data Queue)

Page 41: Cics Notes

TSQ Vs TDQ

TSQ1. Records are stored based on Item

number.2. Records can be accessed

sequentially and randomly.3. Records can be read multiple times.

4. TSQs are registered in TST (Temporary Storage Table).

TDQ1. Records are stored without Item

number.2. Records can be accessed only

sequentially.3. Records can be read only once as

the record gets deleted once it is read.

4. TDQs are registered in DCT (Destination Control Table).

Page 42: Cics Notes

TSQ Vs TDQ

Writing records into TSQMOVE 1 TO WS-ITEM-NUM.EXEC CICS WRITEQ TS QUEUE(QID001)

ITEM(WS-ITEM-NUM) FROM(WS-TSQ-REC)END-EXEC.

Reading records from TSQ MOVE 1 TO WS-ITEM-NUM. EXEC CICS READQ TS QUEUE(QID001) ITEM(WS-ITEM-NUM) INTO(WS-TSQ-REC) END-EXEC.

Deleting TSQ : EXEC CICS

DELETEQ TS QUEUE(QID001) END-EXEC.

Writing records into TDQ

EXEC CICS WRITEQ TD QUEUE(QID001) FROM(WS-TDQ-REC)END-EXEC.

Reading records from TDQ

EXEC CICS READQ TD QUEUE(QID001) INTO(WS-TDQ-REC) END-EXEC.

Deleting TDQ : EXEC CICS

DELETEQ TD QUEUE(QID001) END-EXEC.

Page 43: Cics Notes

TDQs

TDQs are of two types :1. Intra Partitioned TDQ.2. Extra Partitioned TDQ.

Intra : These TDQs can be used in only one and in the same CICS region.

Extra : These TDQs can be used in more than one CICS regions and outside CICS

also.

DCT Entry for a TDQ :DFHDCT TYPE=INTRA / EXTRA

QUEUE=QID001TRGLEV=30TRANSID=TR03

ATI (Automatic Transaction Initiation) : When the Trigger level specified is reached, then the Transaction ID specified is automatically initiated.

Page 44: Cics Notes

Page Up – Page Down Logic

TSQs are used in Page Up - Page Down (F7 – F8) logic.

1. Read the file sequentially and load the desired records into the TSQ.2. Send the first 10 TSQ records on to the screen.3. Evaluate EIBAID

WHEN F7 KEYIf already first 10 TSQ records are displayed. then throw a message ‘ ALREADY AT THE TOP’Otherwise Suppose (31-40) TSQ records are displayed, then subtract 19 from 40 (40-19=21) and display from 21 to 30End-if

WHEN F8 KEYIf already last 10 TSQ records are displayed. then throw a message ‘ ALREADY AT THE BOTTOM’Otherwise Suppose (11-20) TSQ records are displayed, then ADD +1 to 20 (20+1=21) and display from 21 to 30End-if

Page 45: Cics Notes

Handling exceptions in CICSWhen CICS cannot successfully process a statement, it throws an exception.

We can handle exceptions in two ways :1. Using HANDLE CONDITION.2. Using RESP

Page 46: Cics Notes

HANDLE CONDITION : It is used to handle exceptions in CICS.HANDLE CONDITION must be specified before the CICS command.

Eg : EXEC CICS HANDLE CONDITION NOTFND(9100-NOTFND-PARA) NOTAUTH(9200-NOTAUTH-PARA)END-EXEC.EXEC CICS READ FILE(‘POL-FILE’)

RIDFLD(POL-NUM)INTO(POL-REC)

END-EXEC.

9100-NOTFND-PARA.MOVE ‘INVALID POLICY NUMBER’ TO ERRMSGOPERFORM 1500-SEND-ICIMP1

9200-NOTAUTH-PARA.MOVE ‘YOU DO NOT HAVE AUTHORIZATION’ TO ERRMSGOPERFORM 1500-SEND-ICIMP1

Page 47: Cics Notes

RESP : It is used to handle exceptions in CICS.RESP must be specified after the CICS command.

Eg : EXEC CICS READ FILE(‘POL-FILE’)

RIDFLD(POL-NUM)INTO(POL-REC)LENGTH(90)

END-EXEC.

EVALUATE EIBRESP WHEN DFHRESP(NORMAL)

EXEC CICS XCTL PROGRAM(‘PROG4’)END-EXEC

WHEN DFHRESP(NOTFND)MOVE ‘INVALID POLICY NUMBER’ TO ERRMSGOPERFORM 1500-SEND-ICIMP1

WHEN DFHRESP(NOTAUTH)MOVE ‘YOU DO NOT HAVE AUTHORIZATION’ TO ERRMSGOPERFORM 1500-SEND-ICIMP1END-EVALUATE.

Page 48: Cics Notes

RESP : It is used to handle exceptions in CICS.RESP must be specified after the CICS command.

Eg : EXEC CICS READ FILE(‘POL-FILE’)

RIDFLD(POL-NUM)INTO(POL-REC)LENGTH(90)RESP(WS-RESP)

END-EXEC.

EVALUATE WS-RESP WHEN DFHRESP(NORMAL)

EXEC CICS XCTL PROGRAM(‘PROG4’)END-EXEC

WHEN DFHRESP(NOTFND)MOVE ‘INVALID POLICY NUMBER’ TO ERRMSGOPERFORM 1500-SEND-ICIMP1

WHEN DFHRESP(NOTAUTH)MOVE ‘YOU DO NOT HAVE AUTHORIZATION’ TO ERRMSGOPERFORM 1500-SEND-ICIMP1END-EVALUATE.

Page 49: Cics Notes

RESPONSE CODES

General Response Codes that can be generated :

NORMAL - Successful execution and record foundNOTAUTH(AEY7) - User does not have authorizationNOTFND(AEIM) - Record not foundENDFILE(AEXK) - End of the file reachedPGMIDERR(AEI0) - Program/Map name is incorrect (Not found in PPT)TRNIDERR(AEI1) - Transaction ID is incorrect (Not found in PCT)MAPFAIL - When any of the fields’ MDT is still zero, the RECEIVE

command fails with MAPFAIL abendLENGERR(AEIV) - Record length of file and specified length do not matchDUPREC(AEIN) - Duplicate record as key field already existsINVREQ(AEIP) - Trying to write a record without WRITE accessQIDERR(AEYH) - Queue ID specified is incorrect

Page 50: Cics Notes

CICS System Defined Transactions

CEDA (CICS EXECUTION DYNAMIC ALLOCATION)It is used to define and install mapsets, programs, transaction ids, files and Db2 plans.

To define & install a mapset into PPT :CEDA DEF MAPSET(ICIMST1) GROUP(ICICI)CEDA INS MAPSET(ICIMST1) GROUP(ICICI)

To define & install a program into PPT :CEDA DEF PROGRAM(ICIP01) GROUP(ICICI)CEDA INS PROGRAM(ICIP01) GROUP(ICICI)

To define & install a transaction id into PCT :CEDA DEF TRANS(IC01) PROGRAM(ICIP01) GROUP(ICICI)CEDA INS TRANS(IC01) GROUP(ICICI)

To define & install a file into FCT :CEDA DEF FILE(LOGFL) GROUP(ICICI)

‘FSS141.LOGIN.FILE’CEDA INS FILE(LOGFL) GROUP(ICICI)

Page 51: Cics Notes

CICS System Defined Transactions

CEDA (CICS EXECUTION DYNAMIC ALLOCATION)

To define & install a DB2 PLAN into RCT :CEDA DEF DB2E(LOGE) GROUP(ICICI) PLAN(FSSCCSPL)

CEDA INS DB2E(LOGE) GROUP(ICICI)

CEDA DEF DB2T(LOGT) GROUP(ICICI) DB2E - LOGE

TRAN – IC03

CEDA INS DB2T(LOGT) GROUP(ICICI)

Page 52: Cics Notes

CICS System Defined Transactions

CEMT (CICS EXECUTION MASTER TERMINAL)

CEMT INQUIRE TRAN(IC01)- PROG(ICIP01)

It will give program name associated with the transaction id.

CEMT I PROG(ICIP01)- TRAN(IC01)

It will give transaction id associated with the program name.

CEMT I FILE(LOGFL)- ‘FSS141.LOGIN.FILE’ OPENED ENABLED REA UPD ADD DEL

CLOSED DISABLEDIt will give physical file name associated with the logical file name.

CEMT SET PROG(ICIP01) NEWCOPY

Each time we modify the program or BMS macros, we compile and execute the above command.NEWCOPY will override the existing load module version with the latest one.

Page 53: Cics Notes

CICS System Defined Transactions

CESN (CICS EXECUTION SIGN ON) : It is used to sign on to the CICS region.

CESF (CICS EXECUTION SIGN OFF) : It is used to sign off from the CICS region.

CEBR (CICS EXECUTION BROWSE) : It is used to browse the Queue data.

CEDF (CICS EXECUTION DIAGNOSTIC FACILITY) : It is used to debug the CICS commands in the program.

IC01 SEND MAP - - - - - - - - - - - -

RETURN TRANS(IC01) - - - - - - - - - - - -

ICICI

USER ID : PASSWORD :

ENTER: LOGIN

CEDF EDF MODE ON

Page 54: Cics Notes

CICS System Defined Transactions

CECI (CICS EXECUTION COMMAND INTERPRETER)It is used to test the map layout without using any program.

CECI SEND MAP(MAP1) MAPSET(MAPST1)