P. 1
CICS Infosys

CICS Infosys

|Views: 364|Likes:
Published by prashanth_scribd1
CICS
CICS

More info:

Published by: prashanth_scribd1 on Jun 18, 2012
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

10/06/2014

pdf

text

original

Infosys ------------------------------------------------------------- CICS

Slides

CICS
Customer Information Control System

1

Infosys ------------------------------------------------------------- CICS

Slides

Objectives
‡ Entry Criteria: ± Participants should have a through knowledge of RDBMS concepts like transactions, concurrency control, etc., & COBOL. ‡ Exit Criteria: Participants must know ± what is CICS, the need for CICS ± the screen layout, keys, etc. ± important CICS tables ± transactions and tasks ± starting and ending a transaction ± Conversational & Pseudoconversational Programming ± changing map attributes and positioning the cursor ± error handling in CICS programs ± complete BMS concepts ± methods of transferring control from one program to another ± methods of retaining data between two tasks and transferring data from one program to another ± File handling in CICS
2

Infosys ------------------------------------------------------------- CICS

Slides

References

‡ CICS for microcomputers, Joseph J. Le Bert, McGraw-Hill Publishing Company ‡ CICS using COBOL, Andrew M. Suhy, Wadsworth Publishing Company ‡ IBM online manuals for CICS

3

Infosys ------------------------------------------------------------- CICS

Slides

Session Plan
‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ------------------ session 1 --------------Introduction Special keys CICS Screen Starting a transaction Ending a CICS session Basic structure of a program COBOL commands not to be used CICS tables Conversational Programming Pseudo Conversational Programming Compiling a CICS program Running a CICS program Batch and Online programs Hello World program A conversational program A pseudo conversational program Application, Transaction, Program, Task ------------------ session 2 --------------Basic mapping support Physical map Symbolic map
4

Infosys ------------------------------------------------------------- CICS

Slides

Session Plan (Contd.)
‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ Modified Data Tag FSET and FRSET Sending & Receiving a map ------------------ session 3 --------------Three ways to RETURN control to CICS Standard copy books Testing AID keys Changing field attributes Positioning the cursor Error handling in CICS Handling and Forcing ABEND Transferring control to another program RETURN, XCTL, LINK, START Transferring data to another program Accessing DB2 tables ------------------ session 4 --------------Temporary Storage Queues (TSQ) Transient Data Queues (TDQ) File Handling in CICS Summary

5

Infosys ------------------------------------------------------------- CICS

Slides

‡ CICS is an online transactionprocessor that supports development of on-line applications. ‡ CICS as an operating system
- DB/DC - Scheduling of tasks

Operating System Batch Program 1 Batch Program 2

CICS

prog1

prog2

Batch program 4
6

Infosys ------------------------------------------------------------- CICS

Slides

‡ Why is CICS not an operating system
- Host operating system (MVS) is still the final interface to the computer

‡ What does CICS do ?
DB - Database/file access DC - communicating with the terminals (both remote and local) Scheduling of programs under CICS Multitasking - Running multiple programs concurrently, serving multiple users Intersystem communication

7

Infosys ------------------------------------------------------------- CICS

Slides

‡ Why CICS ?

Why CICS

- MVS is purely batch ‡ (Batch and Online programs
Batch - runs only once from beginning to end of program. No user interaction. Online - needs user input in between execution

- To support applications needing up-to-the-minute data, you need to have online support) ‡ - Application development made easier as CICS handles the formatting and other components needed for online interface

8

Infosys ------------------------------------------------------------- CICS

Slides

‡ TASK, PROGRAM & TRANSACTION
Program - set of instructions (Application - collection of programs that accomplish a group of functions) ‡ Transaction - Collection of logically-related programs that achieve a specific function
(ex. Railway reservation system Application Booking a ticket - transaction 1 transaction - 1 or more programs task - single execution of a transaction) LUW - Logical unit of work - either fully done or not done at all

9

Infosys ------------------------------------------------------------- CICS

Slides

‡ AID keys
Enter Clear PF keys PA keys ‡ Other keys ALT, TAB, EOF (PF1 to PF24) (PA1 to PA3)

‡ Screen format
1 2 3 ...
1 2 .. 24

...

80

total 1920 positions

‡ Numbered from left to right
1,10=10 2,10=90 and so on.

10

Infosys ------------------------------------------------------------- CICS

Slides

