BasicCICS

166
CTS-PAC Version 1.1 1 C I C S

Transcript of BasicCICS

Page 1: BasicCICS

CTS-PAC Version 1.1 1

C I C S C I C S

Page 2: BasicCICS

CTS-PAC Version 1.1 2

Table of ContentsTable of Contents

• Introduction to CICS

• Basic Mapping Support

• Screen Definition Facility

• Program Control

• File Control

• Queues

• Interval and Task Control

• Recovery and restart

• Program preparation

• CICS Supplied Transactions

Page 3: BasicCICS

CTS-PAC Version 1.1 3

CICS - The Online system CICS - The Online system

Page 4: BasicCICS

CTS-PAC Version 1.1 4

Batch & Online : differencesBatch & Online : differences

• BATCH SYSTEM

1. Input data is prepared and given in sequence (file)

2. Processing sequence is predictable and hence restarting the process in case of failure is easy.

3. Programs and files can’t be shared

4. Programs are scheduled through jobs

• ONLINE SYSTEM

1. Data is entered as needed not in sequence (terminal)

2. Since processing seq. is unpredictable, special recovery/restart proc. is reqd. in case of failure.

3. Programs and files can be shared

4. Transaction can be run at any time

Page 5: BasicCICS

CTS-PAC Version 1.1 5

Introduction Introduction

• 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

Page 6: BasicCICS

CTS-PAC Version 1.1 6

CICS & Operating System CICS & Operating System

Operating System

CICS

User’sApp.Prg

Files &Database

Enter Code :

Page 7: BasicCICS

CTS-PAC Version 1.1 7

DB/DC System DB/DC System

Terminals

Central System

Data Base

Page 8: BasicCICS

CTS-PAC Version 1.1 8

CICS System ServicesCICS System Services

• Data-Communication Functions

• Data-Handling Functions

• Application Program Services

• System Services

• Monitoring Functions

Page 9: BasicCICS

CTS-PAC Version 1.1 9

Task &Transaction Task &Transaction

• Task :- A basic unit of work which is scheduled by the operating system or CICS• Read from and write to the terminal

• Read and write files

• Starting another task etc...

• Transaction :- An entity which initiates execution of a task. In CICS, transaction is identified by the transaction identifier

Page 10: BasicCICS

CTS-PAC Version 1.1 10

Terminal ConversationTerminal 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, 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

Page 11: BasicCICS

CTS-PAC Version 1.1 11

Conversational Transaction - Example

Conversational Transaction - Example

PROCEDURE DIVISION.

:

FIRST-PROCESS.

EXEC CICS RECEIVE ---- <= TSK1,12345

END-EXEC.

: process

EXEC CICS SEND ----- <= EMP(12345) Details

END-EXEC.

* - - - - - - Program Waits For Response - - - - -

SECOND PROCESS.

EXEC CICS RECEIVE ----- <= User Enters Data

END-EXEC.

: process

Page 12: BasicCICS

CTS-PAC Version 1.1 12

Pseudo-Conversational -Example

Pseudo-Conversational -Example

Transaction TSK1

Program PROG1

PROCEDURE DIVISION.

:

EXEC CICS RECEIVE

END-EXEC.

:

EXEC CICS SEND

END-EXEC.

EXEC CICS RETURN

TRANSID (‘TSK2’)

END-EXEC.

Transaction TSK2

Program PROG2

PROCEDURE DIVISION.

:

EXEC CICS RECEIVE

END-EXEC.

:

EXEC CICS SEND

END-EXEC.

EXEC CICS RETURN

END-EXEC.

Page 13: BasicCICS

CTS-PAC Version 1.1 13

CICS ComponentsCICS Components

• Management Modules• Programs that interface between OS and app. 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• Contain system type information. Eg. Task Control Area

contains info. about the task

Page 14: BasicCICS

CTS-PAC Version 1.1 14

Management Pgms. & Ctrl. Tables

Management Pgms. & Ctrl. Tables

• Programs

Program Control PCP

File control FCP

Terminal Control TCP

Storage Control SCP

Task Control KCP

Temporary Storage TSP

Transient Data TDP

Interval Control ICP

Journal Control JCP

• Tables

Processing Progm Table PPT

File Control TableFCT

Terminal Control Table TCT

Program Control Table PCT

Temp. Storage TableTST

Destin. Control TableDCT

Page 15: BasicCICS

CTS-PAC Version 1.1 15

CICS Program Considerations & Restrictions

CICS Program Considerations & Restrictions

• Considerations • Must eventually return control to CICS

• Can’t modify procedure division instructions ‘cause CICS programs may be shared by many tasks

• Can modify working storage since a unique copy of working storage is created for each task

Page 16: BasicCICS

CTS-PAC Version 1.1 16

CICS Program Considerations & Restrictions

CICS Program Considerations & Restrictions

• Restrictions• FILE SECTION, OPEN, CLOSE, and non-CICS READ &

WRITE statements are not permitted ‘cause file management is handled by CICS

