CICS - XCTL & Link, Interval Control Commands, Handle and Ignore Condition
CICS - XCTL & Link, Interval Control Commands, Handle and Ignore Condition
1
Session Objectives
To Understand the logical levels in CICS operation
• LINK command
• XCTL command
• Interval Control Commands
• HANDLE & IGNORE Condition
2
Commands for Passing Program Control
A transaction (task) may use several programs in the course of
completing its work.
The programs within a task can execute at different logical levels using
the following commands
– CICS LINK
– CICS XCTL
– CICS RETURN
3
Logical Levels(1/2)
Program A
XCTL ‘Pgm B’ Program B
LEVEL 1 LINK C RETURN
RETURN
Program C
LEVEL 2 RETURN
4
Logical Levels (2/2)
The CICS Terminal control is at the highest level and
is considered to be running at logical level 0.
If a Program A calls Program B using a LINK command, Program B is expected to
return control back to Program A directly. Hence, Program B is considered to be at a
lower level than A.
If Program A calls Program B using a XCTL command, Program B returns control to
the CICS, which is the highest level, which in turn passes the control to A. Hence,
both the programs are considered to be on the same level.
5
XCTL(Transfer Control) (1/2)
●
When one program transfers control (XCTL) to another, the first program is
considered terminated, and the second program operates at the same level as
the first.
6
XCTL(Transfer Control)(2/2)
7
Passing Data using XCTL
CICS SYSTEM
PROG000A PROG000B
XCTL PROG000B
COMMAREA(WS-DATA)
RETURN
8
LINK command(1/2)
●
When one program transfers control (LINK) to another, the first
program does not terminate, and the second program operates at a
lower level.
●
During LINK, the control is returned back to the calling program.
EXEC CICS
LINK PROGRAM(program-name)
COMMAREA(comm-area)
LENGTH(length)
END-EXEC.
9
Passing Data using LINK
PROG000A
WORKING STORAGE
WS-DATA
.
PROCEDURE ... PROG000C
RETURN
10
LINK command (2/2)
11
Errors Conditions in Program Control Commands
INVREQ - TRANSID is specified on a RETURN command in a program that was
not at the highest logical level ( i.e.., a RETURN that would not terminate the
transaction by returning control to CICS )
LENGERR - The length of the data specified using the RETURN command with
length option is outside the valid range of 1 to 32763.
NOAUTH - Resource or command security check has failed
PGMIDERR - The program to which control is passed on a LINK or XCTL
command, cannot be found in the list of installed program definitions, or it is not
in the library or it has been disabled.
12
Interval Control - Commands
• ASKTIME
• FORMATTIME
• DELAY
13
ASKTIME - Syntax
• To request current date and time.
EXEC CICS
ASKTIME[ABSTIME(data_area)]
END-EXEC
14
FORMATTIME - Syntax
To select format of date and time.
EXEC CICS FORMATTIME
ABSTIME(data-area)
[YYDDD(data-area)]
[YYMMDD(data-area)]
[YYDDMM(data-area)]
[DDMMYY(data-area)]
[MMDDYY(data-area)]
[DATASEP(data-value)]
[DAYOFWEEK(data-area)]
[DAYOFMONTH(data-area)]
[MONTHOFYEAR(data-area)]
[YEAR(data-area)]
[TIME(data-area)
[TIMESEP(data-value)]]
END-EXEC.
15
FORMATTIME - Example
WORKING STORAGE SECTION. PROCEDURE DIVISION.
77 WS-ABS-DATE PIC S9(15) COMP-3
01 WS-DATE. EXEC CICS ASKTIME
05 WS-D-MM PIC 99. ABSTIME(WS-ABS-DATE)
05 FILLER PIC X. END-EXEC.
05 WS-D-DD PIC 99.
05 FILLER PIC X. EXEC CICS FORMATTIME
05 WS-D-YY PIC 99. ABSTIME(WS-ABS-DATE)
01 WS-TIME. MMDDYY(WS-DATE)
05 WS-T-HH PIC 99. DATESEP(‘-’)
05 FILLER PIC X. TIME(WS-TIME)
05 WS-T-MM PIC 99. TIMESEP(:)
05 FILLER PIC X. END-EXEC.
05 WS-T-SS PIC 99. Result :
WS-DATE : 08-28-97
WS-TIME : 12:23:37
16
DELAY Command
• To delay a task for the specified time interval or until the specific time
EXEC CICS DELAY
INTERVAL(data-value) | TIME (data-value)
END-EXEC
Example 1: Example 2 :
17
Exception Handling
Exceptional Condition is generated when a CICS command encounters an
unusual situation
18
Handling Exceptional Conditions
19
HANDLE CONDITION
HANDLE CONDITION
– To pass control to a specified label
20
HANDLE CONDITION : Example
PROCEDURE DIVISION.
EXEC CICS HANDLE CONDITION
LENGERR (LENG-ERR-PARA)
ERROR(GEN-ERR-PARA)
END-EXEC.
MOVE 40 TO WS-LENGTH.
EXEC CICS RECEIVE
INTO (WS-INPUT)
LENGTH (WS-LENGTH)
END-EXEC.
LENG-ERR-PARA..
...
GEN-ERR-PARA.
...
21
IGNORE CONDITION
22
IGNORE CONDITION - Example
PROCEDURE DIVISION. EXEC CICS IGNORE CONDITION
LENGERR
EXEC CICS HANDLE CONDITION
LENGERR (LENG-ERR-PARA) END-EXEC.
ERROR(GEN-ERR-PARA)
INVREQ( INV-REQ - PARA) MOVE 40 TO WS-LENGTH.
END-EXEC.
B
MOVE 40 TO WS-LENGTH. EXEC CICS RECEIVE
INTO (WS-INPUT)
EXEC CICS RECEIVE LENGTH (WS-LENGTH)
INTO (WS-INPUT) A END-EXEC.
LENGTH (WS-LENGTH)
END-EXEC.
LENG-ERR-PARA.
A - Control will be passed to LENG-ERR-PARA. ………..
23
HANDLE CONDITION - Scope
Remains active
24
IGNORE CONDITION - Scope
Applies only to the program in which it is specified
25
Exception Support
26
NOHANDLE Option
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.
27
RESP Option
CICS makes it easy to test the response value in EIBRESP by supplying a built-in
function called DFHRESP.
The RESP option can be specified in any CICS command, CICS places a response
code at the completion of the command. The application program can check this
code and proceed to the next statement.
When RESP is used in a command, the NOHANDLE option is applied to this
command. Therefore, the HANDLE CONDITION command will have no effect in this
case.
28
Steps to Use RESP Option
Following procedures should be followed to utilize the RESP option:
1.Define full word binary (PIC S9(8) COMP) in WORKING STORAGE to store the
response code.
3.After the command execution, check the response code in the response field with
DFHRESP(XXXX) where XXXX is the symbolic name for the exceptional conditions.
29
RESP Option Example
Better structured code than HANDLE condition
Command response available in EIBRESP
Implies NOHANDLE option wherever used
IF WS-ERR-CODE = DFHRESP(LENGERR)
...
IF WS-ERR-CODE = DFHRESP(NORMAL)
30
Common CICS Abend Codes
ABMB - Cursor positioning beyond the limit of O/P device
31
Session Summary
• Logical levels in CICS operation
• Passing data using LINK & XCTL
• RETURN command
• Interval Control Commands
• Exceptional Condition Abend
- HANDLE & IGNORE CONDITION and their scope
- NOHANDLE Option
- RESP option
32
THANK YOU
33