You are on page 1of 153

Customer Information Control System

Course Mechanics
Course Type: Facilitated

Course Notes:
Notes are located in the Notes View. (Please see View Master/Notes Master to see the Notes View.)

This course is best viewed in Slide Show Mode.


You can download this course to your desktop (if desired) for printing and note taking.

Length of Course: 40 hours.

Course Audience: Team Members or Project Managers with exposure to Mainframe Technology

23 August 2013

CICS.ppt

Prerequisite Training

Working Knowledge on COBOL & VSAM Basic Knowledge on DB2

23 August 2013

CICS.ppt

Course Objectives
Participants will be able to learn and work on CICS Application Programming

23 August 2013

CICS.ppt

Agenda
Introduction to CICS Program Preparation Program Control Basic Mapping Support Error & Exception Handling File Handling Queues

Interval and Task Control


Communication with Databases Recovery and restart
23 August 2013

NOTE - Click on arrow to directly advance to the topic CICS.ppt

Customer Information Control System


Introduction

Introduction Whats special about CICS


CICS is a growing multi-billion dollar business for customers, IBM and the thousands of software companies which support CICS CICS handles more than thirty billion transactions per day Each day CICS processes more than $1 trillion in transactions More than thirty million people use CICS CICS can support over nine hundred thousand concurrent users
23 August 2013 CICS.ppt 7

Introduction Whats special about CICS (cont)


CICS allows any enterprise to adopt e-business whilst minimizing the exposure to the potential risks of new technology, by use of an evolutionary approach

CICS allows you to take existing applications to the web with little or no change
CICS supports numerous application development environments and models including COBOL, PL/I, Java, EJB and Object Oriented (OO), in any combination

23 August 2013

CICS.ppt

Introduction Batch & Online - Differences


BATCH SYSTEM ONLINE 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 cant be shared

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. Programs are scheduled through jobs


23 August 2013

4. Transaction can be run at any time


CICS.ppt 9

Introduction 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 language version commands to request CICS services - Single command can replace series of macros

23 August 2013

CICS.ppt

10

Introduction

CICS & Operating System

Operating System
CICS
Enter Code :

Users App.Prg

Files & Database

23 August 2013

CICS.ppt

11

Introduction
DB/DC System Data Base

Central System

23 August 2013

CICS.ppt

12

Introduction CICS System Services


Data-Communication Functions
Data-Handling Functions Application Program Services

System Services
Monitoring Functions

23 August 2013

CICS.ppt

13

Introduction Application Programming Concepts


Pseudo-Conversational
Multitasking Multithreading

Quasi-Reentrancy

23 August 2013

CICS.ppt

14

Introduction 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
23 August 2013 CICS.ppt 15

Introduction 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, 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
23 August 2013 CICS.ppt 16

Introduction Conversational Transaction - Example


PROCEDURE DIVISION.

:
FIRST-PROCESS. EXEC CICS RECEIVE ---- <= TSK1,12345 END-EXEC.

: process
EXEC CICS SEND END-EXEC. * - - - - - - Program Waits For Response - - - - ----- <= EMP(12345) Details

SECOND PROCESS.
EXEC CICS RECEIVE ----- <= END-EXEC. : process
23 August 2013 CICS.ppt 17

User Enters Data

Introduction Psuedo-Conversational - Example


Transaction TSK1 Program PROG1 PROCEDURE DIVISION. : EXEC CICS RECEIVE Transaction TSK2 Program PROG2 PROCEDURE DIVISION. : EXEC CICS RECEIVE

END-EXEC.
: EXEC CICS SEND END-EXEC. EXEC CICS RETURN TRANSID (TSK2) END-EXEC.
23 August 2013 CICS.ppt

END-EXEC.
: EXEC CICS SEND END-EXEC. EXEC CICS RETURN END-EXEC.
18

Introduction CICS 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
23 August 2013 CICS.ppt 19

Introduction Management Programs & Control Tables


Programs
Program Control File Control Terminal Control Storage Control Task Control Temporary Storage PCP FCP TCP SCP KCP TSP

Tables
Processing Pgm File Control Terminal Control Program Control Temp. Storage Destin. Control Resource Control PPT FCT TCT PCT TST DCT RCT

Transient Data
Interval Control Journal Control
23 August 2013

TDP
ICP JCP

CICS.ppt

20

Introduction CICS Program Considerations & Restrictions


Considerations
- Must eventually return control to CICS - Cant 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

23 August 2013

CICS.ppt

21

Introduction CICS Program Considerations & Restrictions(Cont..)


Restrictions
- FILE SECTION, OPEN, CLOSE, and non-CICS READ & WRITE statements are not permitted because 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
23 August 2013 CICS.ppt 22