• Many COBOL features should be avoided like internal sorts, using special registers, ACCEPT, DISPLAY, EXHIBIT, TRACE, STOP RUN, & GOBACK. (STOP RUN & GOBACK are sometimes included in order to eliminate a compiler diagnostic but never executed

Page 17: BasicCICS

CTS-PAC Version 1.1 17

Sample CICS ProgramSample CICS Program

IDENTIFICATION DIVISION.

PROGRAM-ID. SAMPLE.

ENVIRONMENT DIVISION.

DATA DIVISION.

WORKING-STORAGE SECTION.

01 WS-INPUT.

05 WS-TRANSID P IC X(4).

05 FILLER PIC X(1).

05 WS-IN-EMP-CD PIC X(4) VALUE ALL ‘X’.

01 WS-OUTPUT.

05 FILLER PIC X(16) VALUE ‘EMPLOYEE CODE : ‘.

05 WS-OUT-EMP-CD PIC X(4).

01 WS-LENGTH PIC S9(4) COMP.

LINKAGE SECTION.

Page 18: BasicCICS

CTS-PAC Version 1.1 18

Sample Program Contd.Sample Program Contd.

PROCEDURE DIVISION.

000-MAINLINE.

PERFORM 100-RECV-INPUT.

PERFORM 200-SEND-OUTPUT.

EXEC CICS RETURN END-EXEC.

STOP RUN.

100-RECV-INPUT.

MOVE 9 TO WS-LENGTH.

EXEC CICS RECEIVE

INTO (WS-INPUT) LENGTH (WS-LENGTH)

END-EXEC.

MOVE WS-IN-EMP-CODE TO WS-OUT-EMP-CODE

200-SEND-OUTPUT.

EXEC CICS SEND

FROM (WS-OUTPUT) LENGTH (20) ERASE

END-EXEC.

Page 19: BasicCICS

CTS-PAC Version 1.1 19

Basic Mapping Support Basic Mapping Support

Page 20: BasicCICS

CTS-PAC Version 1.1 20

Topics in BMSTopics in BMS

• Introduction to BMS

• Physical and Symbolic Map

• Map and Mapset

• Map Definition Macros

• Screen Manipulation/Handling

• Screen Design Considerations

• Interfacing with Terminal using a Map

Page 21: BasicCICS

CTS-PAC Version 1.1 21

Introduction to BMS - IIntroduction to BMS - I

• Primary functions of BMS• Removal of device dependent codes from Application Program

• Removal of constant information from Application program (Headers, Titles...)

• Construct NMDS - Native Mode Data Stream

• Text handling

• Terminal Paging & Message routing

Page 22: BasicCICS

CTS-PAC Version 1.1 22

Introduction to BMS - IIIntroduction to BMS - II

• Contents of the screen defined thru’ BMS is called Map.

• Map is a program written in assembly language.

• BMS macros are available for Map coding.

• Maps are of two types. Physical Map & Symbolic Map

Page 23: BasicCICS

CTS-PAC Version 1.1 23

Physical and Symbolic MapPhysical and Symbolic Map

• Physical Map is a map used by CICS ( CSECT)

• Ensure device independence in the application program

• Symbolic Map is a map used by Application Program (DSECT)

• Ensure device and format independence in the application program

Page 24: BasicCICS

CTS-PAC Version 1.1 24

Example Of Symbolic MapExample Of Symbolic Map

01 EMPRECI.

02 FILLER PIC X(12).

02 EMPNAL PIC S9(4) COMP.

02 EMPNAF PIC X.

02 FILLER REDEFINES EMPNAF.

03 EMPNAA PIC X.

02 EMPNAI PIC X(21).

01 EMPRECO REDEFINES EMPRECI.

02 FILLER PIC X(12).

02 FILLER PIC X(03).

02 EMPNAO PIC X(21).

Page 25: BasicCICS

CTS-PAC Version 1.1 25

Physical & Symbolic Map - Logic FlowPhysical & Symbolic Map - Logic Flow

BMSsource

Assembler

Physical MAP

Linkage editor

Symbolic MAP

Load module (MVS)

Page 26: BasicCICS

CTS-PAC Version 1.1 26

Map and Mapset Map and Mapset

• Representation of one screen format is called Map (screen panel).

• One or more maps, linkedited together, makes up a Mapset (load module).

• Mapset must have a entry in PPT

• Mapset name has two parts.• Generic name 1- 7 chars. Used in App. Pgm.

• Suffix 1 char. To identify the device type

• Multimap Panel

• Dynamically constructing a screen panel with multiple maps at the execution time

Page 27: BasicCICS

CTS-PAC Version 1.1 27

Map definition MacrosMap definition Macros

General Format

1 16 72

setname operation operands contd.

Example

EMPMAP DFHMSD TYPE=MAP, X

MODE=INOUT, X

LANG=COBOL, X

STORAGE=AUTO, X

TIOAPFX=YES

*

* ANY COMMENTS

Page 28: BasicCICS

CTS-PAC Version 1.1 28

Order of MacrosOrder of Macros

• DFHMSD TYPE=DSECT Mapset

• DFHMDI Map

• DFHMDF A field

• DFHMDF A field

• :

• DFHMDI Map

• DFHMDF A field

• DFHMDF A field

• :

• DFHMSD TYPE=FINAL Mapset

• END

Page 29: BasicCICS

CTS-PAC Version 1.1 29

DFHMSD MacroDFHMSD Macro

• Define a mapset and its characteristics or to end a mapset definition

• Only one mapset is allowed in one assembly run.

• Example

• EMPMSET DFHMSD TYPE=&SYSPARM , X MODE=INOUT, X

LANG=COBOL, XSTORAGE=AUTO, XTIOAPFX=YES, XCNTL=(FREEKB,FRSET,PRINT)

Page 30: BasicCICS

CTS-PAC Version 1.1 30

DFHMDI MacroDFHMDI Macro

• Define a map and its characteristics

• Example

• EMPMAP DFHMDI SIZE=(ll,cc),X

LINE=nn,X

COLUMN=mm,X

JUSTIFY=LEFT/RIGHT

Page 31: BasicCICS

CTS-PAC Version 1.1 31

Screen LayoutScreen Layout

• Where• & Attribute character

• n Unprotected numeric

• - Cursor

&Customer No. :&nnnnnnnn

Page 32: BasicCICS

CTS-PAC Version 1.1 32

DFHMDF Macro For The Above Layout

DFHMDF Macro For The Above Layout

• Define a field and its characteristics

• Example DFHMDF POS(ll,cc), X

INITIAL=‘Customer No. :’, X

ATTRB=ASKIP, X

LENGTH=14

CUSTNO DFHMDF POS=(ll,cc), X

ATTRB=(UNPROT,NUM,FSET,IC), X

JUSTIFY=RIGHT, X

PICIN=‘9(8)’, X

PICOUT=‘9(8)’, X

LENGTH=8

Page 33: BasicCICS

CTS-PAC Version 1.1 33

Attribute characterAttribute character

• Invisible one byte character

• Defines the characteristics of a s field• Thru’ ATTRB param. of DFHMDF.

• There are different kinds of attributes• Attributes to control the display intensity of the field

• Keyboard Attributes

• Attribute Related to the Field Modification

• Cursor Control Attribute

Page 34: BasicCICS

CTS-PAC Version 1.1 34

Modified Data TagModified Data Tag

• Indicates the field has been modified or not

• Effective use of MDT reduces the amount of data traffic.

• MDT setting/resetting• when the user modifies a field on the screen

• CNTL=FRSET, defined in map/mapset

• FSET in ATTRB parameter of DFHMDF

Page 35: BasicCICS

CTS-PAC Version 1.1 35

Skipper TechniqueSkipper Technique

• Unlabelled 1-byte field with the autoskip attribute • DFHMDF POS(ll,cc),ATTRB=ASKIP,LENGTH=1

• To skip the cursor to the next unprotected field after one unprotected field.

• Screen Layout :• &xxxxx&$ &xx

• where• $ Skipper field

• & Attribute byte

• X Unprotected field

Page 36: BasicCICS

CTS-PAC Version 1.1 36

Stopper TechniqueStopper Technique

• Unlabelled 1-byte field with the protect attribute

• DFHMDF POS(ll,cc),ATTRB=PROT,LENGTH=1

• To stop the cursor in order to prevent erroneous field overflow by terminal user.

• Screen Layout :• &xxxxx&$#&$

• &xxxxx&$#&$

• where• # Stopper field

Page 37: BasicCICS

CTS-PAC Version 1.1 37

Screen Design ConsiderationsScreen Design Considerations

• Functional Screen Design

• User-Friendly Screen Design

Page 38: BasicCICS

CTS-PAC Version 1.1 38

Cursor Positioning TechniquesCursor Positioning Techniques

• Static positioning (map definition)

• Dynamic/Symbolic Positioning (app.pgm)

• Dynamic/Relative Positioning (app. pgm)

• Checking Cursor Position by EIBCPOSN.

Page 39: BasicCICS

CTS-PAC Version 1.1 39

AID KEYSAID KEYS

• Indicates the method to initiate the transfer of info. from terminal to CICS.

• PF keys, PA keys, ENTER & CLEAR key

• EIBAID contains , recently used AID code

• Standard AID list - DFHAID

• HANDLE AID establish the routines that are to be invoked when the aid is detected by a RECEIVE MAP command• HANDLE AID

EXEC CICS HANDLE AID

Option (label)

END-EXEC Conditions : INVREQ

Page 40: BasicCICS

CTS-PAC Version 1.1 40

Numeric Sign/Decimal Point Handling

Numeric Sign/Decimal Point Handling

• Numeric Sign : For input operations, Separate fields or CR/DR field approach can be used and for output operations, PICOUT parameter can be given in macro

• Decimal Point : For input operations, Virtual decimal point or Separate fields approach can be used and for output operations, PICOUT parameter has to be given in the field definition macro.

Page 41: BasicCICS

CTS-PAC Version 1.1 41

SEND MAP SEND MAP

• Writes formatted output to a terminal.EXEC CICS SEND MAP(mapname)

[[ FROM(dataname) ] [DATAONLY] | MAPONLY]

[ MAPSET(mapsetname) ]

[ CURSOR(VALUE) ]

[ FREEKB ]

[ ERASE ]

[ FRSET ]

[ HANDLE | NOHANDLE

[ RESP (dataname) ] ]

END-EXEC

• Conditions : INVREQ,LENGERR,NOTALLOC

Page 42: BasicCICS

CTS-PAC Version 1.1 42

RECEIVE MAP RECEIVE MAP

• To receive input from a terminal

EXEC CICS RECEIVE MAP (mapname)

[ SET(pointer) | INTO(dataname) ]

[LENGTH(msg-len)]

[ MAPSET(mapsetname) ]

[ HANDLE | NOHANDLE

[ RESP() ] ]

END-EXEC

• Handle Conditions:

• EODS, INVMPSZ, INVREQ, MAPFAIL

Page 43: BasicCICS

CTS-PAC Version 1.1 43

Types of BMS Panel operationsTypes of BMS Panel operations

• Single Map panel

• Text Panel

• Multipage Message

• Multimap Panel

• Multimap/Multipage Message

Page 44: BasicCICS

CTS-PAC Version 1.1 44

ACCT

Operating System

TerminalControl

System Services

StorageManage-ment

Program Library

Account File

1

2 3

CICS Transaction (Initiation) Flow :-

Page 45: BasicCICS

CTS-PAC Version 1.1 45

Menu Screen

Operating System

File

Control

BMS

Program

Program Library

Account File

CICS Transaction Flow :-( SEND MAP)

ACCT00

Page 46: BasicCICS

CTS-PAC Version 1.1 46

User’sNext input

Operating System Program Library

Account File

FileControl

ProgramACCT01

BMS

6 78

CICS Transaction Flow :-( RECEIVE & SEND MAPs)

Page 47: BasicCICS

CTS-PAC Version 1.1 47

Screen Definition Facility SDF - IIScreen Definition Facility SDF - II

Page 48: BasicCICS

CTS-PAC Version 1.1 48

INTRODUCTION - SDFINTRODUCTION - SDF

• An interactive tool for defining information to be displayed on the screen

• Objects created by SDF are used by various systems like CICS/BMS, IMS, ISPF etc..

• The SDF objects are Panel and Panel Groups (etc..) corresponding to map and mapset in CICS/BMS

Page 49: BasicCICS

CTS-PAC Version 1.1 49

SDF FunctionsSDF Functions

• Creation of objects which is common for all the systems

• Provides functions to alter and test the objects

• Generation function to create code for the objects like macro codes for CICS/BMS

• Provides utilities to print, migrate & convert objects

• Provides functions to develop application prototypes

Page 50: BasicCICS

CTS-PAC Version 1.1 50

Panel CommandsPanel Commands• SDF has panel commands like ‘TOP’ ‘BOTTOM’ ‘UP’

‘DOWN , to browse through the the panels

• PRESERVE to protect the panel

• AUTOSAVE to set the automatic save option on

• commands ‘SAVE’ to record the changes and CANCEL/CCANCEL to quit the changes

• TEST to test the appearance of the object

• Commands are available to edit the panels... like to create,alter & view the fields and its attributes E.g.. ATTRIBUTE,EDIT,SHOW,HIDE etc..

Page 51: BasicCICS

CTS-PAC Version 1.1 51

Panel & Line CommandsPanel & Line Commands

• SDF has got panel commands to do the following.• To browse through the panel

• To quit/save the changes

• To protect the panel and to restore the panel in case or errors

• To test the appearance of the panel

• Panel editor commands to create, alter & view the fields and its attributes

• And Line commands to copy, move, delete, repeat & insert lines

Page 52: BasicCICS

CTS-PAC Version 1.1 52

PanelsPanels

• To create a panel, Enter a existing panel which is to be used as a skeleton for the new panel OR Enter a device type

• Panel text can be defined by typing the text in the required panel position in format mode.

• Variable fields can be defined by variable field marks. and arrays can be defined by specifying a dimension and direction.

• Variable fields can be defined by variable field marks

Page 53: BasicCICS

CTS-PAC Version 1.1 53

Panels Contd. Panels Contd.

• A panel can be included in another panel with few restrictions

• Default attributes are assigned to fields which can be changed. E.g.. for attributes are,• color,protection,intensity,cursor position,justify, field

format,field validation, modified data flag, etc.

• To change the panel,• Enter the panel name and library identifier where the panel

resides

Page 54: BasicCICS

CTS-PAC Version 1.1 54

Panel GroupsPanel Groups

• A panel group contains information about a group of panels, and the names of the panels that belong to the panel group.

• Procedure of Creating and editing panel group is same as panel

• Define the global parameters of the panel group thru’ ‘Panel Group Characteristics’ opt.• E.g.. BMS characteristics like generation name(later used in

generation) & logical device code etc.

Page 55: BasicCICS

CTS-PAC Version 1.1 55

Generation Generation

• As SDF objects are stored in internal rep. they have to be generated to be used in applications

• Output of generation , depends on the object type • Panel => Map

• Panel group => Mapset

• One or more data structures(used in Cobol) or control blocks (BMS macros) can be generated

Page 56: BasicCICS

CTS-PAC Version 1.1 56

SDF LibrariesSDF Libraries

• Define libraries(created in ISPF) to be used by SDF II to store and retrieve objects

• SDF II library is a partitioned data set with a three-level dataset name (project.group.dgipnl)

• Only the first two levels can be defined & third level added by sdf depends on the object type• DGIPNL-for panels, DGIGRP-for panel groups and DGIPST-

for partition sets

• 'ID' is assigned for each library which is used to search the objects in the library

• password can be given to protect the library.

Page 57: BasicCICS

CTS-PAC Version 1.1 57

SDF utilitiesSDF utilities

• Print :- To print utility produces printouts of panels, panel groups,partition sets etc..

• Migration:- To migrate objects from various sources into SDF libraries. Eg. Maps, map sets & partition sets defined with CICS/BMS macros

• Conversion utility :-To convert objects from one target system to a new target system.

Page 58: BasicCICS

CTS-PAC Version 1.1 58

Application PrototypeApplication Prototype

• To test the flow of panels, before they are incorporated into application programs.• Simulative prototype :- Simulates the primary interaction

between the application & user. • Used to validate and determine the initial user requirements before

designing the program

• Prototype definition• Identify the panel by giving name & library ID

• Define the prototype rules based on the CURRENT panel,the ACTION to be performed & NEXT PANEL to be displayed if certain CONDITIONS are met.

Page 59: BasicCICS

CTS-PAC Version 1.1 59

Sample MacroSample MacroTULMAP DFHMSD TYPE=MAP,LANG=COBOL,MODE=INOUT,

STORAGE=AUTO,SUFFIX=C

TULMAP DFHMDI SIZE=(12,60),CTRL=(FREEKB,ALARM,FRSET), *

COLUMN=1,LINE=1,DATA=FIELD, *

TIOAPFX=YES,JUSTIFY=(LEFT,FIRST)

DFHMDF POS=(3,14),LENGTH=6,INITIAL='Name:', *

ATTRB=(PROT,NORM)

NAME DFHMDF POS=(3,21),LENGTH=10,ATTRB=(UNPROT,BRT,ASKIP)

DFHMDF POS=(3,32),LENGTH=1,ATTRB=(PROT,NORM)

DFHMDF POS=(4,14),LENGTH=6,INITIAL='Age :', *

ATTRB=(PROT,NORM)

AGE DFHMDF POS=(4,21),LENGTH=3, ATTRB=(UNPROT,NORM),

DFHMDF POS=(4,25),LENGTH=1,ATTRB=(PROT,NORM)

DFHMSD TYPE=FINAL

Page 60: BasicCICS

CTS-PAC Version 1.1 60

PROGRAM CONTROLPROGRAM CONTROL

Page 61: BasicCICS

CTS-PAC Version 1.1 61

PROG A LINKRETURN

CICS

PROG BXCTL

PROG CLINKRETURN

PROG DXCTL

PROG ERETURN

Level 0

Level 1

Level 2

Level 3

Application ProgramLogic Levels

Page 62: BasicCICS

CTS-PAC Version 1.1 62

LINKLINK

• 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

Page 63: BasicCICS

CTS-PAC Version 1.1 63

LINK Syntax :LINK Syntax :

LINK

PROGRAM(name)

[COMMAREA(data-area)

[LENGTH(data-value)]]

Conditions : PGMIDERR, NOTAUTH,

LENGERR

Page 64: BasicCICS

CTS-PAC Version 1.1 64

XCTLXCTL

• To xfer 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

Page 65: BasicCICS

CTS-PAC Version 1.1 65

XCTL Syntax :XCTL Syntax :

XCTL

PROGRAM(name)

[COMMAREA(data-area)

[LENGTH(data-value)]]

Conditions : PGMIDERR, NOTAUTH,

LENGERR

Page 66: BasicCICS

CTS-PAC Version 1.1 66

RETURNRETURN

• 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

Page 67: BasicCICS

CTS-PAC Version 1.1 67

RETURN Syntax :RETURN Syntax :

RETURN

[TRANSID(name)

[COMMAREA(data-area)

[LENGTH(data-value)]]]

Conditions : INVREQ, LENGERR

Page 68: BasicCICS

CTS-PAC Version 1.1 68

LOADLOAD

• To load program/table/map from the CICS DFHRPL concatenation library into the main storage

• Using load reduces system overhead

Page 69: BasicCICS

CTS-PAC Version 1.1 69

LOAD Syntax :LOAD Syntax :

LOAD

PROGRAM(name)

[ SET (ptr-ref) ]

[LENGTH(data-area)/FLENGTH(data-area) ]

[ ENTRY(ptr-ref) ]

[HOLD]

Conditions : PGMIDERR, NOTAUTH, LENGERR

Page 70: BasicCICS

CTS-PAC Version 1.1 70

LOAD - programming exampleLOAD - programming example

Assembler Program - To define the table to be used by another program

CNTRYTBL CSECT

DC CL7’01USA’

DC CL7’02UK’

DC CL7’03INDIA’

END

Page 71: BasicCICS

CTS-PAC Version 1.1 71

Programming example -cont’dProgramming example -cont’d

WORKING-STORAGE SECTION

01 TBL-LEN S9(4) COMP.

LINKAGE SECTION

01 CNTRYTBL-DATA.

05 FILLER OCCURS 10 TIMES.

10 CNTRY-CODE PIC 99.

10 CNTRY-NAME PIC X(5).

EXEC CICS LOAD

PROGRAM(‘CNTRYTBL’)

SET(ADDRESS OF CNTRYTBL-DATA)

LENGTH(TBL-LEN)

END-EXEC

SERVICE RELOAD CNTRYTBL-DATA

Page 72: BasicCICS

CTS-PAC Version 1.1 72

RELEASERELEASE

• To RELEASE a loaded program/table/map

• Syntax :

RELEASE

PROGRAM(name)

Conditions : PGMIDERR, NOTAUTH, INVREQ

Page 73: BasicCICS

CTS-PAC Version 1.1 73

COMMAREA COMMAREA

• Data passed to called program using COMMAREA in LINK and XCTL

• Calling program - Working Storage defn

Called program - Linkage section defn 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

Page 74: BasicCICS

CTS-PAC Version 1.1 74

Processing Program Table - PPTProcessing Program Table - PPT

DFHPPT TYPE=ENTRY

PROGRAM |MAPSET= name

[PGMLANG= ASM|COBOL|PLI]

[RES= NO|FIX|YES]

:

: other options

:

Eg.

DFHPPT TYPE=ENTRY,PROGRAM=TEST,

PGMLANG=COBOL

Page 75: BasicCICS

CTS-PAC Version 1.1 75

PCT EntryPCT Entry

DFHPCT TYPE=ENTRY

TRANSID= name

PROGRAM=name

TASKREQ=pf6

DTIMOUT=mmss

RTIMOUT=mmss

RESTART=yes/no ( TRANSEC = 1to 64)

RSLKEY= 1 to 24 resource level key

SCTYKEY= 1 to 64 security key

TIMEOUT= mm between tasks

DUMP=

TRNPRTY= 0 to 255

RSLC= Yes/No

Page 76: BasicCICS

CTS-PAC Version 1.1 76

Application Programming Concepts

Application Programming Concepts

• Pseudo-Conversational

• Multitasking

• Multithreading

• Quasi-Reentrancy

Page 77: BasicCICS

CTS-PAC Version 1.1 77

POSSIBLE ERRORSPOSSIBLE ERRORS• Conditions that aren't normal from CICS's point of view

but that are expected in the pgm.

• Conditions caused by user errors and input data errors.

• Conditions caused by omissions or errors in the application code.

• Errors caused by mismatches bet. applications and CICS tables, generation parameters & JCL

• Errors related to hardware or other system conditions beyond the control of an appl. pgm.

Page 78: BasicCICS

CTS-PAC Version 1.1 78

Handling Methods...Handling Methods...When the error (exceptional conditions) occur, the program

can do any of the following

• Take no action & let the program continue - Control returns to the next inst. following the command that has failed to execute. A return code is set in EIBRESP and EIBRCODE. This state occurs ‘cause of NO HANDLE /RESP/IGNORE conditions

• Pass control to a specified label - Control goes to a label in the program defined earlier by a HANDLE CONDITION command.

• Rely on the system default action - System will terminate or suspend the task depends on the exceptional condition occurred

Page 79: BasicCICS

CTS-PAC Version 1.1 79

HANDLE CONDITIONHANDLE CONDITION

• HANDLE CONDITION condition[(label)]... 'condition' specifies the name of the condition, 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 cond.• EXEC CICS HANDLE CONDITION ERROR(ERRHANDL)

DUPREC(DUPRTN) LENGERR

• This example handles DUPREC cond. separately, all the other ERRORs together. LENGERR will be handled by system

Page 80: BasicCICS

CTS-PAC Version 1.1 80

Alternative to HANDLE ConditionAlternative 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 fullword binary data area. On return from the command, it contains a return code. Later, it can be tested by means of DFHRESP as follows,

If xxx=DFHRESP(NOSPACE) ... or

If xxx=DFHRESP(NORMAL) ...

Page 81: BasicCICS

CTS-PAC Version 1.1 81

IGNORE CONDITIONIGNORE CONDITION

• IGNORE CONDITION condition condition ...

• ‘condition’ specifies the name of the condition that is to be ignored( no action will be taken)

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

Page 82: BasicCICS

CTS-PAC Version 1.1 82

PUSH & POPPUSH & POP

• To suspend all current HANDLE CONDITION, IGNORE CONDITION, HANDLE AID and HANDLE ABEND commands.

• Used for eg. while calling sub-pgms (CALL)

• While receiving the control, a sub-program can suspend Handle commands of the called program using PUSH HANDLE

• While returning the control, it can restore the Handle command using POP HANDLE

Page 83: BasicCICS

CTS-PAC Version 1.1 83

EXEC Interface BlockEXEC Interface Block

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

Page 84: BasicCICS

CTS-PAC Version 1.1 84

File HandlingFile Handling

Page 85: BasicCICS

CTS-PAC Version 1.1 85

Introduction Introduction

• Services Provided by CICS.

• Access Methods Supported by CICS.

• Defining A File to CICS.

• Coding File-Handling Statements in the Program.

Page 86: BasicCICS

CTS-PAC Version 1.1 86

Services Provided By CICSServices Provided By CICS

• Basic Operations required for a file are• Adding a Record.

• Modifying an Existing Record.

• Deleting an Existing Record.

• Browsing One or Selected or All Records.

• In Addition, CICS Provides• Exclusive Control. (Record Level Locking).

• Data Independence.

• Journalling.

• Opening and closing Files.

Page 87: BasicCICS

CTS-PAC Version 1.1 87

VSAMVSAM

Three types of Files in VSAM.

• ESDS Entry Sequenced Dataset

• KSDS Key Sequenced Dataset

• RRDSRelative Record Dataset

• LSDS Linear Sequential Dataset

Page 88: BasicCICS

CTS-PAC Version 1.1 89

Defining A File to CICS.Defining A File to CICS.

• Files should be defined in FCT (File Control Table).

• FCT will contain all the Information about a File. (like dataset name, access methods, permissible file service request, etc.)

• Defining Files can be done either by CEDA Transaction or DFHFCT Macro.

Page 89: BasicCICS

CTS-PAC Version 1.1 90

Syntax of DFHFCT Macro :-Syntax of DFHFCT Macro :-

DFHFCT TYPE=FILE,ACCMETH=VSAM,

DATASETNAME=NAME,

SERVRQ=(ADD,BROWSE,DELETE,READ,UPDATE),

FILSTAT=(ENABLED,OPENED)

Page 90: BasicCICS

CTS-PAC Version 1.1 91

File Handling in Programs.File Handling in Programs.

• Files should not be defined in the Program.

• Program should not open or close a File.

• Records can be written in any order. A number of records can be added at a time.

• Records can be inserted, updated or deleted.

Page 91: BasicCICS

CTS-PAC Version 1.1 92

Important Key-WordsImportant Key-Words

• Dataset/File :- Name in the FCT.

• Into/From (WS-Rec) :- Working-Storage Area defined in the program where the CICS Puts/Gets the Data.

• RIDFLD :- Contains the Record Key.

• RESP :- Contains the return code of the executed command.

• LENGTH :- Length of the Record to be Retrieved or Written.

Page 92: BasicCICS

CTS-PAC Version 1.1 93

Random READRandom READ

EXEC CICS

READ File(filename)

SEt() | Into()

RIdfld(Rec-Key)

END-EXEC.

Exceptions: DISABLED, NOTOPEN, NOTFND, LENGERR, DUPKEY, IOERR.

Page 93: BasicCICS

CTS-PAC Version 1.1 94

Example for Random Read :Example for Random Read :

EXEC CICS

READ

File( 'INVMAS ')

Into(WS-INVMAS-REC)

Length(WS-INVMAS-LEN)

RIdfld('7135950602') | RIdfld(WS-INVMAS-KEY)

Keylength( +00010 ) Equal

END-EXEC.

Page 94: BasicCICS

CTS-PAC Version 1.1 95

Sequential ReadSequential Read

• Sequential Read is done by Browse Oper.

• Establish the pointer to the First Record to be Read Using StartBr.

• Next and Previous Records can be Read as required Using ReadNext and ReadPrev.

• End the Browse Operation at last.

• Browse can be re-positioned.

• During Browse Operation, Records cannot be Updated.

Page 95: BasicCICS

CTS-PAC Version 1.1 96

Syntax for STARTBRSyntax for STARTBR

EXEC CICS

STARTBR FILE(filename)

RIDFLD(data-area)

END-EXEC.

• Exceptions: DISABLED, IOERR, NOTFND, NOTOPEN.

Page 96: BasicCICS

CTS-PAC Version 1.1 97

Reading the Record after STARTBR.Reading the Record after STARTBR.

• Sequentially the Next or Previous Record can be read by a READNEXT or READPREV.

• The first READNEXT or READPREV will read the Record where the STARTBR has positioned the File Pointer.

Page 97: BasicCICS

CTS-PAC Version 1.1 98

Syntax Syntax

READNEXT :

EXEC CICS

READNext | READPrev

FILE(name)

INTO(data-area)|SET(ptr-ref)

RIDFLD(data-area)

END-EXEC.

• Exceptions: DUPKEY, ENDFILE, IOERR, LENGERR, NOTFND.

Page 98: BasicCICS

CTS-PAC Version 1.1 99

ENDBRowseENDBRowse

• ENDBRowse terminates a Previously issued STARTBRowse.

• SYNTAX :-

EXEC CICS

ENDBR

FILE(filename)

END-EXEC.

• Exception : INVREQ

Page 99: BasicCICS

CTS-PAC Version 1.1 100

RESETBRRESETBR

• Its effect is the same as ENDBR and then giving another STARTBR.

EXEC CICS

RESETBR

FILE(filename)

RIDFLD(data-area)

END-EXEC.

• Exections: IOERR, NOTFND.

Page 100: BasicCICS

CTS-PAC Version 1.1 101

WRITE CommandWRITE Command• Adds a new record into the File.

• For ESDS, RIDFLD is not used but after write execution, RBA value is returned and Record will be written at the end of the File.

• For KSDS, RIDFLD should be the Record Key. The record will be written depending on the Key.

• MASSINSERTion must be done in ascending order of the Key.

Page 101: BasicCICS

CTS-PAC Version 1.1 102

Syntax for WRITE Syntax for WRITE

EXEC CICS

WRITE FILE(filename)

FROM(data-area)

RIDFLD(data-area)

END-EXEC.

• Exceptions: DISABLED, DUPREC, IOERR, LENGERR, NOSPACE, NOTOPEN.

Page 102: BasicCICS

CTS-PAC Version 1.1 103

REWRITE CommandREWRITE Command

• Updates a Record which is Previously Read with UPDATE Option.

• REWRITE automatically UNLOCKs the Record after execution.

Page 103: BasicCICS

CTS-PAC Version 1.1 104

Syntax for REWRITESyntax for REWRITE

EXEC CICS

REWRITE

FILE(filename)

FROM(data-area)

END-EXEC.

• Exceptions: DUPREC, IOERR, LENGERR, NOSPACE.

Page 104: BasicCICS

CTS-PAC Version 1.1 105

DELETE CommandDELETE Command

• Deletes a Record from a dataset.

• Record can be deleted in two ways, • RIDFLD with the full key in it. and

• the record read with READ with UPDATE will be deleted.

• Multiple Records Delete is possible using Generic Option.

Page 105: BasicCICS

CTS-PAC Version 1.1 106

DELETE SyntaxDELETE Syntax

EXEC CICS

DELETE FILE(filename)

RIDFLD(data-area) Optional

END-EXEC.

• Exceptions: DISABLED, DUPKEY, IOERR, NOTFND, NOTOPEN.

Page 106: BasicCICS

CTS-PAC Version 1.1 107

Syntax for UNLOCKSyntax for UNLOCK

• To Release the Record which has been locked by READ with UPDATE Command.

EXEC CICS

UNLOCK

FILE(filename)

SYSID(systemname) Optional

END-EXEC.

• EXCEPTIONS: DISABLED, IOERR, NOTOPEN.

Page 107: BasicCICS

CTS-PAC Version 1.1 108

General Exceptions:General Exceptions:

• The following Exceptions usually will occur for ALL CICS File Handling Commands.

FILENOTFOUND, ILLOGIC,

ISCINVREQ, NOTAUTH,

SYSIDERR, INVREQ

In Addition to the above, Exceptions shown along the systax will occur.

Page 108: BasicCICS

CTS-PAC Version 1.1 109

Communication With DatabasesCommunication With Databases

Page 109: BasicCICS

CTS-PAC Version 1.1 110

CICS - DB2CICS - 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

Page 110: BasicCICS

CTS-PAC Version 1.1 111

Operating system

CICS REGION DB2 REGION

App. Pgm. EXEC SQL.. CICS Attachment Facility

DB2Database

DB2 Database access by CICS

Page 111: BasicCICS

CTS-PAC Version 1.1 112

RCT EntryRCT 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.

• The RCT must be link-edited into a library that is accessible to MVS

Page 112: BasicCICS

CTS-PAC Version 1.1 113

DB2 - PrecompilerDB2 - Precompiler Source Program (EXEC SQL...

| EXEC CICS...)

DB2 Precompiler

|

CICS command translator

|

Compile By COBOL

|

Linkedit by Linkage editor

|

Load Module

Page 113: BasicCICS

CTS-PAC Version 1.1 114

QUEUESQUEUES

Page 114: BasicCICS

CTS-PAC Version 1.1 115

Transient data ControlTransient 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

Page 115: BasicCICS

CTS-PAC Version 1.1 116

TDQsTDQs

• Intra-partitioned - association within the same CICS subsystem• Typical uses are

• ATI (Automatic Task Inititation ) associated with trigger level

• Message switching

• Broadcasting etc

• Extra-partitioned - association external to the CICS subsystem• Can associate with any sequential device - Tape, DASD, Printer etc

• Typical uses are • Logging data, statistics, transaction error messages

• Create files for subsequent processing by Non-CICS / Batch programs

Page 116: BasicCICS

CTS-PAC Version 1.1 117

TDQsTDQs

• Operations

• Write data to a transient data queue (WRITEQ TD)

• Read data from a transient data queue (READQ TD)

• Delete an intrapartition transient data queue (DELETEQ TD).

Page 117: BasicCICS

CTS-PAC Version 1.1 118

WRITEQ TDWRITEQ TD

WRITEQ TD

QUEUE(name)

FROM(data-area)

[LENGTH(data-value)]

[SYSID(systemname)]

Conditions: DISABLED, INVREQ, IOERR, ISCINVREQ, LENGERR, NOSPACE, NOTAUTH, NOTOPEN, QIDERR, SYSIDERR

Page 118: BasicCICS

CTS-PAC Version 1.1 119

READQ TDREADQ TD

Reads the queue destructively - Data record not available in the queue after the read.

READQ TD

QUEUE(name)

{INTO(data-area) | SET(ptr-ref) }

[LENGTH(data-value)]

[SYSID(systemname)]

[NOSUSPEND]

Conditions : DISABLED, IOERR, INVREQ, ISCINVREQ, LENGERR, NOTAUTH, NOTOPEN, QBUSY, QIDERR, QZERO, SYSIDERR

Page 119: BasicCICS

CTS-PAC Version 1.1 120

DELETEQ TDDELETEQ TD

Deletes all entries in the queue

DELETEQ TD

QUEUE(name)

[SYSID(systemname)]

Conditions: INVREQ, ISCINVREQ, NOTAUTH, QIDERR, SYSIDERR

Page 120: BasicCICS

CTS-PAC Version 1.1 121

TDQ - Exceptional ConditionsTDQ - Exceptional Conditions• DISABLED

• IOERR

• ISCINVREQ

• LENGERR

• ITEMERR

• NOSPACE

• NOTAUTH

• NOTOPEN

• QBUSY

• QIDERR

• QZERO

• SYSIDERR

Page 121: BasicCICS

CTS-PAC Version 1.1 122

Destination Control TableDestination 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.

• 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.

Page 122: BasicCICS

CTS-PAC Version 1.1 123

Automatic Task InitiationAutomatic 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, the transaction MSW1 will be initiated automatically

• Applications• Message switching & Report printing

Page 123: BasicCICS

CTS-PAC Version 1.1 124

Temporary Storage ControlTemporary 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 • Created and deleted dynamically

• No CICS table entry required if recovery not required

• Identified by Queue id - 1 to 8 bytes

• Typically a combination of termid/tranid/operid

• Each record in TSQ identified by relative position, called the item number

Page 124: BasicCICS

CTS-PAC Version 1.1 125

TSQsTSQs

• Operations• Write and Update data

• Read data - Sequential and random

• Delete the queue

• Access• Across transactions

• Across terminals

• Storage• Main - Non-recoverable

• Auxiliary - Recoverable • TST entry required, VSAM file DFHTEMP

Page 125: BasicCICS

CTS-PAC Version 1.1 126

TSQs - Typical uses TSQs - Typical uses

• Data passing among transactions

• Terminal Paging

• Report printing

Page 126: BasicCICS

CTS-PAC Version 1.1 127

WRITEQ TSWRITEQ TS

WRITEQ TS

QUEUE(name)

FROM(data-area)

[LENGTH(data-value)]

[NUMITEMS(data-area) |

ITEM(data-area) [REWRITE] ]

[SYSID(systemname)]

[MAIN|AUXILIARY]

[NOSUSPEND]

Conditions : ITEMERR, LENGERR, QIDERR, NOSPACE, NOTAUTH, SYSIDERR, IOERR, INVREQ, ISCINVREQ

Page 127: BasicCICS

CTS-PAC Version 1.1 128

READQ TSREADQ TS

READQ TS

QUEUE(name)

{INTO(data-area) | SET(ptr-ref) }

LENGTH(data-value)

[NUMITEMS(data-area)]

[ITEM(data-area) | NEXT ]

[SYSID(systemname)]

Conditions : ITEMERR, LENGERR, QIDERR, NOTAUTH, SYSIDERR, IOERR, INVREQ, ISCINVREQ

Page 128: BasicCICS

CTS-PAC Version 1.1 129

DELETEQ TSDELETEQ TS

Deletes all entries in the queue

DELETEQ TS

QUEUE(name)

[SYSID(systemname)]

Conditions: INVREQ, ISCINVREQ, NOTAUTH, QIDERR, SYSIDERR

Page 129: BasicCICS

CTS-PAC Version 1.1 130

TSQ-Exceptional ConditionsTSQ-Exceptional Conditions

• ITEMERR

• LENGTHERR

• QIDERR

• INVREQ

• IOERR

• ISCINVREQ

• NOTAUTH

• NOSPACE

• SYSIDERR

Page 130: BasicCICS

CTS-PAC Version 1.1 131

INTERVAL AND TASK CONTROLINTERVAL AND TASK CONTROL

Page 131: BasicCICS

CTS-PAC Version 1.1 132

ASKTIMEASKTIME

• Used to obtain current date and time

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

Page 132: BasicCICS

CTS-PAC Version 1.1 133

FORMATTIMEFORMATTIMEFORMATTIME ABSTIME(data-ref)

[YYDDD(data-area)]

[YYMMDD(data-area)]... etc.

[DATE(data-area) [DATEFORM[(data-area)]]]

[DATESEP[(data-value)]]

[DAYCOUNT(data-area)]

[DAYOFWEEK(data-area)]

[DAYOFMONTH(data-area)]

[MONTHOFYEAR(data-area)]

[YEAR(data-area)]

[TIME(data-area) [TIMESEP[(data-value)]]]

Condition: INVREQ

Page 133: BasicCICS

CTS-PAC Version 1.1 134

DELAYDELAY

• Used to DELAY the processing of a task

• The issuing task is suspended for a specified interval or Until the specified time

EXEC CICS DELAY

INTERVAL(hhmmss) |

TIME(hhmmss)

END-EXEC

Conditions: EXPIRED, INVREQ

Page 134: BasicCICS

CTS-PAC Version 1.1 135

POST/WAIT event POST/WAIT event

• POST to request notification when the specified time has expired.

• WAIT EVENT to wait for an event to occur.EXEC CICS POST

INTERVAL(hhmmss) | TIME(hhmmss)

SET (Ptr-Ref)

END-EXEC

Conditions : EXPIRED, INVREQ

EXEC CICS WAIT EVENT

ECADDR(Ptr-Ref)

END-EXEC.

Conditions: INVREQ

Page 135: BasicCICS

CTS-PAC Version 1.1 136

STARTSTART• Used to start a transaction at the specified terminal and at

the specified time or interval

• Data can be passed to the new transaction

EXEC CICS START

TRANSID(transid)

[TERMID(termid)

TIME(hhmmss) | INTERVAL(hhmmss) ]

END-EXEC

Conditions : INVREQ, LENGERR,TERMIDERR, TRANSIDERR

Page 136: BasicCICS

CTS-PAC Version 1.1 137

RETRIEVERETRIEVE

• Used to retrieve the data passed by the START

RETRIEVE

{INTO(data_area) | SET(ptr_ref)}

{LENGTH(data_area)}

{RTRANSID(data_area)}

{RTERMID(data_area)}

{QUEUE(data_area)}

{WAIT}

Handle Conditions: ENDDATA, ENVDEFERR, INVREQ, IOERR, LENGERR, NOTFND

Page 137: BasicCICS

CTS-PAC Version 1.1 138

CANCELCANCEL

• Used to cancel the Interval Control requests. eg. DELAY,POST and START identified by REQID.

CANCEL

{REQID(name) {TRANSID(name)} {SYSID(name)}}

Handle Conditions: INVREQ, NOTAUTH,

NOTFND,SYSIDERR

Page 138: BasicCICS

CTS-PAC Version 1.1 139

SUSPENDSUSPEND

• Used to suspend a task

• After the execution of higher priority tasks, control will be returned to the suspended task

EXEC CICS

SUSPEND

END-EXEC

Page 139: BasicCICS

CTS-PAC Version 1.1 140

ENQ ENQ

• ENQ- to gain exclusive control over a resource

ENQ

RESOURCE(data_area)

{LENGTH(data_value)}

{NOSUSPEND}

• Handle Conditions: ENQBUSY, LENGERR, INVREQ

Page 140: BasicCICS

CTS-PAC Version 1.1 141

DEQDEQ

• DEQ- to free the exclusive control from the resource gained by ENQ

DEQ

RESOURCE(data_area)

{LENGTH(data_value)}

• Handle Conditions: INVREQ, LENGERR

Page 141: BasicCICS

CTS-PAC Version 1.1 142

RECOVERY & RESTARTRECOVERY & RESTART

Page 142: BasicCICS

CTS-PAC Version 1.1 143

The Need for Recovery/RestartThe 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, eliminate the damage done to the online system, in case of the above failures to maintain the system & data integrity.

Page 143: BasicCICS

CTS-PAC Version 1.1 144

RECOVERYRECOVERY

• 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

Page 144: BasicCICS

CTS-PAC Version 1.1 145

RESTARTRESTART

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

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

Page 145: BasicCICS

CTS-PAC Version 1.1 146

Dynamic Transaction Backout-DTB

Dynamic Transaction Backout-DTB

• When the transaction fails, 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 ,the work between the two consecutive SYNC points

• When an ABEND occurs, CICS automatically recovers all recoverable resources using the info. in dynamic log (Set DTB=YES in PCT)

Page 146: BasicCICS

CTS-PAC Version 1.1 147

LUW & SYNC pointLUW & 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- 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

EXEC CICS SYNCPOINT

[ROLLBACK]

END-EXEC

Page 147: BasicCICS

CTS-PAC Version 1.1 148

LUWs & SYNC ptsLUWs & SYNC pts

|- - - - - - - - - - - - LUW - - - - - - - - - |

Task A|---------------------------------------------|

SOT EOT-SP

|- - - LUW- - |- - - LUW- - |- - -LUW- - |

Task B|---------------->--------------->--------------|

SOT SP SP EOT-SP

When the failure occurs, changes made within the abending LUW will be backed out.

Page 148: BasicCICS

CTS-PAC Version 1.1 149

Automatic Transaction RestartAutomatic 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

Page 149: BasicCICS

CTS-PAC Version 1.1 150

Extended Recovery Facility-XRFExtended Recovery Facility-XRF

• XRF is to increase the availability of CICS by automating the fast recovery of CICS resources

• There are two systems with same configuration

• All the resources are shared by the two systems

• If the failure occurs in one system, the other system will continue

• The system downtime can be reduced to few minutes if XRF is used

Page 150: BasicCICS

CTS-PAC Version 1.1 151

ACF/NCP

ActiveSession

Back-up Session

System Files

CICS Files

Application Files

MVS/XAACF/VTAMCICS/MVS

MVS/XAACF/VTAMCICS/MVS

30903090

Active System Shared Resources Alternate system

Communication Controller (3725)

XRF-Concept

Page 151: BasicCICS

CTS-PAC Version 1.1 152

Program PreparationProgram Preparation

Page 152: BasicCICS

CTS-PAC Version 1.1 153

Introduction Introduction

• Preparing a Program to run in CICS Environment.

• Defining the Program in the CICS Region.

• Executing the Program.

Page 153: BasicCICS

CTS-PAC Version 1.1 154

Preparing a ProgramPreparing a Program

• CICS requires the following steps to prepare a Program.• Translating the Program.

• Assemble or Compile the Translator Output. &

• Link the Program.

Page 154: BasicCICS

CTS-PAC Version 1.1 155

Page 155: BasicCICS

CTS-PAC Version 1.1 156

TranslationTranslation

• Translates the ‘EXEC CICS’ Statements into the Statements your Language (COBOL) Compiler can Understand.

• The Translator gives two outputs, a Program Listing as SYSPRINT and a Translated Source in SYSPUNCH.

• The SYSPUNCH is given as the input to the Program Compiler.

• If any Copy Books are used in the Program, there should not be any CICS Statements in the Copy Book.

Page 156: BasicCICS

CTS-PAC Version 1.1 157

Translator Options.Translator Options.

• The Translator Options Can be specified using• PARM Statement to the Translating Step. or

• By Specifying CBL.

• Some important Translator Options are • COBOL2, OPT, DEBUG, SOURCE, FLAG, EDF, ...

Page 157: BasicCICS

CTS-PAC Version 1.1 158

Compiling or LinkingCompiling or Linking

• As the CICS Commands have been translated, The Compilation of the CICS Program is the same as Language Program.

• Hence, the Compiler Options can be specified as required.

• FDUMP and RENT option should be specified for VS COBOL II.

Page 158: BasicCICS

CTS-PAC Version 1.1 159

Defining the Program Defining the Program

• The Application should be defined and Installed into the PPT.

• This can be done either by using CEDA Trans. or DFHPPT.

Page 159: BasicCICS

CTS-PAC Version 1.1 160

CICS Supplied TransactionsCICS Supplied Transactions

Page 160: BasicCICS

CTS-PAC Version 1.1 161

CESN/CSSF TransactionsCESN/CSSF Transactions

• To sign on to CICS system

• CESN [USERID=userid] [,PS=password] [,NEWPS=newpassword][,LANGUAGE=l]

• userid & password values can be from 1-8 chars.

• In RACF, the Userid given in CESN is verified.

• NEWPS to change the password and LANGUAGE to choose national language

• Sign off by CSSF which breaks the connection between the user and CICS

• If the Sign on is done twice for the same userid at the terminal, the previous operator will be signed off

Page 161: BasicCICS

CTS-PAC Version 1.1 162

CEBR-Temporary Storage Browse

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

Page 162: BasicCICS

CTS-PAC Version 1.1 163

CECI - Command Level Interpreter

CECI - Command Level Interpreter

• To build and test the effect of EXEC CICS commands

• CECI ASSIGN is used to get the current userid,sysid, terminal id, application id etc..

• Before using the maps in programs, it can be tested using CECI to check how it appears on the screen.

• CECI gives the complete command syntax of the specified command.

• CECI READQ TD QUEUE(TESTL001) will read the current record of the given TDQ

Page 163: BasicCICS

CTS-PAC Version 1.1 164

CEMT-Master Terminal Transaction

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

Page 164: BasicCICS

CTS-PAC Version 1.1 165

CEDA - Resource Definition Online

CEDA - Resource Definition Online

• To define and alter resource definitions of CICS system

• The main two functions provided by CEDA are DEFINE & INSTALL

• DEFINE - To specify the resource definition in CICS system definition (CSD) file

• INSTALL - To transfer the new definition to active CICS system. In few cases, activation of definitions is done later thru ‘CEMT’ ( CEMT S PROG(CCDTEST) NEW)

• Resources that are defined/installed are FILE, PROGRAM, TERMINAL,TRANSACTIONS,MAPSETS etc...

• Used to get the characteristics of transactions,programs, files, etc through View command

Page 165: BasicCICS

CTS-PAC Version 1.1 166

CEDF-Execution Diagnostic Facility

CEDF-Execution Diagnostic Facility

• To test command level application programs interactively

• CEDF [termid/sysid/sessionid] [,ON/,OFF]

• Termid - 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 - To test a transaction across an APPC session

Page 166: BasicCICS

CTS-PAC Version 1.1 167

CEDF - Contd.CEDF - Contd.

• The points at which EDF interrupts execution of the program and sends a display to the terminal• At transaction initialization, after EIB has been initialized and

before the app. 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.

• EIB values can be changed..& CEBR can be invoked