‡ Initiating a CICS transaction:
By typing a 4 letter Transaction Id on screen position (1,1).

‡ Getting out of CICS:
Type CSSF at (1,1) and press Enter.

‡ CICS commands are embedded in a host language (in general, COBOL) ‡ A CICS program must contain
LINKAGE SECTION 01 DFHCOMMAREA and EXEC CICS RETURN END-EXEC. PIC X(n).

11

Infosys ------------------------------------------------------------- CICS

Slides

‡ All the CICS commands should be within
EXEC CICS .... .... END-EXEC.

‡ COBOL programs under CICS should not have
ACCEPT, CLOSE, DELETE, DISPLAY, OPEN, READ, REPORT WRITER commands, REWRITE, SORT, WRITE, START and never use STOP RUN & GO BACK. All the files (dataset) are opened when CICS comes up and are closed when it goes down. No file-control section.

‡ CICS maintains several tables for its use:
PCT, PPT, FCT, DCT, etc. First two are the most important ones.
12

Infosys ------------------------------------------------------------- CICS

Slides

‡ PCT - Program Control Table
Contains the transaction ids and the corresponding program name. TransId is unique.

‡ PPT - Processing Program Table
Contains entries such as Program Name, Language, Size, Main storage address (if it is loaded), Task Use Counter, Load library address, Whether main storage resident, etc.

‡ FCT - File Control Table
All the files (datasets) used in the program are to be declared in FCT and they are opened and closed by CICS itself.

‡ Conversational Programming
Once CICS starts execution of a program, it runs it till the completion of a program. (Wait periods -DC) All the normal programs other than in CICS environment we come across are conversational.
13

Infosys ------------------------------------------------------------- CICS

Slides

‡ Pseudo Conversational Programming
It is a coding technique (responsibility of the programmer) which results in a program being loaded into main storage when required and released when it is not in use. For the user, it¶s as though the program is fully conversational. It saves main memory usage. The programmer should code in a special way to achieve this. Highly used in CICS programming.

‡ Compiling a CICS program
PreCompiler converts all the CICS commands into equivalent CALL statements in COBOL. It generates, in the Linkage Section, fields named DFHEIBLK, the Execute Interface Block (EIB), and DFHCOMMAREA, the 14 Communication Area.

Infosys ------------------------------------------------------------- CICS

Slides

‡ Running a CICS program
± Give a TRANSID for the program ± Enter the TRANSID and program name in PCT ± Refresh the PPT program address by CEMT SET PRO(progname) NEW ± Clear the screen ± Type the TRANSID at (1,1) , press Enter. ‡ PA keys, CLEAR - no transfer of data ‡ PF keys, ENTER - data gets transfered

15

Infosys ------------------------------------------------------------- CICS

Slides

‡ Hello World program:
IDENTIFICATION DIVISION. PROGRAM-ID. FIRSTP. * Hello World program. TRNID is µHWPG¶ ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-MESSAGE PIC X(11) VALUE µHELLO WORLD¶. LINKAGE SECTION. 01 DFHCOMMAREA PIC X(01). PROCEDURE DIVISION. 000-MAIN. EXEC CICS SEND FROM (WS-MESSAGE) LENGTH (11) ERASE END-EXEC. EXEC CICS RETURN END-EXEC. 099-MAIN-EXIT. EXIT.
16

Infosys ------------------------------------------------------------- CICS

Slides

‡ A Conversational program:
IDENTIFICATION DIVISION. PROGRAM-ID. CONV. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-PROMPT PIC X(07) VALUE µNAME¶. 01 WS-INPUT PIC X(20). 01 WS-MESSAGE PIC X(10) VALUE µHELLO MR.¶. 01 WS-LENGTH PIC S9(4) COMP VALUE +20. LINKAGE SECTION. 01 DFHCOMMAREA PIC X(01). PROCEDURE DIVISION. 000-MAIN. EXEC CICS SEND FROM (WS-PROMPT) LENGTH (7) ERASE END-EXEC.
17

Infosys ------------------------------------------------------------- CICS

Slides

EXEC CICS RECEIVE INTO (WS-INPUT) LENGTH (WS-LENGTH) END-EXEC. EXEC CICS SEND FROM (WS-MESSAGE) LENGTH (10) ERASE END-EXEC. EXEC CICS SEND FROM (WS-INPUT) LENGTH (20) END-EXEC. EXEC CICS RETURN END-EXEC. 099-MAIN-EXIT. EXIT.