Introduction Structure of CICS Application Program


IDENTIFICATION DIVISION. PROGRAM-ID. XXXXX. ENVIRIONMENT DIVISION. <== THIS DIVISION MUST BE EMPTY

DATA DIVISION. <== FILE SECTION IS OMITTED WORKING-STORAGE SECTION. 77 ----------------01 ----------------05 -------LINKAGE SECTION. <== LINKAGE SECTION IS MANDATORY 01 DFHCOMMAREA <== COMMUNICATION AREA reqd for passing data for subsequent execs. PROCEDURE DIVISON. (COBOL STATEMENTS)+ <== CICS statements mixed with COBOL statements (CICS STATEMENTS) Some COBOL verbs are not allowed

GO BACK.
23 August 2013 CICS.ppt 23

Introduction
Data between transactions - COMMAREA
First Execution- TXN1 Communication Area Maintained by CICS

WORKING STRORAGE SECTION 01 WS-COMM-AREA

LINKAGE SECTION 01 DFHCOMMAREA


PROCEDURE DIVISION.

Next Execution - TXN1

..
EXEC CICS RETURN TRANSID(TXN1) COMMAREA(WS-COMM-AREA) END-EXEC.
23 August 2013 CICS.ppt

WORKING STORAGE SECTION

01 WS-COMM-AREA LINKAGE SECTION 01 DFHCOMMAREA


24

Introduction EXEC Interface Block


The control information for each task is provided by CICS through EIB, unique to CICS command level
Automatically given to each CICS application program in LINKAGE SECTION at the time of program translation

Copybook DFHEIBLK is inserted by the translator before the DFHCOMMAREA variable


Information in EIB can be used for error handling EIBRESP gives the response code of CICS command executed
23 August 2013 CICS.ppt 25

Starting a Task
PCT Trans TXN1
T X C1 TXC2 TXN1 TXN2

Program
MAPPGC1 MAPPGC2 TXNPGM1 TXNPGM2

CICS ADDRESS SPACE MAPPGC1

PPT Program
MAPPGC1 MAPPGC2 TXNPGM1 TXNPGM2

Location
In Storage On Disk In Storage On Disk

TXNPGM1

Load Module
MAPPGC1 MAPPGC2 TXNPGM1 TXNPGM2

Library
MAPLIB MAPLIB PGMLIB PGMLIB

23 August 2013

CICS.ppt

26

CICS Transaction Initiation Process


CICS Region CICS Nucleus O t h e r s PCP KCP SCP TCP TRM1

PPT

PCT

TCT

LOADLIB

APPLICATION PROGRAM

TIOA
TCA

23 August 2013

CICS.ppt

27

CICS Transaction Initiation Process - Flow


Operating System System Services Terminal 2 Control Program Library

ACCT

3 Account File

Storage Manage -ment

23 August 2013

CICS.ppt

28

Introduction Summary
Whats special about CICS
Batch & Online - Differences System Services Programming concepts Task & Transaction Terminal Conversation CICS Components Control Tables and Programs CICS Program Considerations & Restrictions

Exec Interface Block


Starting a Task Initiating a Transaction
NOTE - Click on back arrow to return to the Agenda.
23 August 2013 CICS.ppt 29

Customer Information Control System


Program Preparation

Program Preparation Introduction


Preparing a Program to run in CICS Environment
Defining the Program in the CICS Region Executing the Program

23 August 2013

CICS.ppt

31

Program Preparation Preparing a Program


CICS requires the following steps to prepare a Program
Translating the Program Assemble or Compile the Translator Output & Link the Program

23 August 2013

CICS.ppt

32

Program Preparation

Source Program

Translate

Translated Source

Translator Listing

Compile

Compiler Listing

Load Module

Link Edit

Object Module

23 August 2013

CICS.ppt

33

Program Preparation Translation


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
23 August 2013 CICS.ppt 34

Program Preparation 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, ...

23 August 2013

CICS.ppt

35

Program Preparation Compiling 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

23 August 2013

CICS.ppt

36

Program Preparation Defining the Program


The Application should be defined and Installed into the PPT
This can be done either by using CEDA Trans. or DFHPPT

23 August 2013

CICS.ppt

37

Program Preparation Program Execution


Register the transaction in PCT
Sign-on to CICS Enter transaction identifier

23 August 2013

CICS.ppt

38

Program Preparation Summary


Preparing a Program
Translation Compilation

Defining a Program
Executing a Program

NOTE - Click on back arrow to return to the Agenda.


23 August 2013 CICS.ppt 39

CICS Supplied Transactions

CESN/CESF CEBR CECI CEMT CEDA CEDF

