P. 1
CICS Training Material

CICS Training Material

|Views: 312|Likes:
Published by Delli Chilli
CICS
CICS

More info:

Published by: Delli Chilli on Aug 12, 2012
Copyright:Attribution Non-commercial

Availability:

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

08/12/2012

pdf

text

original

Sections

  • (Customer Information Control System)
  • Table of Contents
  • Introduction to CICS
  • Batch & Online : Differences
  • CICS & Operating System
  • DB/DC System
  • CICS System Services
  • Task & Transaction
  • Application Programming Concepts
  • Terminal Conversation
  • Terminal Conversation Example
  • Pseudo-Conversation Example
  • CICS Components
  • Mangement Pgms & Ctrl Tables
  • CICS Program Considerations
  • CICS Program Restrictions
  • Sample CICS Program
  • Sample Program (Contd..)
  • CICS Translator
  • Translator
  • Topics in BMS
  • Introduction to BMS
  • Primary Functions of BMS
  • Map and Mapset
  • Map and Mapset (Contd..)
  • Types of MAPS
  • Example – Symbolic Map
  • Physical Map
  • Symbolic Map
  • Map definition Macros
  • Order of Macros
  • DFHMSD Macro
  • DFHMSD Macro (Contd..)
  • DFHMDI Macro
  • DFHMDF Macro
  • Sample Screen layout
  • DFHMDF Macro For The Above Layout
  • Attribute character
  • Attribute character (Contd..)
  • Modified Data Tag
  • Modified Data Tag (Contd..)
  • Skipper Technique
  • Stopper Technique
  • Format Of the Symbolic Map
  • Example Of Symbolic Map
  • Cursor Positioning Techniques
  • Cursor Positioning Techniques (Contd..)
  • Interfacing with a Terminal using a Map
  • Receive Map Command
  • SEND MAP Command
  • AID KEYS
  • AID KEYS (Contd..)
  • Screen Design Considerations
  • Exercise - 1
  • VSAM
  • Services Provided By CICS
  • Defining A File in CICS
  • Syntax of DFHFCT Macro
  • File Handling in Programs
  • Important Key-Words
  • Random READ
  • Example for Random Read
  • Sequential Read
  • Syntax for STARTBR
  • Reading the Record after STARTBR
  • Syntax of READNext/READPrev
  • ENDBRowse
  • RESETBR
  • WRITE Command
  • Syntax for WRITE
  • REWRITE Command
  • Syntax for REWRITE
  • DELETE Command
  • Syntax of DELETE
  • UNLOCK
  • General Exceptions
  • Error Handling in CICS
  • Error Handling methods (Contd..)
  • HANDLE Condition
  • Alternative to Handle condition
  • IGNORE Condition
  • PUSH & POP
  • Syntax of Push & Pop
  • EXEC Interface Block (EIB)
  • Processing Program Table - PPT
  • Program Control Commands
  • LINK
  • LINK Syntax
  • XCTL
  • XCTL Syntax
  • RETURN
  • RETURN Syntax
  • LOAD
  • RELEASE
  • COMMAREA
  • CICS - DB2
  • RCT Entry
  • DB2 - Precompiler
  • Transient data Control
  • WRITEQ TD
  • READQ TD
  • DELETEQ TD
  • Destination Control Table
  • Automatic Task Initiation
  • Temporary Storage Control
  • TSQs
  • TSQs - Typical uses
  • WRITEQ TS
  • READQ TS
  • DELETEQ TS
  • ASKTIME
  • FORMATTIME
  • DELAY
  • START
  • Other Interval Control Commands
  • The Need for Recovery/Restart
  • RECOVERY
  • RESTART
  • Facilities for Recovery/Restart
  • Dynamic Transaction Backout (DTB)
  • LUW & SYNC point
  • LUWs & SYNC pts
  • Automatic Transaction Restart
  • Introduction
  • Preparing a Program
  • Translation
  • Compiling or Linking
  • Defining the Program
  • CESN/CESF Transactions
  • CECI - Command Level Interpreter
  • CEMT-Master Terminal Transaction
  • CEDF-Execution Diagnostic Facility
  • CEDF (Contd..)
  • CEBR-Temporary Storage Browse
  • Exercise - 2

CICS

(Customer Information Control System)
1

Table of Contents
• • • • • • • • • • • Introduction to CICS Basic Mapping Support Program Control File Processing Error Handling Queues Interval and Task Control Recovery and Restart Program preparation CICS Supplied Transactions Case Study
2

Introduction to CICS
• Customer Information Control System -CICS developed in late 1960s as a DB/DC control system • CICS provides an interface between the Operating System and application programs • Macro Level CICS - initial version Assembler macro to request CICS services • Command Level CICS - high level lang.version - commands to request CICS services - Single command can replace series of macros

3

4. 4. 5. 2. Programs and files can‟t be shared Programs are scheduled through jobs O/P printed on paper or in sequential of VSAM or Indexed files Response time: Could be scheduled to be Hours or days 1. is required in case of failure Programs and files can be shared Transaction can be run at any time O/p displayed on Terminal updated files Response Time: Could be in minutes or second. ONLINE SYSTEM Data is entered as needed not in sequence (terminal) Since processing sequence is unpredictable. 3. 5. BATCH SYSTEM Input data is prepared and given in sequence (file) Processing sequence is predictable and hence restarting the process in case of failure is easy. 6. 2. 6.Batch & Online : Differences 1. 3. special recovery/restart proc. Usually in seconds 4 .

CICS & Operating System Operating System CICS Enter Code : User’s App. Files & Database 5 .

DB/DC System Terminals Data Base Central System CICS System Environment & API routines. and Application Programs 6 .

CICS System Services • Data-Communication Functions • Data-Handling Functions • Application Program Services • System Services • Monitoring Functions 7 .

transaction is identified by the transaction identifier (Trans-id) 8 .Task & Transaction • Task :. In CICS.An entity which initiates execution of a task.A basic unit of work which is scheduled by the operating system or CICS Ex -Read from and write to the terminal • Transaction :.

Application Programming Concepts • Pseudo-Conversational • Multitasking • Multithreading • Quasi-Reentrancy 9 .

a significant amount of resource will be wasted just waiting • Pseudo-Conversational. A mode of dialogue between program and terminal which appears to the operator as a continuous conversation but which is actually carried by a series of tasks 10 .Terminal Conversation • Conversational : A mode of dialogue between program and terminal based on a combination of sending message and receiving message within the same task – Since human response is slower than the CPU speed.

<= User Enters Data END-EXEC. * .Terminal Conversation Example PROCEDURE DIVISION....<= EMP(12345) Details END-EXEC.<= TSK1.12345 END-EXEC...SECOND PROCESS.Program Waits For Response . : FIRST-PROCESS. : process EXEC CICS SEND ----. EXEC CICS RECEIVE ---. EXEC CICS RECEIVE ----.. : process 11 ...

: EXEC CICS RECEIVE END-EXEC. 12 . : EXEC CICS SEND END-EXEC. Transaction TSK2 Program PROG2 PROCEDURE DIVISION. : EXEC CICS SEND END-EXEC. EXEC CICS RETURN END-EXEC.Pseudo-Conversation Example Transaction TSK1 Program PROG1 PROCEDURE DIVISION. EXEC CICS RETURN TRANSID („TSK2‟) END-EXEC. : EXEC CICS RECEIVE END-EXEC.