18

Infosys ------------------------------------------------------------- CICS

Slides

‡ A Pseudo Conversational program:
IDENTIFICATION DIVISION. PROGRAM-ID. PSCONV. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-PROMPT VALUE µNAME¶. 01 WS-INPUT 01 WS-MESSAGE VALUE µHELLO MR.¶. 01 WS-LENGTH VALUE +20. 01 WS-COMMAREA LINKAGE SECTION. 01 DFHCOMMAREA PIC X(01). PIC X(01). PIC S9(4) COMP PIC X(20). PIC X(10) PIC X(07)

19

Infosys ------------------------------------------------------------- CICS

Slides

PROCEDURE DIVISION. 000-MAIN. IF EIBCALEN = 0 PERFORM 100-INITIAL-ENTRY THRU 199-INITIAL-ENTRY-EXIT ELSE PERFORM 200-NEXT-ENTRY THRU 299-NEXT-ENTRY-EXIT END-IF. EXEC CICS RETURN TRANSID (EIBTRNID) COMMAREA (WS-COMMAREA) LENGTH (1) END-EXEC. 099-MAIN-EXIT. EXIT. *-------------------------------------------------100-INITIAL-ENTRY. EXEC CICS SEND FROM (WS-PROMPT) LENGTH (7) ERASE END-EXEC. 199-INITIAL-ENTRY-EXIT. EXIT.
20

Infosys ------------------------------------------------------------- CICS

Slides

200-NEXT-ENTRY. EXEC CICS RECEIVE INTO (WS-INPUT) LENGTH (WS-LENGTH) END-EXEC. EXEC CICS SEND FROM (WS-MESSAGE) LENGTH (10) ERASE END-EXEC. EXEC CICS SEND FROM (WS-INPUT) LENGTH (20) END-EXEC. EXEC CICS RETURN END-EXEC. 299-NEXT-ENTRY-EXIT. EXIT.
21

Infosys ------------------------------------------------------------- CICS

Slides

‡ When CICS loads a program, it creates a task to run that program. ‡ For every task, CICS assigns values to EIB fields (which is put in the linkage section at pre compile).
01 DFHEIBLK. 02 EIBTIME 02 EIBDATE PIC S9(7) COMP-3. PIC S9(7) COMP-3.

02 EIBTRNID PIC X(4). 02 EIBTASKN PIC S9(7) COMP-3. 02 EIBTRMID PIC X(4). 02 EIBCPOSN PIC S9(4) COMP. 02 EIBCALEN PIC S9(4) COMP. 02 EIBAID etc.
22

PIC X.

Infosys ------------------------------------------------------------- CICS

Slides

‡ Task:
± a task is created for each executed transid. ± a task can consists of a single program or multiple programs. ± a task continues until a program returns control to CICS or until it issues a RETURN with a TRANSID in the pseudo conversational mode. ± CICS can handle several tasks at a time (multi tasking). ± several tasks can access the same code in main memory (multithreading) and hence CICS programs should be reentrant.

‡ Though every task for the same program shares the object code, separate working storage, linkage section are created.

23

Infosys ------------------------------------------------------------- CICS

Slides

‡ When a Transid is received by CICS, it checks if the associated program is already loaded. If so, it merely increases the usage counter by 1, else it loads the program into memory and make the counter 1. ‡ When a task gets completed, its counter is decremented by 1. When it becomes zero the program is unloaded (unless it is designated as main memory resident). ‡ One program can call other program. In conversational mode all these becomes a single task. ‡ In pseudo conversational mode each time the program is made active, a new task is created.

24

Infosys ------------------------------------------------------------- CICS

Slides

Basic Mapping Support
‡ Map - description of the screen. ‡ In CICS, to transmit a formatted display,
a description of the screen is coded in a separate assembly language program called the Physical map or the mapset program and another in the COBOL source code called the Symbolic map.

‡ Both the COBOL program and the mapset program have to be compiled before using a map. ‡ The physical map describes details of all the fields. ‡ The symbolic map describes details of all the variable fields.
25

Infosys ------------------------------------------------------------- CICS

Slides

‡ The physical map contains:
± size of the screen ± size, attributes, location of all fields ± and some system data.

‡ The symbolic map contains:
± some system data ± and all variable field declaration it does not include any details of constant fields.

‡ CICS allows to send either of the maps or both using the send map command. ‡ This facility reduces the network traffic between the computer and the terminal and increases the speed of transmission.