CICS sign on & CICS sign off Temporary Storage Browse CICS Command Level Interprets Master Terminal Transaction Resource Definition Online Execution Diagnostic Facility

23 August 2013

CICS.ppt

40

Customer Information Control System


Program Control

Program Control
CICS

Level 0 Level 1

PROG A LINK RETURN

Level 2
PROG B XCTL

PROG C LINK RETURN

Level 3 Application Program Logic Levels


23 August 2013 CICS.ppt

PROG D XCTL

PROG E RETURN
42

Program Control 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

23 August 2013

CICS.ppt

43

Program Control LINK Syntax :


EXEC CICS LINK
PROGRAM(name) [COMMAREA(data-area)

[LENGTH(data-value)]]
END-EXEC

Conditions : PGMIDERR, NOTAUTH, LENGERR

23 August 2013

CICS.ppt

44

Program Control 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

23 August 2013

CICS.ppt

45

Program Control XCTL Syntax :


EXEC CICS XCTL PROGRAM(name) [COMMAREA(data-area) [LENGTH(data-value)]] END-EXEC

Conditions : PGMIDERR, NOTAUTH, LENGERR

23 August 2013

CICS.ppt

46

Program Control 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

23 August 2013

CICS.ppt

47

Program Control RETURN Syntax :


EXEC CICS RETURN
[TRANSID(name) [COMMAREA(data-area)

[LENGTH(data-value)]]]
END-EXEC

Conditions : INVREQ, LENGERR

23 August 2013

CICS.ppt

48

Program Control COBOL CALL Statement


Invokes a program on a local system CALL statement more efficient in some situations. If called program contains CICS, pass the EIB and Communication area

Example (Invoking a program that uses CICS)


CALL PGM1 USING DFHEIBLK DFHCOMMAREA

INVOICE-NUMBER

23 August 2013

CICS.ppt

49

Program Control Storage Control


Storages sources COMMAREA COMMON WORK AREA (CWA) TRANSACTION WORK AREA (TWA) Dynamic Storage Allocation and De-allocation GETMAIN

FREEMAIN

23 August 2013

CICS.ppt

50

Program Control 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
23 August 2013 CICS.ppt 51

Program Control GETMAIN Command


EXEC CICS
GETMAIN SET (pointer) LENGTH(data-value) | FLENGTH (data-value)]

[CICSDATAKEY | USERDATAKEY]
[SHARED | INITIMG] END-EXEC

23 August 2013

CICS.ppt

52

Program Control FREEMAIN Command


EXEC CICS
FREEMAIN DATA(data-area)

DATAPOINTER(pointer)
END-EXEC

23 August 2013

CICS.ppt

53

Program Control Summary


LINK XCTL RETURN COBOL CALL STORAGE CONTROL COMMAREA GETMAIN FREEMAIN

NOTE - Click on back arrow to return to the Agenda. 23 August 2013 CICS.ppt 54

Customer Information Control System


Basic Mapping Support

Basic Mapping Support Introduction 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

23 August 2013

CICS.ppt

56

Basic Mapping Support Introduction 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

23 August 2013

CICS.ppt

57

Basic Mapping Support BMS Sample Screen

Constant field(protected)

Data Entry Field(Unprotected)


ITEM-NO
NAME

:
:

XXXXXXXX
XXXXXXXXXX Message field

Auto skip field Stopper field

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX F1 = Help
23 August 2013

F3=Exit

F12=Cancel
CICS.ppt 58

Basic Mapping Support Func Key Assignment Guidelines


Key
F1 F3 F7 F8 F12 Clear F2, F4, F5, F6 F9, F10, F11
23 August 2013 CICS.ppt 59

Assignment
Help Exit Backward / Prev Forward / Next Cancel Erase any data on the screen Unassigned (for program specific needs)

Basic Mapping Support Field Types


Display-only Field Data Entry Field

Field Attributes
Protection
Unprotected / Protected / Auto-Skip Shift

Alphanumeric / Numeric
Intensity Normal / Bright / Dark (No-display)
23 August 2013 CICS.ppt 60

Basic Mapping Support Attribute Byte Contents


Bit Position Functions Protection & Shift Bit Settings

01
23

Depends on 2 7 contents
00 Unprotected alphanumeric 01 Unprotected Numeric 10 Protected 11 Protected skip

45

Intensity

00 Normal (Also 01) 10 Bright

11 Dark (No-display)
6 7
23 August 2013

MDT
CICS.ppt

0 Field not modified 1 Field modified


61

Basic Mapping Support Extended Attributes


Type of Attribute
Extended color

Options
Blue, Red, Pink, Green, Turquoise, Yellow, Neutral