pgm Handle the general functions that are crucial to operation of CICS • Control Tables Define the CICS environment Functionally associated with the management module • Control Blocks (or Areas) Contain system type information.CICS Components • Control Programs (or Management Modules) Programs that interface between OS and app. Eg. Task Control Area contains information about the task 13 .

Storage Table Destin. Control Table PPT FCT TCT PCT TST DCT 14 .Mangement Pgms & Ctrl Tables • Programs Program Control File control Terminal Control Task Control Temporary Storage Transient Data Storage Control Interval Control Journal Control • Tables PCP FCP TCP KCP TSP TDP SCP ICP JCP Processing Program Table File Control Table Terminal Control Table Program Control Table Temp.

CICS Program Considerations Considerations: • Must eventually return control to CICS • Can‟t modify procedure division instructions because CICS programs may be shared by many tasks • Can modify working storage since a unique copy of working storage is created for each task 15 .

GOBACK are avoided. OPEN. EXHIBIT.CICS Program Restrictions Restrictions: • No CONFIG. • COBOL commands such as ACCEPT. I/O SECTION to be specified in the ENVIRONMENT DIVISION. • FILE SECTION. STOP RUN. SECTION. DISPLAY. (STOP RUN & GOBACK are sometimes included in order to eliminate compiler diagnostic but never executed) 16 . CLOSE. and non-CICS READ & WRITE statements are not permitted because file management is handled by CICS. TRACE.