26

Infosys ------------------------------------------------------------- CICS

Slides

‡ Consider the following case:
INFOSYS EMPLOYEE DETAILS

EMPLOYEE NAME: ABCD EMPLOYEE NO. : 1111

F3 - EXIT

F4 - NEXT EMP

F4 INFOSYS EMPLOYEE DETAILS

EMPLOYEE NAME: EFGH EMPLOYEE NO. : 2222

F3 - EXIT

F4 - NEXT EMP

27

Infosys ------------------------------------------------------------- CICS

Slides

‡ In the above map, all the fields in blue are constant fields, and all the fields in green are variable fields. ‡ Notice that when the user presses F4, the next employee details appear and at this time only the symbolic map need to be sent. ‡ In the above case the symbolic map will look like:
01 MY-FIRST-MAP. 05 FILLER 05 MP-NAME-L 05 MP-NAME-A 05 MP-NAME-D 05 MP-NO-L 05 MP-NO-A 05 MP-NO-D PIC X(12). PIC S9(4) COMP. PIC X. PIC X(4). PIC S9(4) COMP. PIC X. PIC X(4).
28

Infosys ------------------------------------------------------------- CICS

Slides

‡ The physical map will be:
1 8910 1617 72

empdata DFHMSD TYPE=DSECT, CTRL=(FREEKB,FRSET), LANG=COBOL, MODE=INOUT, TERM=3270, TIOAPFX=YES empdata DFHMDI SIZE=(24,80), CTRL=(FREEKB) DFHMDF POS=(1,2), ATTRIB=(NORM,ASKIP), LENGTH=7, INITIAL=µINFOSYS¶ DFHMDF POS=(1,20), ATTRIB=(NORM,ASKIP), LENGTH=16, INITIAL=µEMPL ....¶ DFHMDF POS=(5,15), ATTRIB=(NORM,ASKIP), LENGTH=14, INITIAL=µEMPL ....E:¶ empname DFHMDF POS=(5,30), ATTRIB=(NORM,ASKIP), LENGTH=4 ..... ..... ..... ..... ..... ..... DFHMSD TYPE=FINAL END

x x x x x x x x x x x x x x x x x

29

Infosys ------------------------------------------------------------- CICS

Slides

TYPE = MAP/DSECT /&SYSPARM/FINAL CTRL = (FREEKB, FRSET/FSET, ALARM) MODE = INOUT/IN/OUT

SIZE = (lines,columns) LINE = line# COLUMN = column# POS = (line#,column#) / posn# LENGTH = number ATTRIB = (ASKIP/PROT/UNPROT, NUM, NORM/BRT/DRK, FSET, IC)

‡ ASKIP - AutoSKIP, PROT - PROTected, UNPROT - UNPROTected. ‡ NORM - NORMal, BRT - BRighT, DRK - DaRK.

30

Infosys ------------------------------------------------------------- CICS

Slides

‡ Modified Data Tag (MDT)
± have two states FSET (on) and FRSET (off) ± while receiving map we get only those data from fields which have MDT on i.e., their attribute has value FSET. ± For any field touched by the user, CICS sets the MDT on.

‡ Sending a map:
EXEC CICS SEND MAP (mapname) MAPSET (mapsetname) FROM (symbolic mapname) [MAPONLY/DATAONLY] [ERASE/ERASEAUP] [CURSOR] END-EXEC.
31

Infosys ------------------------------------------------------------- CICS

Slides

Program

BMS

Terminal

Const 1 Const 2 Var A Var B Var A Var B Const 3

Const 1 Const 2 Var A Var B Const 3

SEND MAP ... MAPONLY Program BMS Terminal

Const 1 Const 2 Var A Var B Var A Var B Const 3 SEND MAP ... DATAONLY

Const 1 Const 2 Var A Var B Const 3

32

Infosys ------------------------------------------------------------- CICS

Slides

‡ Receiving a map:
EXEC CICS RECEIVE MAP (mapname) MAPSET (mapsetname) INTO (symbolic mapname) END-EXEC.

‡ Three ways to return control back to CICS:
EXEC CICS RETURN END-EXEC. EXEC CICS RETURN TRANSID (transaction Id) END-EXEC. EXEC CICS RETURN TRANSID (transaction Id) COMMAREA (ws-commarea) LENGTH (LENGTH OF ws-commarea) END-EXEC.
33