Extended highlighting

Blinking, Reverse Video, Underline

Validation

Must enter, Must fill, Trigger

23 August 2013

CICS.ppt

62

Basic Mapping Support Physical Maps


Physical Map is a map used by CICS ( CSECT)
Ensure device independence in the application program

Symbolic Maps
Symbolic Map is a map used by Application Program (DSECT) Ensure device and format independence in the application program
23 August 2013 CICS.ppt 63

Basic Mapping Support Physical & Symbolic Map Logic Flow


BMS source

Assembler
Physical MAP Symbolic MAP Linkage editor

Load module (MVS)


23 August 2013 CICS.ppt 64

Basic Mapping Support Map & 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
23 August 2013 CICS.ppt 65

Basic Mapping Support Macros used in BMS


PRINT NOGEN
END DFHMSD

DFHMDI
DFHMDF DFHMSD TYPE = FINAL

23 August 2013

CICS.ppt

66

Basic Mapping Support DFHMSD


name DFHMSD TYPE={&SYSPARM | DSECT | MAP}, LANG={COBOL | ASM | PLI | C | C++}, MODE={IN | OUT | INOUT} TERM=terminal-type, CTRL=(option, option.), STORAGE=AUTO, MAPATTS=(COLOR, HILIGHT), DSATTS=(COLOR,HILIGHT), X X X X X X X X

TIOAPFX={YES | NO}
DFHMSD
23 August 2013

TYPE=FINAL
CICS.ppt 67

Basic Mapping Support DFHMDI Macro


name DFHMDI SIZE=(line,col), LINE=line-number, COLUMN=col-number, X X X

CTRL=(option,option,) X JUSTIFY=LEFT/RIGHT

23 August 2013

CICS.ppt

68

Basic Mapping Support DFHMDF Macro


name DFHMDF POS(line,col), INITIAL=xxxxxxxx, LENGTH=field-length ATTRB=(intensity,prot,NUM,FSET,IC), COLOR=color, JUSTIFY=RIGHT, PICIN=picture-string, PICOUT=picture-string, X X X X X X X X

GRPNAME=data-name

23 August 2013

CICS.ppt

69

Basic Mapping Support Modified 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

23 August 2013

CICS.ppt

70

Basic Mapping Support Sample Macro


TULMAP 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
23 August 2013 CICS.ppt 71

Basic Mapping Support Symbolic Map - Example


01 EMPRECI.

02 FILLER
02 EMPNAL 02 EMPNAF

PIC X(12).
PIC S9(4) COMP. PIC X.

02 FILLER REDEFINES EMPNAF. 03 EMPNAA PIC X. 02 EMPNAI PIC X(21).

01 EMPRECO REDEFINES EMPRECI.


02 FILLER 02 FILLER 02 EMPNAO
23 August 2013

PIC X(12). PIC X(03). PIC X(21).


CICS.ppt 72

Basic Mapping Support Cursor Positioning Techniques


Static positioning (map definition)
Dynamic/Symbolic Positioning (App. Pgm) Dynamic/Relative Positioning (App. Pgm)

23 August 2013

CICS.ppt

73

Basic Mapping Support SEND MAP


Writes formatted output to a terminal

EXEC CICS SEND MAP(mapname)


[[ FROM(dataname) ] [DATAONLY] | MAPONLY] [ MAPSET(mapsetname) ] [ CURSOR(VALUE) ] [ FREEKB ] [ ERASE ] [ FRSET ]

[DATA | MAP ONLY]


[ RESP (dataname) ] ] END-EXEC Handle Conditions : INVREQ,LENGERR,NOTALLOC
23 August 2013 CICS.ppt 74

Basic Mapping Support Receive Map


To receive input from a terminal

EXEC CICS RECEIVE MAP (mapname)


[ SET(pointer) | INTO(dataname) ] [LENGTH(msg-len)]

[ MAPSET(mapsetname) ]
[ RESP() ] ] END-EXEC

Handle Conditions:
EODS, INVMPSZ, INVREQ, MAPFAIL

23 August 2013

CICS.ppt

75

Basic Mapping Support Detecting Cursor Positioning


Direct Cursor Positioning Techniques
Symbolic Cursor Positioning

23 August 2013

CICS.ppt

76

Basic Mapping Support AID 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 key 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
23 August 2013

Conditions : INVREQ
CICS.ppt 77

CICS Transaction Flow (Send Map)


Operating System Program Library

Menu Screen

File
Control

Account File

Program ACCT00 BMS


23 August 2013 CICS.ppt 78

CICS Transaction Flow (Receive & Send Map)


Operating System Users Next input File Control Account File Program Library