DATA DIVISION. WORKING-STORAGE SECTION.Sample CICS Program IDENTIFICATION DIVISION. 05 FILLER PIC X(1). 01 WS-INPUT. ENVIRONMENT DIVISION. 05 WS-IN-EMP-CD PIC X(4) VALUE ALL „X‟. 17 . 05 WS-TRANSID PIC X(4). PROGRAM-ID. SAMPLE.

) 01 WS-OUTPUT. 05 FILLER PIC X(16) VALUE „EMP CODE : „. EXEC CICS RETURN END-EXEC. 05 WS-OUT-EMP-CD PIC X(4). PROCEDURE DIVISION. PERFORM 200-SEND-OUTPUT. CAN Include DFHCOMMAREA if data needs to be communicated between two transactions or multiple iterations of the same transaction. LINKAGE SECTION. 18 . 000-MAINLINE. PERFORM 100-RECV-INPUT. 01 WS-LENGTH PIC S9(4) COMP.Sample Program (Contd..

Sample Program (Contd.. MOVE WS-IN-EMP-CODE TO WS-OUT-EMP-CODE 200-SEND-OUTPUT. MOVE 9 TO WS-LENGTH. EXEC CICS RECEIVE INTO (WS-INPUT) LENGTH (WS-LENGTH) END-EXEC. EXEC CICS SEND FROM (WS-OUTPUT) LENGTH (20) ERASE END-EXEC. 19 .) 100-RECV-INPUT.

CICS Translator The CICS translator converts CICS commands into the COBOL code so that it could be compiled by a Standard Cobol compiler CICS program with CICS Commands COBOL Statements CICS Translator 20 .

which can be seen in the compiled listing 21 .Translator • When you compile a CICS/VS program the translator will automatically add many lines of code to your program.

Basic Mapping Support 22 .

Topics in BMS • Introduction to BMS • Map and Mapset • Physical and Symbolic Map • Map Definition Macros • Screen Manipulation/Handling • Screen Design Considerations • Interfacing with Terminal using a Map 23 .

CICS provides a facility called Basic Mapping Support (BMS). 24 . a terminal (e. To remove this device and format dependency from application program. In order to display formatted screen. re-coding is required whenever there is change in the terminal device or screen format. So if NMDS is used. formatted screens are used.Introduction to BMS Introductory concepts In online systems. NMDS is designed for a particular terminal and is thus both device dependent and format dependent.g. 3278) must receive a series of data stream called Native Mode Data Stream (NMDS) based on the hardware protocol. this NMDS is a mixture of Buffer Control Characters (BCCs) and text data.

Native Mode Data Stream • Text handling • Terminal Paging & Message routing • Contents of the screen defined thru‟ BMS is called Map. 25 ... • Map is a program written in assembly language.) • Construct NMDS . screen field positions. and field characteristics. • BMS macros are available for Map coding. Titles.Primary Functions of BMS • Removal of device dependent codes from Application Program • Removal of constant information from Application program (Headers. and Mapsets to define the screen attributes. The BMS Macros are coded in the form of Maps.

PROGRAM=name Or 26 .Map and Mapset • Representation of one screen format is called Map (screen panel). makes up a Mapset (load module). link edited together. • One or more maps. • Mapset must have a entry in PPT as given below: DFHPPT DFHPPT TYPE=ENTRY.MAPSET=name TYPE=ENTRY.

Used in App. Program.Map and Mapset (Contd.. To identify the device type 27 .) • Mapset name has two parts.7 chars. 1 char. – Generic name – Suffix • Multimap Panel • Dynamically constructing a screen panel with multiple maps at the execution time 1.

Map and Mapset (Contd. For e.) The concepts of map and mapset can be utilized in two type of cases as given below: Case 1: A mapset consist of a single map.. MAPSET2 MAPNUM1 MAPNUM2 28 . For e. MAPSET1 MAPNUM1 Case 2: A mapset consists of several maps.g.g.

29 .Types of MAPS There are 2 types of MAPS • Physical Map Physical Map is a map used by CICS (CSECT) Ensure device independence in the application program BMS macro coding ==> Assembly==> Link edit ==> Load module ==> LOADLIB ===> To be used by CICS • Symbolic Map Ensure device and format independence in the application program Symbolic Map is a map used by Application Program (DSECT) BMS macro coding ==> Assembly ==> Symbolic map definition ==> COPYLIB ==> Copied (COPY) into CICS application program.

02 FILLER PIC X(03). 02 EMPNAF PIC X. 02 FILLER PIC X(12). 30 . 02 EMPNAL PIC S9(4) COMP. 02 EMPNAO PIC X(21). 01 EMPRECO REDEFINES EMPRECI. 03 EMPNAA PIC X.Example – Symbolic Map 01 EMPRECI. 02 FILLER PIC X(12). 02 EMPNAI PIC X(21). 02 FILLER REDEFINES EMPNAF.

Logic Flow BMS source Assembler Physical MAP Symbolic MAP Linkage editor Load module (MVS) 31 .Physical & Symbolic Map .

At the program execution time the physical map is being used by CICS to load the screen image. The mapset like any other CICS program is stored in CICS runtime library the PPT(Program Processing Table).Physical Map • Physical Map. 32 • • . length. In case of input operations. The BMS macros are assembled and link-edited into CICS load library to create the physical map. In case of output operations. the starting position for each field to be read and allows BMS to interpret an input NMDS. the physical map defines the maximum length. the physical map defines the starting position. field characteristics and the default data for each field and allows BMS to construct an output NMDS.

The symbolic map serves as a DSECT for referencing the Terminal Input/Output Area (TIOA). in the CICS SEND-MAP & RECEIVE MAP commands. . unprotect specific fields on the 33 screen. assembled separately and catalogued into a copy library. • The symbolic map can be used by the CICS application programs to dynamically to alter the field attributes. and is used by the application program to send and receive information from the terminal. protect . and highlight . modify screen cursor position.Symbolic Map • The symbolic map is coded using the BMS macro. The program issues a COBOL COPY statement to include it in the program. • The symbolic maps represents the actual data structure of the fields defined in the physical map.

TYPE=MAP. LANG=COBOL. MODE=INOUT.Map definition Macros General Format Column Number 1 setname operation Example EMPMAP DFHMSD 16 operands 72 contd. TIOAPFX=YES X X X X * * ANY COMMENTS 34 . STORAGE=AUTO.

It is the load module name.Map definition Macros (Contd.) Explanations: SETNAME : Name of the mapset. Mapset/Map/Field definition. Current line can be continued by leaving this column non-blank (usually X) and the next line have to be started in 16th column. Optional key words (parameters) separated by comma. Used in CICS command to read or write one of the maps in the mapset. ‘*’ in column 1 makes the line comment. Macro identifier. OPERATION OPERANDS CONTD : : : Comments : 35 ..

.Map definition Macros (Contd.) INITIAL VALUES Escape Chars : : Always surround initial values by single quote marks ‘ and & 36 .

Order of Macros DFHMSD TYPE=DSECT DFHMDI DFHMDF DFHMDF : DFHMDI DFHMDF DFHMDF : DFHMSD TYPE=FINAL END Mapset Map A field A field Map A field A field Mapset 37 .

Only one mapset is allowed in one assembly run. MODE=INOUT. X X CNTL=(FREEKB. Example: TSTMSET X DFHMSD TYPE=&SYSPARM. LANG=COBOL. TIOAPFX=YES. and they're loaded together at execution time. X X STORAGE=AUTO. All the maps in a map set get assembled together.DFHMSD Macro The DFHMSD macro is used to define a mapset (TYPE=MAP) and its characteristics or to end a mapset definition (TYPE=FINAL).PRINT) 38 .FRSET.

39 ..) Options TYPE= DSECT MAP &SYSPARM FINAL MODE= IN OUT INOUT To define the map type For symbolic map For physical map For special assembly procedure To indicate the end of a mapset coding To indicate input/output operations For an input map only For an output map only For maps involving both input and output.DFHMSD Macro (Contd.

) STORAGE = AUTO To acquire a separate symbolic map area for each mapset BASE To have the same storage base for the symbolic maps of from more than one mapset TIOAPFX= YES To reserve the prefix space (12 bytes) for BMS commands to access TIOA properly. Required for the CICS command level.DFHMSD Macro (Contd.. 40 .

DFHMSD Macro (Contd..)
CNTL=
FREEKB FRSET ALARM PRINT

To define the device control requests To unlock the keyboard To reset MDT to zero status To set an alarm at screen display time To indicate the mapset to be sent to the printer
This ensures device independence, required if other than 3270 terminal is being used To specify the user provided suffix number. This must correspond to the TCT parameter.

TERM=type

SUFFIX=nn

41

DFHMDI Macro
Defines a map and its characteristics Example EMPMAP DFHMDI SIZE=(ll,cc), X LINE=nn, X COLUMN=mm, X JUSTIFY=LEFT/RIGHT Options SIZE=(ll,cc) To define the size of the map by the line size (ll) and the column size (cc). Useful when the screen contains. LINE Indicates the starting line number of the map. COLUMN Indicates the starting column number of the map. JUSTIFY To specify the entire map (map fields) is to be left or right justified.
42

DFHMDF Macro
The DFHMDF macro is used to define a field in a map and its characteristics. This is the position on the screen where the field should appear. It's the position relative to the beginning of the map. Field starts with its attribute byte, so if POS=(1,1) is coded, then the attribute byte for that field is on line 1 in column 1, and the actual data starts in column 2. The length of the field (not counting the attribute byte) is specified. Literals can be specified within quotes; these character data is for an output field. It is used to define labels and titles for the screen and keep them independent of the program.

43

Sample Screen layout The above defines the screen layout as given below: ITEM NUMBER :&nnnnnnnn Where „&‟ Is the Attribute character „n‟ Is unprotected numeric „_„ Is Cursor 44 .

JUSTIFY=RIGHT. ATTRB=(UNPROT. ATTRB=ASKIP.NUM.DFHMDF Macro For The Above Layout Define a field and its characteristics Example DFHMDF POS(ll. PICIN=„9(8)‟.IC).FSET. PICOUT=„9(8)‟. LENGTH=8 X X X X X X X X 45 .cc). :‟.cc). LENGTH=14 CUSTNO DFHMDF POS=(ll. INITIAL=„Customer No.

it will cause the input-inhibit status. The cursor skips to the next field. PROT Protected field. Data cannot be entered into this field.Attribute character Function: The attribute character is an invisible 1-byte character. NUM Numeric field. which precedes a screen field and determines the characteristics of a field. Data can be entered and this is used for all input fields. UNPROT Unprotected field. If data is entered. Only numbers (0 to 9) and special characters (“. ASKIP Autoskip. 46 . Data cannot be entered in this field.” and “-“) are allowed.

IC is specified more than once. In case.) BRT Bright display of a field (highlight). 47 . MDT is set on so that the field data is to be sent from the terminal to the host computer regardless of whether the field is actually modified by the user. NORM Normal display. DRK IC Dark display. The cursor will be positioned in this field. the cursor is placed in the last field. FSET Field set.. Insert cursor.Attribute character (Contd.

Three ways of setting and resetting the MDT. it indicates that the terminal operator has not modified the field. 48 . Terminal user modifies a field on the screen. An effective use of MDT drastically reduces the amount of data traffic in the communication line and thus improves performance. 1. Only when MDT is on.Modified Data Tag Function: Modified Data Tag (MDT) is a one bit of the attribute character. it is automatically set to “1” (on) by the terminal hardware. it indicates that the operator has modified this field. If it is off (0). the data of the field will be sent by the terminal hardware to the host computer. If it is on (1).

49 . MDT will be set to “1”.Modified Data Tag (Contd.) 2. modified) for the field regardless of whether the field has been modified by the terminal user.. when the map is sent to the terminal. 3.e. If CNTL=FRSET is specified in the DFHMSD or DFHMDI macro. If FSET is specified in the ATTRB parameter of the DFHMDF macro for a field. not modified for all the fields of the mapset or the map. MDT will be reset to “0” (off) i.e. (on i. when the mapset or the map is sent to the terminal.

ATTRB=ASKIP.LENGTH=1 • To skip the cursor to the next unprotected field after one unprotected field.cc).Skipper Technique • Unlabelled 1-byte field with the autoskip attribute • DFHMDF POS(ll. • Screen Layout : &xxxxx&$ &xx where $ Skipper field & Attribute byte X Unprotected field 50 .

cc).Stopper Technique • Unlabelled 1-byte field with the protect attribute • DFHMDF POS(ll. • Screen Layout : &xxxxx&$#&$ where # Stopper field 51 .LENGTH=1 • To stop the cursor in order to prevent erroneous field overflow by terminal user.ATTRB=PROT.

Format Of the Symbolic Map Format of Symbolic Map • Once the symbolic map is assembled and is placed in the COPY library. this is required by the BMS under the CICS command level. the COBOL COPY statement can be used to include it in the application program. 52 . which is the TIOA prefix created by the TIOAPFX=YES of the DFHMSD macro. • Next is the definition of FILLER PIC X(12). • The symbolic map starts with the 01 level definition of the map name specified in the DFHMDI macro with the suffix ‘I’ for the input map and the suffix ‘O’ for the output map.

For the output field. BMS creates three fields for inputs and three fields for outputs. For the input field. the actual number of characters typed in the field will be placed by the BMS when the map is received. 53 . The meaning of these fields are given below: • Name + L: The half-word binary (PIC S9(4) COMP) field.. this is used for the dynamic cursor positioning. by placing one character suffix to the original field name.) For each field name (1 to 7 characters) specified in the DFHMDF macro.Format Of the Symbolic Map (Contd.

54 . the field has been cleared).e. X’00’ will be placed if no data is entered. Note that space X’40’ is data.) • Name + F: Flag Byte. For the input field.Format Of the Symbolic Map (Contd. The application program should differentiate X’00’ from space (X’40’). • Name + A: fields.. it will be X’80’ if the field has been modified but no data is sent (i. Otherwise this field is X’00’. • Name + O: The output data field. The Attribute byte for both input and output • Name + I: The input data field.

02 FILLER PIC X(12). 01 EMPRECO REDEFINES EMPRECI. 02 FILLER PIC X(12). 55 . 03 EMPNAA PIC X. 02 FILLER REDEFINES EMPNAF. 02 FILLER PIC X(03).Example Of Symbolic Map 01 EMPRECI. 02 EMPNAL PIC S9(4) COMP. 02 EMPNAI PIC X(21). 02 EMPNAF PIC X. 02 EMPNAO PIC X(21).

Example : DFHMDF POS=(5.ATTRB=(UNPROT. • Static positioning (Achieved thru Map definition ATTRIB=IC). or to point to an error which has occurred during editing the user entries.IC).FSET.8). The cursor positioning is important to prompt an user of an entry he has to make.Cursor Positioning Techniques CICS provides multiple ways of to specify where to position the cursor on the screen.LENGTH=10 56 .

) • Dynamic/Symbolic Positioning. the mapset should be coded with MODE=INOUT in the DFHMSD macro. Also. fieldname + L) for the field where the cursor is to be placed. 57 . This approach is very useful when the cursor is to be placed at the field where data entry error has been detected by the data edit routine.e.Cursor Positioning Techniques (Contd. The cursor is placed dynamically through an application program by moving -1 to the symbolic map field-length field (i. The SEND MAP command must be issued with the CURSOR option (without value)..

) Example Of Dynamic Cursor Positioning. 05 FIELD1F PIC X. 58 .. WORKING-STORAGE SECTION. 05 FIELD1I PIC X. : COPY MAPSET1 01 MAPSET1I 05 FILLER PIC X(6). 05 FIELD1L PIC X(5).Cursor Positioning Techniques (Contd.

59 . : MOVE –1 TO FIELDL. The cursor will be placed at FIELD1 field of the map during execution.. EXEC CICS SEND MAP(‘MAP1’) MAPSET(‘MAPSET1’) CURSOR ERASE END-EXEC.) PROCEDURE DIVISION.Cursor Positioning Techniques (Contd.

the map will be displayed with the cursor placed at the specified position.. At the completion of the SEND MAP command.) Dynamic/Relative Positioning (application program) The cursor is placed dynamically through an application program using the CURSOR(data-value) option in the SEND MAP command with the value of the relative position (starting from zero) of the terminal. overriding the static cursor position defined at the map definition time.Cursor Positioning Techniques (Contd. 60 .

.Cursor Positioning Techniques (Contd.) Example EXEC CICS SEND MAP(„MAP1‟) MAPSET(„MAPSET1‟) CURSOR(100) ERASE END-EXEC. The cursor will be placed at FIELD1 field of the map MAP1 during execution. 61 .

3.Interfacing with a Terminal using a Map The BMS maps are used in the application programs for the actual terminal input/output operation. 2. Text Handling Function – BMS prepares text without using a map and sends to the terminal. These operations are performed by a set of CICS commands for BMS. and sends to the terminal. BMS prepares the output NMDS. The following are the three basic functions performed by CICS commands: Map Sending function – using the data in the symbolic map. Map Receiving Function – using the input NDMS from the terminal. . 62 1. BMS prepares data in the symbolic map through the corresponding physical map. the corresponding physical map.

) Flow of Information from 3270 Terminal and the Application Program. Application Program Send Map Command Symbolic Map BMS Output NDMS Terminal Physical Map Data Entry Application Program Receive Map Command Symbolic Map BMS Input NDMS Terminal 63 ..Interfacing with a Terminal using a Map (Contd.

Interfacing with a Terminal using a Map (Contd..) The following are the available commands: • RECEIVE MAP • SEND MAP • SEND CONTROL • SEND TEXT • SEND PAGE : : : : : To receive a map To send a map To send a control function to the terminal To send a text To send the accumulated text or maps as a logical message 64 .

X‟00‟ will be placed if no data is entered. : The Flag Byte which is normally X‟00‟. At the completion of the command. : The actual input data field. the symbolic map will contain valid data from the terminal in the following three fields as per each field defined by the DFHMDF macro: Field name + L : The length field. which contains the actual number of characters. typed in the screen field. It will be X‟80‟ if the field has been modified but cleared.Receive Map Command RECEIVE MAP Command is used to receive input from a terminal. Field name + F Field name + I 65 .

• Conditions: INVREQ.. MAPFAIL 66 .Receive Map Command (Contd.) Syntax: EXEC CICS RECEIVE MAP (MAPNAME) MAPSET(MAPSETNAME) [ SET(POINTER)| INTO(DATANAME) ] [ LENGTH(MSG-LEN)] [ HANDLE | NOHANDLE ] [ RESP() ] END-EXEC.

INTO is used to specify the area in the working storage section to which the data from the terminal is to be placed.Receive Map Command (Contd. SET is used when the address pointer is to be set to the address of the symbolic map (by CICS) so that the application program can directly refer to the record without moving the record content into the working storage area defined in the program.. which describes the screen details.) MAP specified the name of the MAP defined thru DFHMDI command . 67 . MAPSET specified the name of the MAPSET defined thru DFHMSD command which includes the MAP.

Receive Map Command (Contd.. LENGERR. 68 .) RESP will be used by CICS to place a response code at a completion of the command. HANDLE is used to transfer control to the procedure label specified if the exceptional condition specified occurs. Conditions : INVMPSZ . MAPFAIL MAPFAIL is set when the data being mapped has a length of zero. INVREQR . It occurs when the following keys are pressed in response to the RECEIVE MAP command: CLEAR or Attention Keys & ENTER or PF keys without entering data. NOHANDLE will cause no action to be taken for any exceptional condition occurring during execution of the CICS command.

Name + A: The Attribute byte for output fields.SEND MAP Command The SEND MAP command is used to send formatted output to a terminal. the application program must prepare the data in the symbolic map of the map to be sent. for which the application program need not prepare except when used for the dynamic cursor positioning. which has the following three fields per each field defined by the DFHMDF macro: Name + L: The length field. Name + O: The actual output data field. Before issuing this command. Application program will use it for dynamic cursor positioning. 69 . where the application program places the data.

[ HANDLE | NOHANDLE ] . [ ERASE ] .) EXEC CICS SEND MAP(MAP1) MAPSET(MAPSET1) ] [FROM(DATANAME) ]. [ RESP (DATANAME) ] END-EXEC. • Conditions : INVREQ. [ FREEKB ] . [DATAONLY] | MAPONLY]. [ CURSOR(VALUE) ].LENGERR 70 ..SEND MAP Command (Contd. [ FRSET ] .

SEND MAP Command (Contd. MAPONLY is used when no data from your program is to be merged into the map.) MAP specified the name of the MAP defined thru DFHMDI command . The constants in the map are not sent. 71 .. DATAONLY is used when only the data from the program is to be sent to the screen. which describes the screen details. MAPSET specified the name of the MAPSET defined thru DFHMSD command which includes the MAP.

.) FROM is used to specify the area in the working storage section from which the data is to be sent to the terminal. 72 .SEND MAP Command (Contd.

recently used AID key. Salient Points • PF keys.AID KEYS First time when a transaction is initiated the application program throws the screen image on the terminal thru SEND MAP command. ENTER & CLEAR key • EIBAID in the CICS Executive Interface Block contains. PA keys. CICS application program needs to trap the attention identifier keys and process various functions related to the AID keys. Once the screen appears. the AID (Attention Identifier ) Keys are being used to send the information back from the terminal to CICS to application program. 73 .

Syntax : EXEC CICS HANDLE AID Option (label) END-EXEC Conditions : INVREQ 74 . Program compares EIBAID to the DFHAID field and performs processing logic as per the AID key pressed.) • DFHAID – CICS System copybook which stores the values of the EIBAID field for the various AID keys.AID KEYS (Contd. Flow : User hits AID key – Control goes to CICS – To Application program. EIBAID contains information about the last AID key pressed.. • HANDLE AID establish the routines that are to be invoked when the aid is detected by a RECEIVE MAP command.

75 . This helps at problem determination time. • Screen id should be placed at the top right corner of a screen. Instructions should be concise. • Screen title and field descriptions should be self-explanatory.Screen Design Considerations Functional Screen Design • Screen layout should be similar to source where terminal users enter data.

. • Error messages should be provided. • In case of repeated fields or group of fields. sequence numbers helps.g.) • Large fields can be broken into a number of small fields.Screen Design Considerations (Contd. Preferably the last few lines can be used for the error messages. 76 . E. email ids and postal address. the field contact information can be split into contact numbers.

• The cursors should be placed in the appropriate fields. • Default values in fields helps in reducing keystrokes by the users. This enables users to identify the erroneous field easily. Using a different colour or blinking the error field can achieve this. 77 .Screen Design Considerations User-Friendly Screen Design • Screens should be simple and friendly. Also. defaults values are assigned according to the field. • Calculations should be done by program and not by users. • Highlight the error field. in case the user forgets to enter a field data.

Screen Design Considerations (Contd. spaces. 78 . makes a screen user-friendly. Artistic Screen Design • A simple screen layout is always preferred. and lines makes a screen look good. • Proper use of indentations.. which has details on each field. • Provide suitable help messages for erroneous entries.) • Alarm sound can be used for error entries. The help message should be instructive and kind and should not be rude. Using an attention key for a help menu. • Provide help on fields and their meanings.

Screen Design Considerations (Contd. • Protected fields should be skipped automatically. This reduces manual skipping and is preferred.) • Colour can help in improving the screen design. • Skipper/Stopper techniques can be used at appropriate places. Considerations for Human Errors • Important and useful fields can be placed at the top part of the screen. 79 . • Related fields can be grouped together. however the colour used should be in accordance with the norms and standards followed..

Exercise .1 80 .

CICS File Processing Techniques 81 .

Handle any errors that occur during file processing • • • • • • • 82 .CICS VS FILE PROCESSING File handling in CICS is achieved thru a set of file handling commands. Reading and Updating a record Deleting a Record. Defining a specific file to the CICS system. File Specific functions to be performed are the following. Reading a file sequentially Reading a Key Sequenced file randomly Reading a file sequentially starting from a specific point. It is essential to know the various file handling commands for application programming.

83 . and the Input – Output Section. CICS has a list of all the files it is allowed To access. It goes through the FCT and makes all the files available.CICS VS FILE PROCESSING Instead. When CICS/VS is closed down it closes all the files. This list is called the FILE CONTROL TABLE (FCT) and is maintained by the systems programmers When CICS/VS is started up. The files do not need to opened and closed in a CICS application program . Application program directly Refer to filenames in EXEC CICS Command. before being used in the program. Application programs do not need The FD Section. Files do not need to exclusively defined in Application programs.

key) END-EXEC.CICS COBOL V/S COBOL BATCH COBOL CICS COBOL EXEC CICS READ DATASET (‘FILE IDENTIFIER) INTO (RECORD NAME) RID-FLD (record-key) END-EXEC. 84 . READ DATAFILE INTO REC-AREA AT END MOVE ‘Y’ TO EOF-FLAG Replaced by WRITE RECORD-NAME FROM RECORD-AREA Replaced by EXEC CICS WRITE DATASET (‘File identifier’) FROM (Record-Name) RID-FLD (Record.

VSAM Different types of VSAM Datasets used in CICS are : • ESDS • KSDS • RRDS Entry Sequenced Dataset Key Sequenced Dataset Relative Record Dataset 85 .

Data Independence. Modifying an Existing Record. CICS Provides Exclusive Control.Services Provided By CICS • Basic Operations required for a file are Adding a Record. Browsing One or Selected or All Records. (Record Level Locking). • In Addition. Opening and closing Files. 86 . Deleting an Existing Record. Journaling.

access methods. • FCT will contain all the Information about a file (like dataset name. 88 .Defining A File in CICS • Files should be defined in FCT (File Control Table). permissible file service request. etc.) • Defining files can be done either by CEDA Transaction or DFHFCT Macro.

READ.UPDATE).DELETE.BROWSE. SERVRQ=(ADD.Syntax of DFHFCT Macro DFHFCT TYPE=FILE. DATASETNAME=NAME. FILSTAT=(ENABLED.ACCMETH=VSAM.OPENED) 89 .

90 . updated or deleted.File Handling in Programs • Files should not be defined in the Program. • Records can be inserted. • Records can be written in any order. A number of records can be added at a time. • Program should not open or close a File.

Name in the FCT.Contains the return code of the executed command. • RESP :.Important Key-Words • Dataset/File :.Working-Storage Area defined in the program where the CICS Puts/Gets the Data. • RIDFLD :. 91 .Length of the Record to be Retrieved or Written. • LENGTH :. • Into/From (WS-Rec) :.Contains the Record Key.

Random READ EXEC CICS READ File(filename) [SET() | Into()] RIdfld(Rec-Key) END-EXEC. NOTOPEN. LENGERR. Condition: DISABLED. IOERR. DUPKEY. 92 . NOTFND.

93 .Example for Random Read EXEC CICS READ File( 'INVMAS ') Into(WS-INVMAS-REC) Length(WS-INVMAS-LEN) RIdfld('7135950602') | RIdfld(WS-INVMAS-KEY) END-EXEC.

Sequential Read • Sequential Read is done by Browse Oper. Records cannot be Updated. • Browse can be re-positioned. • Establish the pointer to the First Record to be Read Using StartBr. • During Browse Operation. • Next and Previous Records can be Read as required Using ReadNext and ReadPrev. 94 . • End the Browse Operation at last.

Condition : DISABLED. IOERR. 95 . NOTOPEN. NOTFND.Syntax for STARTBR EXEC CICS STARTBR FILE(filename) RIDFLD(data-area) END-EXEC.

• The first READNEXT or READPREV will read the Record where the STARTBR has positioned the File Pointer. 96 .Reading the Record after STARTBR • Sequentially the Next or Previous Record can be read by a READNEXT or READPREV.

NOTFND. Condition : DUPKEY. ENDFILE. LENGERR.Syntax of READNext/READPrev EXEC CICS READNext | READPrev FILE(name) INTO(data-area)|SET(ptr-ref) RIDFLD(data-area) END-EXEC. 97 . IOERR.

• SYNTAX : EXEC CICS ENDBR FILE(filename) END-EXEC.ENDBRowse • ENDBRowse terminates a Previously issued STARTBR. Condition: INVREQ 98 .

NOTFND. 99 .RESETBR • Its effect is the same as ENDBR and then giving another STARTBR. • Syntax : EXEC CICS RESETBR FILE(filename) RIDFLD(data-area) END-EXEC. Condition: IOERR.

WRITE Command • Adds a new record into the File. • For ESDS. The record will be written depending on the Key. RIDFLD should be the Record Key. RBA value is returned and Record will be written at the end of the File. 100 . RIDFLD is not used but after write execution. • For KSDS. • MASSINSERTion must be done in ascending order of the Key.

DUPREC. Condition: DISABLED. IOERR.Syntax for WRITE EXEC CICS WRITE FILE(filename) FROM(data-area) RIDFLD(data-area) END-EXEC. NOSPACE. 101 . LENGERR. NOTOPEN.

• REWRITE automatically UNLOCKs the Record after execution. 102 .REWRITE Command • Updates a Record which is Previously Read with UPDATE Option.

LENGERR. IOERR.Syntax for REWRITE EXEC CICS REWRITE FILE(filename) FROM(data-area) END-EXEC. NOSPACE. 103 . Condition: DUPREC.

1. • Multiple Records Delete is possible using Generic Option.DELETE Command • Deletes a Record from a dataset. RIDFLD with the full key in it 2. • Record can be deleted in two ways. 104 . The record read with READ with UPDATE will be deleted.

DUPKEY. Optional Condition: DISABLED. 105 . NOTFND. NOTOPEN. IOERR.Syntax of DELETE EXEC CICS DELETE FILE(filename) RIDFLD(data-area) END-EXEC.

Condition: DISABLED. NOTOPEN. • Syntax : EXEC CICS UNLOCK FILE(filename) : [other options] END-EXEC.UNLOCK • To Release the Record which has been locked by READ with UPDATE Command. 106 . IOERR.

General Exceptions • The following exceptions usually will occur for ALL CICS file handling commands. FILENOTFOUND. NOTAUTH. INVREQ 107 . SYSIDERR.

CICS Error Handling Procedures 108 .

109 .Error Handling in CICS Possible Errors: • Conditions that aren't normal from CICS's point of view but that are expected in the program. generation parameters and JCL • Errors related to hardware or other system conditions beyond the control of an application program. • Conditions caused by omissions or errors in the application code. • Conditions caused by user errors and input data errors. • Errors caused by mismatches between applications and CICS tables.

• Rely on the system default action . A return code is set in EIBRESP and EIBRCODE.Error Handling methods When the error (exceptional conditions) occur. the program can do any of the following • Take no action & let the program continue . following the command that has failed to execute.System will terminate or suspend the task depends on the exceptional condition occurred 110 .Control returns to the next inst.Control goes to a label in the program defined earlier by a HANDLE CONDITION command. This state occurs „cause of NO HANDLE /RESP/IGNORE conditions • Pass control to a specified label .

.. • Syntax : EXEC CICS HANDLE CONDITION ERROR(ERRHANDL) LENGERR(LENGRTN) END-EXEC This example handles DUPREC condition separately. 'condition' specifies the name of the condition.Error Handling methods (Contd. all the other Errors together. and 'label' specifies the location within the program to be branched • Remains active while the program is executing or until it encounters IGNORE/another HANDLE condition. LENGERR will be handled by system 111 ..) • HANDLE CONDITION condition[(label)].

FOUND paragraph in the program. 112 .HANDLE Condition Example of Handle condition: EXEC CICS HANDLE CONDITION NOTFND(RECORD-NOT-FOUND) END-EXEC This condition catches the NOTFND condition and transfers control to the REC-NOT. The error handling logic can be coded in the REC-NOT-FND paragraph.

. it contains a return code. 113 .. On return from the command. it can be tested by means of DFHRESP as follows.. or If xxx=DFHRESP(NORMAL) . Later..Alternative to Handle condition • NOHANDLE to specify “no action to be taken for any condition or attention identifier (AID) “ • RESP(xxx) "xxx" is a user-defined full word binary data area. If xxx=DFHRESP(NOSPACE) .

IGNORE Condition • IGNORE CONDITION condition .. • „condition‟ specifies the name of the condition that is to be ignored( no action will be taken) • Syntax : EXEC CICS IGNORE CONDITION ITEMERR LENGERR END-EXEC • This command will not take any actions if the given two error occurs and will pass the control to the next instruction 114 ..

EXEC CICS HANDLE CONDITION NOT-FND(REC-NOT-FOUND) END EXEC. : EXEC CICS READ DATASET(SAMPLE) RIDFLD(EMP-NO) INTO (EMP-REC) END-EXEC : GO TO LAST-PART 115 .COBOL code with proper handling of errors Procedure Division.Sample program to use Handle condition Here is an example of the CICS.

EXEC CICS SEND MAP („TC0BM31‟) MAPSET(„TC0BM30‟) FROM („TC0BM310‟) DATA-ONLY END-EXEC 116 .) REC-NOT-FOUND MOVE „NOT-ON-FILE‟ TO NAMEO ( SYMBOLIC MAP PARAMETER) LAST-PART.Sample program to use Handle condition (Contd..

117 . a sub-program can suspend Handle commands of the called program using PUSH HANDLE. while calling sub-pgms (CALL).PUSH & POP • To suspend all current HANDLE CONDITION. IGNORE CONDITION. • While returning the control. • While receiving the control. it can restore the Handle command using POP HANDLE. HANDLE AID and HANDLE ABEND commands. • Used for eg.

Syntax of Push & Pop • Syntax of Push : EXEC CICS Push Handle END-EXEC. • Syntax of Pop : EXEC CICS Pop Handle END-EXEC. 118 .

EXEC Interface Block (EIB) • CICS provides some system-related information to each task as EXEC Interface Block (EIB) • Unique to the CICS command level EIBAID Attention.Id (1 Byte) EIBCALEN Length of DFHCOMMAREA (S9(4) comp) EIBDATE Date when this task started (S9(7) comp-3) EIBFN Function Code of the last command ( 2 Bytes) EIBRCODE Response Code of the last command (6 Bytes) EIBTASKN Task number of this task (S9(7) comp-3) EIBTIME Time when this task started (S9(7) comp-3) EIBTRMID Terminal-Id (1 to 4 chars) EIBTRNID Transaction-Id (1 to 4 chars) 119 .

Processing Program Table . DFHPPT TYPE=ENTRY.PPT DFHPPT TYPE=ENTRY PROGRAM |MAPSET= name [PGMLANG= ASM|COBOL|PLI] [RES= NO|FIX|YES] : : other options : Eg.PROGRAM=TEST. PGMLANG=COBOL 120 .

PCT Entry
DFHPCT TYPE=ENTRY TRANSID= name PROGRAM=name TASKREQ=pf6 RESTART=yes/no ( TRANSEC = 1 to 64) RSLKEY= 1 to 24 resource level key SCTYKEY= 1 to 64 security key : : other options

121

PROGRAM CONTROL
122

Program Control Commands
• LINK • XCTL • RETURN • LOAD • RELEASE

123

LINK • Used to pass control from one application program to another • The calling program expects control to be returned to it • Data can be passed to the called program using COMMAREA • If the called program is not already in main storage it is loaded 124 .

NOTAUTH. LENGERR 125 . Conditions : PGMIDERR.LINK Syntax EXEC CICS LINK PROGRAM(name) [COMMAREA(data-area) [LENGTH(data-value)]] END-EXEC.

XCTL • To transfer control from one application program to another in the same logical level • The program from which control is transferred is released • Data can be passed to the called program using COMMAREA • If the called program is not already in main storage it is loaded 126 .

XCTL Syntax EXEC CICS XCTL PROGRAM(name) [COMMAREA(data-area) [LENGTH(data-value)]] END-EXEC. NOTAUTH. LENGERR 127 . Conditions : PGMIDERR.

RETURN • To return control from one application program to another at a higher logical level or to CICS • Data can be passed using COMMAREA when returning to CICS to the next task 128 .

Conditions : INVREQ.RETURN Syntax EXEC CICS RETURN [TRANSID(name) [COMMAREA(data-area) [LENGTH(data-value)]]] END-EXEC. LENGERR 129 .

CICS PROG A LINK RETURN PROG C LINK RETURN Level 0 Level 1 PROG B XCTL Level 2 Level 3 Application Program Logic Levels PROG D XCTL PROG E RETURN 130 .

Condition : NOTAUTH. PGMIDER 131 .LOAD • To load program/table/map from the CICS DFHRPL concatenation library into the main storage • Using load reduces system overhead • Syntax : EXEC CICS Load Program(name) [SET (pointer-ref)] [LENGTH (data-area)] END-EXEC.

INVREQ 132 .RELEASE • To RELEASE a loaded program/table/map • Syntax : EXEC CICS RELEASE PROGRAM(name) END-EXEC. Conditions : PGMIDERR. NOTAUTH.

Working Storage definition • Called program .Linkage section definition under DFHCOMMAREA • Called program can alter data and this will automatically available in calling program after the RETURN command ( need not use COMMAREA option in the return for this purpose ) • EIBCALEN is set when COMMAREA is passed 133 .COMMAREA • Data passed to called program using COMMAREA in LINK and XCTL • Calling program .

Communication With Databases
134

CICS - DB2
• CICS provides interface to DB2. • DB2 requires “CICS Attachment Facility” to connect itself to CICS • CICS programs can issue commands for SQL services in order to access the DB2 database.
EXEC SQL function [options] END-EXEC

135

Operating system

CICS REGION

DB2

REGION

App. Pgm. EXEC SQL..

CICS Attachment Facility

DB2 Database

DB2 Database access by CICS
136

• The RCT must be link-edited into a library that is accessible to MVS 137 .RCT Entry • The CICS-to-DB2 connection is defined by creating and assembling the resource control table (RCT) • The information in RCT is used to control the interactions between CICS & DB2 resources • DB2 attachment facility provides a macro (DSNCRCT) to generate the RCT.

DB2 - Precompiler
Source Program (EXEC SQL...
| EXEC CICS...) DB2 Precompiler | CICS command translator | Compile By COBOL | Linkedit by Linkage editor | Load Module
138

QUEUES
139

Transient data Control
• Provides application programmer with a queuing facility • Data can be stored/queued for subsequent internal or external processing • Stored data can be routed to symbolic destinations • TDQs require a DCT entry • Identified by Destination id - 1 to 4 bytes

140

Create files for subsequent processing by Non-CICS / Batch programs.ATI (Automatic Task Initiation) associated with trigger level .association within the same CICS subsystem Typical uses are . Printer etc Typical uses are .Broadcasting etc • Extra-partitioned .TDQs • Intra-partitioned .association external to the CICS subsystem. 141 .Message switching .Logging data. Can associate with any sequential device . DASD.Tape. statistics. transaction error messages .

142 .TDQs • Operations Write data to a transient data queue (WRITEQ TD) Read data from a transient data queue (READQ TD) Delete an intra partition transient data queue (DELETEQ TD).

LENGERR. ISCINVREQ. QIDERR. NOTAUTH. INVREQ. NOSPACE.WRITEQ TD • Syntax : EXEC CICS WRITEQ TD QUEUE(name) FROM(data-area) [LENGTH(data-value)] [SYSID(systemname)] END-EXEC. NOTOPEN. Conditions: DISABLED. SYSIDERR 143 . IOERR.

LENGERR. INVREQ.READQ TD • Reads the queue destructively . ISCINVREQ. SYSIDERR 144 . QZERO. NOTAUTH. QBUSY. QIDERR. NOTOPEN. IOERR.Data record not available in the queue after the read. Conditions : DISABLED. • Syntax : EXEC CICS READQ TD QUEUE(name) {INTO(data-area) | SET(ptr-ref) } [LENGTH(data-value)] [NOSUSPEND] END-EXEC.

ISCINVREQ.DELETEQ TD • Deletes all entries in the queue • Syntax : EXEC CICS DELETEQ TD QUEUE(name) END-EXEC. QIDERR. Conditions: INVREQ. SYSIDERR 145 . NOTAUTH.

• DFHDCT is a macro to define intra & extra partition TDQs TYPE=INTRA/EXTRA • REUSE option specified along with intra partition TDQ tells whether the space used by TDQ record will be removed & reused after it has been read. 146 .Destination Control Table • DCT is to register the information of all TDQs • Destination Control Program (DCP) uses DCT to identify all TDQs and perform all I/O operations.

the transaction MSW1 will be initiated automatically • Applications Message switching & Report printing 147 .Automatic Task Initiation • Facility through which a CICS transaction can be initiated automatically DFHDCT TYPE=INTRA DESTID=MSGS TRANSID=MSW1 TRIGLEV=500 When the number of TDQ records reaches 500.

1 to 8 bytes . called the item number 148 .Created and deleted dynamically .Identified by Queue id .Temporary Storage Control • Provides application programmer the ability to store and retrieve data in a TSQ • Application can use the TSQ like a scratch pad • TSQs are .No CICS table entry required if recovery not required .Typically a combination of termid/tranid/operid • Each record in TSQ identified by relative position.

TSQs • Operations – Write and Update data – Read data .Non-recoverable – Auxiliary .Recoverable – TST entry required. VSAM file DFHTEMP 149 .Sequential and random – Delete the queue • Access – Across transactions – Across terminals • Storage – Main .

Typical uses • Data passing among transactions • Terminal Paging • Report printing 150 .TSQs .

WRITEQ TS • Syntax : EXEC CICS WRITEQ TS QUEUE(name) FROM(data-area) [LENGTH(data-value)] [NUMITEMS(data-area) | ITEM(data-area) [REWRITE] ] [MAIN|AUXILIARY] [NOSUSPEND] END-EXEC. LENGERR. SYSIDERR. ISCINVREQ 151 . Conditions : ITEMERR. INVREQ. QIDERR. NOSPACE. IOERR. NOTAUTH.

IOERR. QIDERR. NOTAUTH. INVREQ. ISCINVREQ 152 . LENGERR. Conditions : ITEMERR.READQ TS • Syntax : EXEC CICS READQ TS QUEUE(name) {INTO(data-area) | SET(ptr-ref) } LENGTH(data-value) [NUMITEMS(data-area)] [ITEM(data-area) | NEXT ] END-EXEC. SYSIDERR.

DELETEQ TS • Deletes all entries in the queue • Syntax : EXEC CICS DELETEQ TS QUEUE(name) END-EXEC. SYSIDERR 153 . NOTAUTH. Conditions: INVREQ. QIDERR. ISCINVREQ.

INTERVAL & TASK CONTROL 154 .

ASKTIME • Used to obtain current date and time • Syntax : EXEC CICS ASKTIME[ABSTIME(data-area)] END-EXEC. • EIBDATE and EIBTIME updated with current date and time • ABSTIME returns value of time in packed decimal format 155 .

. Condition: INVREQ 156 .. [DATE(data-area) [DATEFORM[(data-area)]]] [DATESEP[(data-value)]] [DAYOFMONTH(data-area)] [MONTHOFYEAR(data-area)] [YEAR(data-area)]...FORMATTIME • Syntax : EXEC CICS FORMATTIME ABSTIME(data-ref) [YYDDD(data-area)] [YYMMDD(data-area)]. etc.. [TIME(data-area) [TIMESEP[(data-value)]]] END-EXEC..

INVREQ 157 .DELAY • Used to DELAY the processing of a task • The issuing task is suspended for a specified interval or Until the specified time • Syntax : EXEC CICS DELAY INTERVAL(hhmmss) | TIME(hhmmss) END-EXEC Conditions: EXPIRED.

TRANSIDERR 158 . LENGERR.START • Used to start a transaction at the specified terminal and at the specified time or interval • Data can be passed to the new transaction • Syntax : EXEC CICS START TRANSID(transid) [TERMID(termid) TIME(hhmmss) | INTERVAL(hhmmss) ] END-EXEC Conditions : INVREQ.TERMIDERR.

to free the exclusive control from the resource gained by ENQ 159 .to wait for an event to occur.Used to retrieve the data passed by the START • CANCEL -Used to cancel the Interval Control requests. • WAIT EVENT . eg.Used to suspend a task • ENQ .Other Interval Control Commands • POST . DELAY.to gain exclusive control over a resource • DNQ .to request notification when the specified time has expired.POST and START identified by REQID. • RETRIEVE . • SUSPEND .

Recovery & Restart 160 .

in case of the above failures to maintain the system & data integrity. 161 . eliminate the damage done to the online system.The Need for Recovery/Restart • The possible failures that can occur outside the CICS system are Communication failures (in online systems) Data set or database failures Application or system program failures Processor failures & Power supply failures. • Recovery/Restart facilities are required to minimize or if possible.

RECOVERY • An attempt to come back to where the CICS system or the transaction was when the failure occurred • Recoverable Resources VSAM files Intrapartition TDQ TSQ in the auxiliary storage DATA tables Resource definitions & System definition files 162 .

RESTART • To resume the operation of the CICS system or the transaction when the recovery is completed 163 .

Facilities for Recovery/Restart Facilities for CICS Recovery/Restart • • • • • • Dynamic Transaction Backout Automatic Transaction Restart Resource Recovery Using System Log Resource Recovery Using Journal System Restart Extended Recovery Facility (XRF) 164 .

in dynamic log (Set DTB=YES in PCT) 165 .Dynamic Transaction Backout (DTB) • When the transaction fails. CICS automatically recovers all recoverable resources using the info.the work between the two consecutive SYNC points • When an ABEND occurs. backing out the changes made by the transaction while the rest of the CICS system continues normally is called DTB • CICS automatically writes the „before image‟ information of the record into the dynamic log for the duration of one LUW .

LUW • The end of a logical unit of work is indicated to CICS by a synchronization point (sync pt). • Intermediate SYNC pt. can be done by • Syntax : EXEC CICS SYNCPOINT [ROLLBACK] END-EXEC 166 .LUW & SYNC point • The period between the start of a particular set of changes and the point at which they are complete is called a logical unit of work .

|...LUWs & SYNC pts |....... 167 .......LUW ....| Task B|---------------->--------------->--------------| SOT SP SP EOT-SP When the failure occurs..| Task A|---------------------------------------------| SOT EOT-SP |....LUW..-LUW. changes made within the abending LUW will be backed out.|.....LUW..

Automatic Transaction Restart • CICS capability to automatically restart a transaction after all resources are recovered through DTB • If the transaction requires automatic restart facility. set RESTART=YES in PCT • Care should be taken in order to restart the task at the point where DTB completes in the case of intermediate SYNC point 168 .

Program Preparation 169 .

170 . • Executing the Program. • Defining the Program in the CICS Region.Introduction • Preparing a Program to run in CICS Environment.

Program preparation IF DB2 : SOURCE DB2 PRECOMPILER CICS COMPILER COBOL COMPILER LOAD MODULE LINK EDIT 171 .

172 . • Assemble or Compile the Translator Output.Preparing a Program CICS requires the following steps to prepare a program • Translating the Program. & • Link the Program.

• The SYSPUNCH is given as the input to the Program Compiler. a Program Listing as SYSPRINT and a Translated Source in SYSPUNCH. • The Translator gives two outputs. • If any Copy Books are used in the Program.Translation • Translates the „EXEC CICS‟ Statements into the Statements your Language (COBOL) Compiler can Understand. there should not be any CICS Statements in the Copy Book. 173 .

the compiler options can be specified as required. 174 .Compiling or Linking • As the CICS Commands have been translated. • Hence. the compilation of the CICS program is the same as language program.

• This can be done either by using CEDA trans or DFHPPT. 175 .Defining the Program • The Application should be defined and installed into the PPT.

CICS Supplied Transactions 176 .

PS=password] [.CESN/CESF Transactions • To sign on to CICS system • CESN [USERID=userid] [. • In RACF. the Userid given in CESN is verified.LANGUAGE=l] • Userid & password values can be from 1-8 chars. • NEWPS to change the password and LANGUAGE to choose national language • Sign off by CESF which breaks the connection between the user and CICS • If the Sign on is done twice for the same userid at the terminal.NEWPS=newpassword][. the previous operator will be signed off 177 .

• CECI gives the complete command syntax of the specified command.. application id etc. • Before using the maps in programs.sysid. • CECI READQ TD QUEUE(TESTL001) will read the current record of the given TDQ 178 .Command Level Interpreter • To build and test the effect of EXEC CICS commands • CECI ASSIGN is used to get the current userid.CECI . terminal id. it can be tested using CECI to check how it appears on the screen.

CEMT-Master Terminal Transaction CEMT provides the following services • • • • Displays the status of CICS & system resources Alter the status of CICS & system resources Remove the installed resource definitions Perform few functions that are not related to resources 179 .

To test a transaction across an APPC session 180 .the identifier of the terminal on which the transaction to be tested is being run • Sessionid .To test/monitor a transaction attached across an MRO/ISC session • Sysid .ON/.CEDF-Execution Diagnostic Facility • To test command level application programs interactively • CEDF [termid/sysid/sessionid] [.OFF] • Termid .

pgm given control • Start of execution of each CICS command (auguement values can be changed at this point) • End of execution of each CICS command and before the Handle condition mechanism is invoked (response code values can be changed) • At program termination & at normal task termination • When an ABEND occurs & at abnormal task termination.. after EIB has been initialized and before the app.& CEBR can be invoked 181 .) The points at which EDF interrupts execution of the program and sends a display to the terminal • At transaction initialization.CEDF (Contd. • EIB values can be changed..

CEBR-Temporary Storage Browse • To browse the contents of CICS temporary storage queues (TSQ) • CEBR by default will show the queue associated with the current terminal „CEBRL001‟ which can be overridden to view any other queue • TERM to browse TSQ for another terminal • QUEUE to make the named queue. current • PUT to copy the current queue contents into TDQ • GET to fetch TDQ for browsing • PURGE erases the contents of the current queue 182 .

2 183 .Exercise .

Thank You 184 .

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)//-->