Infosys ------------------------------------------------------------- CICS

Slides

‡ Standard copy books used:
01 BMSCOB-ATTRIBUTE-BYTES. 05 BMS-UNPROT-ALPH-BRT PIC X(1) VALUE IS 'H'. 05 BMS-UNPROT-NONDET-DRK PIC X(1) VALUE IS '<'. 05 BMS-PEN-NONDET-NORM PIC X(1) VALUE IS 'A'. 05 BMS-PEN-PROT-NORM PIC X(1) VALUE IS '/'. 05 BMS-AUTO-SKIP-FSET-NORM PIC X(1) VALUE IS '1'. 05 BMS-AUTO-SKIP-HGH PIC X(1) VALUE IS '8'. .... and so on.

34

Infosys ------------------------------------------------------------- CICS

Slides

01 DFHAID. 02 DFHNULL PIC X VALUE IS ' '. 02 DFHENTER PIC X VALUE IS QUOTE. 02 DFHCLEAR PIC X VALUE IS '_'. 02 DFHPEN PIC X VALUE IS '='. 02 DFHOPID PIC X VALUE IS 'W'. 02 DFHMSRE PIC X VALUE IS 'X'. 02 DFHSTRF PIC X VALUE IS 'h'. 02 DFHTRIG PIC X VALUE IS '"'. 02 DFHPA1 PIC X VALUE IS '%'. 02 DFHPA2 PIC X VALUE IS '>'. 02 DFHPA3 PIC X VALUE IS ','. 02 DFHPF1 PIC X VALUE IS '1'. 02 DFHPF2 PIC X VALUE IS '2'. 02 DFHPF3 PIC X VALUE IS '3'. 02 DFHPF4 PIC X VALUE IS '4'. 02 DFHPF5 PIC X VALUE IS '5'. 02 DFHPF6 PIC X VALUE IS '6'. 02 DFHPF7 PIC X VALUE IS '7'. 02 DFHPF8 PIC X VALUE IS '8'. 02 DFHPF9 PIC X VALUE IS '9'. 02 DFHPF10 PIC X VALUE IS ':'. 02 DFHPF11 PIC X VALUE IS '#'. 02 DFHPF12 PIC X VALUE IS '@'. 02 DFHPF13 PIC X VALUE IS 'A'. 02 DFHPF14 PIC X VALUE IS 'B'. 02 DFHPF15 PIC X VALUE IS 'C'.

35

Infosys ------------------------------------------------------------- CICS

Slides

‡ Testing AID keys:
± IF EIBAID = µ1¶ .... by checking the character code of the key against the value of EIBAID ± IF EIBAID = DFHPF1 .... by including the copybook, instead of using the character value use meaningful names in the copy book. ± By using the following command EXEC CICS HANDLE AID PF1 (C100-HELP) PF2 (D100-PREVIOUS-SCRN) PF3 (X100-EXIT) ANYKEY (K100-INVALID-KEY) END-EXEC. Only 12 conditions at a time. It is a sticky command. i.e., it valid until redefined. ANYKEY does not include ENTER.

36

Infosys ------------------------------------------------------------- CICS

Slides

‡ Changing the field attributes in the program:
± For each symbolic field for which the attribute has to be changed, we need to define another field of data type PIC X just before that field. ± Usually, if the field is named VAR1 then this field is named VAR1-A for easier understanding. ± Then we can use MOVE UNPROT-FSET TO VAR1-A. or MOVE µA¶ TO VAR1-A. and so on before sending the map. ± The copy book COBBMS can be used for this purpose. ± This is used mainly for the subsequent sending of maps in case of errors in any of the fields.

37

Infosys ------------------------------------------------------------- CICS

Slides

‡ Positioning the Cursor through the program:
± For each symbolic field at which the cursor has to be placed, we need to define another field of data type PIC S9(4) COMP just before that field. ± Usually, if the field is named VAR1 then this field is named VAR1-L for easier understanding. ± Then we can use MOVE -1 TO VAR1-L.

before sending the map. ± This is used mainly for the subsequent sending of maps in case of errors in any of the fields. Normally, the cursor is placed at the first field which has error.

38

Infosys ------------------------------------------------------------- CICS

Slides