6 8 BMS
23 August 2013

Program ACCT01

CICS.ppt

79

Basic Mapping Support Summary


Introduction to BMS Guidelines to Function Key Assignment Field Types and Attributes Physical & Symbolic Maps BMS Macros Modified Data Tag Cursor Positioning Send & Receive Map

AID Keys

NOTE - Click on back arrow to return to the Agenda. 23 August 2013 CICS.ppt 80

Customer Information Control System


Error & Exceptional Handling

Error & Exception Handling Handling Methods


When the exceptional condition occurs, the application can

Take no action & let the program continue Control returns to the next inst. following the command A return code is set in EIBRESP and EIBRCODE

Occurs because of NO HANDLE /RESP/IGNORE


Pass control to a specified label Control goes to a label defined earlier by a HANDLE CONDITION

Rely on the system default action


System will terminate or suspend the task depends on the exceptional condition occurred

23 August 2013

CICS.ppt

82

Error & Exception Handling HANDLE 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
23 August 2013 CICS.ppt 83

Error & Exception Handling IGNORE 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
23 August 2013 CICS.ppt 84

Error & Exception Handling NOHANDLE Letting the program continue


NOHANDLE option with any command specifies that no action be taken for any exception conditions resulting from the execution of that command
Example: EXEC CICS SEND FROM (WS-DATA) LENGTH(WS-LENGTH) NOHANDLE END-EXEC.

23 August 2013

CICS.ppt

85

Error & Exception Handling RESP option Let the program continue
Command response available in EIBRESP Made available in RESP option for each command Better structured code than HANDLE condition Implies NOHANDLE option whenever used
WORKING STORAGE SECTION. 77 WS-ERR-CODE PIC S9(8) COMP. PROCEDURE DIVISION. EXEC CICS RECEIVE INTO (WS-INPUT) LENGTH(WS-LENGTH) RESP(WSERR-CODE) END-EXEC. IF WS-ERR-CODE = DFHRESP(LENGERR) IF WS-ERR-CODE = DFHRESP(NORMAL)

23 August 2013

CICS.ppt

86

Error & Exception Handling PUSH & 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

23 August 2013

CICS.ppt

87

Error & Exception Handling PUSH & POP


HANDLE CONDITION and IGNORE CONDITION will remain in effect until program ends PUSH AND POP commands are used to suspend and reactivate all the HANDLE CONDITION requests.
EXEC CICS HANDLE CONDITION LENGRER(LENG-ERR-PARA) END-EXEC EXEC CICS RECEIVE INTO(WS-INPUT) LENGTH(WS-LENGTH) END-EXEC PARA-A. EXEC CICS PUSH HANDLE END-EXEC EXEC CICS HANDLE CONDITION LENGERR(LENG-ERR-PARA-2) END-EXEC EXEC CICS RECEIVE INTO(WS-INPUT) LENGTHWS-LENGTH) END-EXEC EXEC CICS POP HANDLE END-EXEC.

PERFORM PARA-A EXEC CICS SEND FROM(WS-OUTPUT) LENGTH(WS-LENGTH) END-EXEC

23 August 2013

CICS.ppt

88

Error & Exception Handling System Default Action


CICS checks possible default exceptions after each CICS command If exceptional conditions are not taken care of, CICS by default, may SUSPEND the task or abnormally terminate the execution Issuing an ABEND CODE

23 August 2013

CICS.ppt

89

Error & Exception Handling HANDLE ABEND Command


EXEC CICS HANDLE ABEND
[PROGRAM(name) | LABEL(label) | CANCEL | RESET] END-EXEC

23 August 2013

CICS.ppt

90

Error & Exception Handling ABEND Command


EXEC CICS ABEND
[ABCODE(name)] END-EXEC E.g. EXEC CICS ABEND ABCODE(ERR1)

END-EXEC

23 August 2013

CICS.ppt

91

Error & Exception Handling Summary


HANDLE Command IGNORE Command NOHANDLE Command RESP Option PUSH & POP HANDLE ABEND ABEND Command

NOTE - Click on back arrow to return to the Agenda. 23 August 2013 CICS.ppt 92

Customer Information Control System


File Handling

File Handling
Supports VSAM Files to be defined to CICS as resources File opening, Closing done by CICS

In Addition, CICS Provides


Exclusive Control (Record Level Locking).
Data Independence Journaling

Opening and closing Files

23 August 2013

CICS.ppt

94

File Handling Defining Files


In CICS, Files Cannot be Created, Files can be created using IDCAMS Utility
Re-indexing, Creating new indexes, etc. should be done using IDCAMS Only

23 August 2013

CICS.ppt

95