‡ Error Handling in CICS programs:
± By using the following command EXEC CICS HANDLE CONDITION ERROR (error-handling-routine) MAPFAIL (mapfail-routine) PGMIDERR (programid-err-routine) END-EXEC. If we use both HANDLE CONDITION and HANDLE AID, the later takes the priority. ± By using the RESP option EXEC CICS SEND MAP ( ) MAPSET ( ) .... RESP (ws-resp-code) END-EXEC. IF rsp-normal ... .... The copy book COBRSP can be used for this purpose.
39

Infosys ------------------------------------------------------------- CICS

Slides

‡ Copybook for response codes
01 RSP-CODE PIC S9(9) VALUE ZERO COMP SYNC. 88 RSP-ALLOCERR VALUE 85. 88 RSP-CBIDERR VALUE 62. 88 RSP-CCERROR VALUE 76. 88 RSP-DISABLED VALUE 84. 88 RSP-DSIDERR VALUE 12. 88 RSP-DSSTAT VALUE 46. 88 RSP-DUPKEY VALUE 15. 88 RSP-DUPREC VALUE 14. 88 RSP-END VALUE 83. 88 RSP-ENDDATA VALUE 29. .... and so on. -------------------------------------------------------------------

40

Infosys ------------------------------------------------------------- CICS

Slides

‡ ABEND - ABnormalEND This could happen when any error occurs which is not taken care in the program. We can check the ABEND code and give meaningful messages to the user. EXEC CICS HANDLE ABEND PROGRAM (abend-program) END-EXEC. OR EXEC CICS HANDLE ABEND LABEL (module-name) END-EXEC.

‡ Forcing an ABEND:
EXEC CICS ABEND ABCODE (ws-abend-code) END-EXEC.
41

Infosys ------------------------------------------------------------- CICS

Slides

‡ Transferring control from one program to other:
± EXEC CICS RETURN ... has already been seen. Normally used for pseudo conversation within a program. The calling program gets unloaded and only on pressing an AID key the called program gets loaded. Normally after sending a map this command is used by giving the TRANSID of the same program. ± EXEC CICS LINK PROGRAM (program-name) [COMMAREA (ws-commarea)] [LENGTH (ws-commarea-length)] END-EXEC. Equivalent to CALL statement. Control goes immediately to the called program and returns to the next instruction in the calling program.
42

Infosys ------------------------------------------------------------- CICS

Slides

± EXEC CICS XCTL PROGRAM (program-name) [COMMAREA (ws-commarea)] [LENGTH (ws-commarea-length)] END-EXEC. Control goes to the called program and does not return back. ± EXEC CICS START [TRANSID (transactionId)] [INTERVAL (hhmmss) | TIME (hhmmss)] [TERMID (terminal-name)] [FROM (ws-data-area)] [LENGTH (ws-data-area-length)] END-EXEC. This command can start a transaction on another terminal at specified time or after a specified interval and can pass data to the called program. If the terminal is not specified, when the calling program issues an unconditional RETURN, this new transaction starts.
43

Infosys ------------------------------------------------------------- CICS

Slides

CICS

Level 0

Prog A ::::::: LINK ::::::: RETURN

Level 1

Prog B ::::::: XCTL ::::::: :::::::

Prog C ::::::: LINK ::::::: RETURN

Level 2

Level 3

Prog D ::::::: XCTL ::::::: :::::::

Prog E ::::::: LINK ::::::: RETURN

44

Infosys ------------------------------------------------------------- CICS

Slides

‡ Other differences:
± When RETURN is used the EIBTRNID will have the value specified in TRANSID option. ± When LINK and XCTL is used the EIBTRNID retains the old value. ± When START is used the EIBTRNID gets the new value. ± In CICS a task ends when the RETURN command is executed. A logical unit of work in CICS is a task. ± We can not have the called program as a pseudo conversational program only in LINK since, the moment the RETURN command is executed in called program, the control comes back to the calling program. ± In all the commands except START the calling task gets terminated at the time the command is executed where as START needs an unconditional RETURN.
45

Infosys ------------------------------------------------------------- CICS

Slides

‡ Sending data to another program Using XCTL and LINK:
± Sending Program ..... WORKING-STORAGE-SECTION. 01 WS-PASSDATA PIC X(25). PROCEDURE DIVISION. EXEC CICS XCTL/LINK PROGRAM (µGETDATA¶) COMMAREA (WS-PASSDATA) LENGTH (25) END-EXEC. ± Receiving Program: ..... WORKING-STORAGE-SECTION. 01 WS-GETDATA PIC X(25). LINKAGE SECTION. 01 DFHCOMMAREA PIC X(25). PROCEDURE DIVISION. MOVE DFHCOMMAREA TO WS-GETDATA. ....... ....... ....... .......
46

Infosys ------------------------------------------------------------- CICS

Slides

‡ Sending data to another program Using START:
± Sending Program: .....
WORKING-STORAGE-SECTION. 01 WS-PASSDATA PIC X(25). PROCEDURE DIVISION. EXEC CICS START TRANSID (µGDTA¶) FROM (WS-PASSDATA) LENGTH (25) END-EXEC. EXEC CICS RETURN END-EXEC.

± Receiving Program (TranId µGDTA¶): .....
WORKING-STORAGE-SECTION. 01 WS-GETDATA PIC X(25). * LINKAGE SECTION. * 01 DFHCOMMAREA PIC X(25). PROCEDURE DIVISION. EXEC CICS RETRIEVE INTO (WS-GETDATA) LENGTH (25) END-EXEC.

....... .......

....... .......
47

Infosys ------------------------------------------------------------- CICS

Slides

Return

DFHCA WS 1 Prog A

AID key pressed

DFHCA WS 1 Prog A

XCTL, LINK

DFHCA WS 2 Prog B

Move

common memory START DFHCA WS 1 Prog A DFHCA WS 2 Prog B 48 Retrieve

Infosys ------------------------------------------------------------- CICS

Slides

‡ Temporary Storage Queues -TSQ:
± Most common way to retain data between tasks is by using DFHCOMMAREA and TSQ ± TSQ is a common storage available to all programs. ± TSQs are sharable across tasks. ± i.e., a TSQ defined by one program can be modified or deleted by other tasks (may be of the same program or of a different one) which are in the same CICS partition. ± TSQs are accessed by its name which can be upto 8 characters. ± Maximum size of a TSQ and DFHCOMMAREA is 32K. ± DFHCOMMAREA is created for each program but TSQs exist in a common place in the partition.

49

Infosys ------------------------------------------------------------- CICS

Slides

‡ Writing a TSQ:
EXEC CICS WRITEQ TS QUEUE (queue-name) FROM (ws-data-area) LENGTH (ws-data-area-length) [ITEM (item-no)] [REWRITE] [MAIN / AUXILIARY] END-EXEC. ± Writing a queue which does not exist creates a queue. ± Queue name is normally prefixed with the 4 char terminalid (EIBTRMID) for uniqueness. ± Item specifies which record being written. Leaving this out writes at the end. ± Rewrite is used for updating a pre read item. ± TSQs are by default on secondary storage to save memory.
50

Infosys ------------------------------------------------------------- CICS

Slides

‡ Reading a TSQ:
EXEC CICS READQ TS QUEUE (queue-name) INTO (ws-data-area) LENGTH (ws-data-area-length) [ITEM (item-no)] [NEXT] END-EXEC. ± If both ITEM and NEXT are not specified, by default it is taken as next.

‡ Deleting a TSQ:
EXEC CICS DELETEQ TS QUEUE (queue-name) END-EXEC. ± Notice that deletion of one particular record is not possible from a TSQ. ± Also, queue created by one task can be deleted by other if it knows the name of the queue.
51

Infosys ------------------------------------------------------------- CICS

Slides

‡ A program to write a TSQ:
..... ..... ..... WORKING-STORAGE-SECTION. 01 WS-DATA PIC X(07) VALUE µINFOSYS¶. 01 WS-QNAME PIC X(07) VALUE µMYQUEUE¶. 01 WS-QLENGTH PIC S9(4) COMP VALUE +7. PROCEDURE DIVISION. 000-MAIN. EXEC CICS WRITEQ TS QUEUE (WS-QNAME) FROM (WS-DATA) LENGTH (WS-QLENGTH) END-EXEC. EXEC CICS XCTL PROGRAM (µREADTSQ¶) END-EXEC. ± Instead of declaring WS-QLENGTH we could have used LENGTH (LENGTH OF WS-DATA).
52

Infosys ------------------------------------------------------------- CICS

Slides

‡ A program to read a TSQ:
..... ..... ..... WORKING-STORAGE-SECTION. 01 WS-DATA PIC X(07). 01 WS-QNAME PIC X(07) VALUE µMYQUEUE¶. 01 WS-QLENGTH PIC S9(4) COMP VALUE +7. PROCEDURE DIVISION. 000-MAIN. EXEC CICS READQ TS QUEUE (WS-QNAME) INTO (WS-DATA) LENGTH (WS-QLENGTH) END-EXEC. EXEC CICS SEND FROM (WS-DATA) LENGTH (7) ERASE END-EXEC. EXEC CICS DELETEQ TS QUEUE (WS-QNAME) END-EXEC. EXEC CICS RETURN END-EXEC.
53