File Handling 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

23 August 2013

CICS.ppt

96

File Handling File Handling in Program


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

23 August 2013

CICS.ppt

97

File Handling File Access Methods


VSAM is the primary data access method of CICS
VSAM file types supported

KSDS
ESDS RRDS

23 August 2013

CICS.ppt

98

File Handling Record Identification


Record Key
Partial Key Relative Byte Address (RBA)

Relative Record Number (RRN)

23 August 2013

CICS.ppt

99

File Handling VSAM File Access


Random
Read
Update Delete Write

Sequential
Start Browse Read Next

Read Previous
End Browsing Reset Browse
23 August 2013 CICS.ppt 100

File Handling READ Command


EXEC CICS
READ FILE (file-name) INTO(rec-area)

RIDFLD(key-value)
[RBA|RRN] [UPDATE] END-EXEC

23 August 2013

CICS.ppt

101

File Handling READ Command GENERIC option


EXEC CICS
READ FILE (file-name) INTO(rec-area) RIDFLD(key-value) GENERIC KEYLENGTH (dataname | literal) [GTEQ | EQUAL]

[UPDATE]
END-EXEC

23 August 2013

CICS.ppt

102

File Handling READ File - Example


WORKING-STORAGE SECTION. 77 WS-REC-LEN PIC S9(4) COMP. 77 WS-FILE-NAME PIC X(8) VALUE ACCTMSTR 01 WS-FILE-REC. 05 WS-REC-KEY PIC X(6). 05 WS-REC-DATA PIC X(34). PROCEDURE DIVISION. MOVE 40 TO WS-REC-LEN. MOVE ABC451 TO WS-REC-KEY. EXEC CICS READ DATASET(WS-FILE-NAME) INTO (WS-FILE-REC) RIDFLD(WS-REC-KEY) LENGTH(WS-REC-LEN) END-EXEC.
CICS.ppt

23 August 2013

103

File Handling WRITE Command


EXEC CICS WRITE FILE(file-name) FROM(file-rec) RIDFLD(rec-key) [RBA|RRN] END-EXEC

23 August 2013

CICS.ppt

104

File Handling MASSINSERT - Example


PERFORM 3300-WRITE-LINE-ITEM-RECORD VARYING LINE-ITEM-SUB FROM 1 BY1 UNTIL LINE-ITEM-SUB > LINE-ITEM-COUNT. EXEC CICS UNLOCK FILE(CUSTINV) END-EXEC. 3300-WRITE-LINE-ITEM-RECORD. MOVE LINE-ITEM-DATA(LINE-ITEM-SUB) TO LINE-ITEM-RECORD EXEC CICS WRITE FILE(CUSTINV) FROM (LINE-ITEM-RECORD) RIDFLD(LI-RECORD-KEY) MASSINSERT END-EXEC.
23 August 2013 CICS.ppt 105

File Handling REWRITE Command


EXEC CICS REWRITE FILE (file-name) FROM(data-area) END-EXEC

23 August 2013

CICS.ppt

106

File Handling DELETE Command


EXEC CICS DELETE FILE (file-name) [RIDFLD(rec-key)] [RBA|RRN] END-EXEC

23 August 2013

CICS.ppt

107

File Handling DELETE Command GENERIC option


EXEC CICS DELETE

FILE (file-name)
[RIDFLD(rec-key)]

GENERIC KEYLENGTH (dataname | literal) [GTEQ | EQUAL] [NUMREC (data-name)]


END-EXEC

23 August 2013

CICS.ppt

108

File Handling UNLOCK Command


EXEC CICS UNLOCK FILE (file-name) END-EXEC

23 August 2013

CICS.ppt

109

File Handling Sequential Access


The sequential processing in CICS is called Browsing
STARTBR

Browse Commands

READNEXT
READPREV ENDBR

RESETBR

23 August 2013

CICS.ppt

110

File Handling Sequential Access STARTBR Command


EXEC CICS STARTBR
FILE (filename) RIDFLD (data-name)

[RRN | RBA]
[GTEQ | EQUAL] [GENERIC]