Infosys ------------------------------------------------------------- CICS

Slides

‡ Transient Data Queues - TDQ:
± Another way of sharing data. ± Like TSQs, TDQs can be accessed by all programs. ± Unlike TSQs, TDQs are to be defined by the systems programmer in the CICS table Destination Control Table. ± Unlike TSQs, TDQ read is sequential. ± Unlike TSQs, TDQ read is destructive. i.e., when a record is read, it is deleted from the queue. ± Whenever a record is written to a TDQ, it is placed at the end. ± Whenever a record is read from a TDQ, it is read from the beginning. ± When the queue is empty the condition QZERO occurs. ± There is no command to delete a record.
54

Infosys ------------------------------------------------------------- CICS

Slides

‡ TDQ commands:
EXEC CICS WRITEQ TD QUEUE (queue-name) FROM (ws-data) LENGTH (ws-data-length) END-EXEC. EXEC CICS READQ TD QUEUE (queue-name) INTO (ws-data) LENGTH (ws-data-length) END-EXEC. EXEC CICS DELETEQ TD QUEUE (queue-name) END-EXEC. ± Giving TD is a must, TS is default if not given.

55

Infosys ------------------------------------------------------------- CICS

Slides

‡ Two kinds of TDQs: ± Intra partition and ± extra partition. ‡ Intra Partition data queues share data for tasks within a CICS partition. ‡ Extra Partition data queues share data outside a CICS partition. ‡ Both types use identical commands. ‡ TDQs are normally not used. For list processing, we always use TSQs. DFHCOMMAREA is generally used for retaining data in pseudo conversational mode.

56

Infosys ------------------------------------------------------------- CICS

Slides

‡ File Handling in CICS:
± Reading a dataset.
EXEC CICS READ DATASET (filename) INTO (ws-data-area) RIDFLD (keyfield-name) [UPDATE] END-EXEC.

± Writing a dataset.
EXEC CICS WRITE DATASET (filename) FROM (ws-data-area) RIDFLD (keyfield-name) END-EXEC.

± Updating a dataset.
EXEC CICS REWRITE DATASET (filename) FROM (ws-data-area) END-EXEC.

± Writing a dataset.
EXEC CICS DELETE DATASET (filename) [RIDFLD (keyfield-name)] END-EXEC. 57

Infosys ------------------------------------------------------------- CICS

Slides

‡ Dataset Browsing commands:
± Starting browse EXEC CICS STARTBR DATASET (filename) RIDFLD (keyfield) END-EXEC. ± Ending browse EXEC CICS STARTBR DATASET (filename) END-EXEC. ± Reading next item while browsing EXEC CICS READNEXT DATASET (filename) INTO (ws-record) [LENGTH (ws-record-length) [RIDFLD (keyfield)] END-EXEC. ± Reading previous item EXEC CICS READPREV DATASET (filename) INTO (ws-record) [LENGTH (ws-record-length) [RIDFLD (keyfield)] END-EXEC.
58

Infosys ------------------------------------------------------------- CICS

Slides

‡ Committing all the updations:
± In CICS programs COMMIT is not normally used. ± Instead the following command does both database and dataset updations permanent. EXEC CICS SYNCPOINT END-EXEC. ± CICS issues a SYNCPOINT if a task completes successfully. ± We can issue more than one SYNCPOINT command within a task. ± If a task gets ABENDed, system rolls back all the work done upto previous syncpoint. ± It is always good to keep a transactions as small as possible. ± Always issue a SYNCPOINT before transferring control to another program.
59

Infosys ------------------------------------------------------------- CICS

Slides

Summary
‡ In this course we have seen
± ± ± ± ± ± ± ± ± ± ± ± ± what is CICS, the need for CICS the screen layout, keys, etc. batch and online programs important CICS tables transactions and tasks starting and ending a transaction Conversational & Pseudoconversational Programming changing map attributes and positioning the cursor error handling in CICS programs CICS commands complete BMS concepts methods of transferring control from one program to another methods of retaining data between two tasks and transferring data from one program to another File handling in CICS

±

60

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->