[KEYLENGTH (dataname | literal]


END-EXEC
23 August 2013 CICS.ppt 111

File Handling Sequential Access READPREV/READNEXT


EXEC CICS
[READNEXT | READPREV] FILE (filename) RIDFLD (dataname) [RRN | RBA] [KEYLENGTH(dataname | literal)]

END-EXEC

23 August 2013

CICS.ppt

112

File Handling Sequential Access ENDBR command


EXEC CICS
ENDBR FILE (filename) END-EXEC

23 August 2013

CICS.ppt

113

File Handling Sequential Access RESETBR command


EXEC CICS RESETBR
FILE (filename) RIDFLD (data-name) [RRN | RBA] [GTEQ | EQUAL] [GENERIC]

[KEYLENGTH (dataname | literal]


END-EXEC
23 August 2013 CICS.ppt 114

File Handling BROWSE - Example


MOVE VALUE TO KEY-REC. EXEC CICS STARTBR FILE(FILEA) RIDFLD(RECKEY) RESP(ERR-CODE) END-EXEC. IF ERR-CODE = DFHRESP(NORMAL) PERFORM UNTIL ERR-CODE = DFHRESP(ENDFILE). PERFORM 2000-REC-FROM-FILE UNTIL 2000-REC-FROMFIL-EXIT EXEC CICS READNEXT FILE(FILEA) INTO(FILERECA) RIDFLD(RECKEY) RESP(ERR-CODE) END-EXEC END-PERFORM EXEC CICS ENDBR FILE(FILEA) ELSE PERFORM 9000-HANDLE-ERROR END-IF.
23 August 2013 CICS.ppt 115

File Handling General Exceptions


The following Exceptions usually will occur and must be handled.
NOTFND, NOTAUTH, NOSPACE,
LENGERR,

LENGERR, FILENOTFND, INVREQ,


NOTAUTH,

DISABLED, NOTOPEN, ILLOGIC


DUPREC

23 August 2013

CICS.ppt

116

File Handling Summary


Defining Files READ Command WRITE Command MASSINSERT

REWRITE Command
DELETE Command UNLOCK Command Browse Commands General Exceptions

NOTE - Click on back arrow to return to the Agenda. 23 August 2013 CICS.ppt 117

Customer Information Control System


Queues

Queues Transient Data Queue


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

Allows only sequential access


Read Destructive (Updates not allowed) Variable length record supported TDQs require a DCT entry Identified by Destination id - 1 to 4 bytes
23 August 2013 CICS.ppt 119

Queues Transient Data Queue - Types


INTRAPARTITION TDQ
EXTRAPARTITION TDQ

23 August 2013

CICS.ppt

120

Queues Intrapartition TDQ


All queues share the same ESDS
Trigger levels can be specified for Automatic Task Initiation. TDQ is associated with a transaction Queue can be specified as
Logically or physically recoverable

Not recoverable

23 August 2013

CICS.ppt

121

Queues Intrapartition TDQ DCT Entry


DFHDCT TYPE = INTRA,
DESTID = queue-name, [TRANSID = txn-id-name,]

[TRIGLEV = number,]
[REUSE = YES|NO]

23 August 2013

CICS.ppt

122

Queues Extrapartition TDQ


Each destination is a physical data set
Destination can be input or output (not both) Automatic task Initiation not supported

23 August 2013

CICS.ppt

123

Queues Extrapartition TDQ DCT Entry


DFHDCT TYPE = EXTRA
DESTID = queue_name DSCNAME = name,

[OPEN = INITIAL|DEFERRED]
DFHDCT TYPE=SDSCI, DSCNAME = name, TYPEFIL = INPUT|OUTPUT|RDBACK

23 August 2013

CICS.ppt

124

Queues TDQ Commands


WRITEQ TD EXEC CICS WRITEQ TD QUEUE(queue-name) FROM(queue-data) LENGTH(queue-length) END-EXEC READQ TD EXEC CICS READQ TD QUEUE(queue-name) INTO(queue-data) LENGTH(queue-length) END-EXEC DELETEQ TD EXEC CICS DELETEQ TD QUEUE(queue-name) END-EXEC
23 August 2013 CICS.ppt 125

Queues Temporary Storage Queue


Application can use the TSQ like a scratch pad to store data temporarily 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
23 August 2013 CICS.ppt 126

Queues Temporary Storage Queue (Cont)


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

23 August 2013

CICS.ppt

127

Queues TSQ WRITEQ Command


EXEC CICS

WRITEQ TS {QUEUE | QNAME} (queue-name)


FROM (dataname) [item(dataname) REWRITE] [NUMITEMS (dataname)] [MAIN | AUXILLARY] END-EXEC.

23 August 2013

CICS.ppt

128

Queues TSQ READQ Command


EXEC CICS

READQ TS {QUEUE | QNAME} (queue-name)


INTO(dataname) [item(dataname | literal) | NEXT] [NUMITEMS (dataname)] END-EXEC.

23 August 2013

CICS.ppt

129

Queues TSQ DELETEQ Command


EXEC CICS
DELETEQ TS {QUEUE | QNAME} (queue-name) END-EXEC.

23 August 2013

CICS.ppt

130

Queues TSQ Typical uses


Data passing among transactions
Terminal Paging Report printing

23 August 2013

CICS.ppt

131

Queues General Exceptions


ITEMERR
LENGTHERR QIDERR QZERO QBUSY NOSPACE

NOTOPEN

23 August 2013

CICS.ppt

132

Queues Summary
Transient Data Queues Intrapartition Extrapartition

TDQ Commands

Temporary Storage Queue


TSQ Commands TSQ Typical Uses General Exceptions

NOTE - Click on back arrow to return to the Agenda. 23 August 2013 CICS.ppt 133

Customer Information Control System


Interval & Task Control

Interval & Task Control


ASK TIME

- Used to obtain current date & time

FORMAT TIME
DELAY POST WAIT START

- Formats the time


- The task is suspended for specified interval - Request notification when the specified time has expired - Wait for an event to occur - Starts a transaction (a time can be specified)

23 August 2013

CICS.ppt

135

Interval & Task Control


RETRIEVE CANCEL

- Retrieves the data passed by START - Used to cancel the interval control requests e.g. DELAY, POST & START

SUSPEND ENQ

- Suspends task to execute high priority task - Gain exclusive control over a resource

DEQ

- To free the exclusive control from


the resource gained by ENQ

23 August 2013

CICS.ppt

136

Interval & Task Control ASKTIME Command


EXEC CICS ASKTIME [ABSTIME(data-name)] END-EXEC

ABSTIME specifies a 15 digit packed-decimal field

23 August 2013

CICS.ppt

137

Interval & Task Control FORMATTIME Command


EXEC CICS

FORMATTIME ABSTIME(data-name)
[DATE (data-name) ] [FULLDATE (data-name) ] [MMDDYYYY (data-name) ]

[DDMMYYYY (data-name) ]
[YYYYMMDD (data-name) ] [YYYYDDMM (data-name) ] [YYYYDDD (data-name) ]

[DATESEP(data-name) | literal)]
[DATEFORM (data-name) ] [TIME (data-name) [TIMESEP [(data-name | literal) ] ] ] END-EXEC
23 August 2013 CICS.ppt 138

Interval & Task Control Example


WORKING-STORAGE SECTION. 01 DATE-AND-TIME-FIELD.

05 ABSOLUTE-TIME
PROCUDURE DIVISION. : EXEC CICS

PIC S9(15) COMP-3.

ASKTIME ABSTIME(ABSOLUTE-TIME) END-EXEC. EXEC CICS FORMATTIME ABSTIME(ABSOLUTE-TIME) DDMMYYYY(WS-FULL-DATE) DATESEP END-EXEC.
23 August 2013 CICS.ppt 139

Interval & Task Control Summary


Interval & Task Control Commands ASKTIME Command FORMATTIME Command

NOTE - Click on back arrow to return to the Agenda. 23 August 2013 CICS.ppt 140

Customer Information Control System


Communication with Databases

Communication with Databases 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

23 August 2013

CICS.ppt

142

Communication with Databases DB2 Database access by CICS


Operating system

CICS REGION
App. Pgm. EXEC SQL..

DB2

REGION

CICS Attachment Facility

DB2 Database
23 August 2013 CICS.ppt 143

Communication with Databases DB2 Precompiler


Source Program (EXEC SQL...

|
|

EXEC CICS...)

DB2 Precompiler CICS command translator | Compile By COBOL |

Linkedit by Linkage editor


| Load Module
23 August 2013 CICS.ppt 144

Communication with Databases Summary

CICS DB2
DB2 Precompilation

NOTE - Click on back arrow to return to the Agenda. 23 August 2013 CICS.ppt 145

Customer Information Control System


Recovery & Restart

Recovery & Restart 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, eliminate the damage done to the online system, in case of the above failures to maintain the system & data integrity
CICS.ppt 147

23 August 2013

Recovery & Restart 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

23 August 2013

CICS.ppt

148

Recovery & Restart Restart


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)
23 August 2013 CICS.ppt 149

Recovery & Restart 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- 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
23 August 2013 CICS.ppt 150

Recovery & Restart LUW & Sync Point


|- - - - - - - - - - - - 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
23 August 2013 CICS.ppt 151

Recovery & Restart Summary


Need for Recovery & Restart Recovery Restart LUW & Syncpoint

NOTE - Click on back arrow to return to the Agenda. 23 August 2013 CICS.ppt 152

Customer Information Control System


If you have questions, consult the following in order: Local SME, Regional SME

EDS is a registered mark and the EDS logo is a trademark of Electronic Data Systems Corporation. EDS is an equal opportunity employer and values the diversity of its people. Copyright 2002, Electronic Data Systems. All rights reserved.

You might also like