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)
LEVEL 0 CICS Sub System
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.
XCTL does not expect control back.
●
EXEC CICS XCTL
PROGRAM(PROGRAM NAME)
COMMAREA(COMMAREA VARIABLE)
RESP(RESPONSE CODE)
END-EXEC.
6
XCTL(Transfer Control)(2/2)
PROGRAM – specifies the name of the program that needs to be
Invoked.
COMMAREA – value of the commarea that needs to be passed
RESP - response code of the XCTL command
7
Passing Data using XCTL
CICS SYSTEM
PROG000A PROG000B
WORKING STORAGE LINKAGE SECTION
WS-DATA DFHCOMMAREA
. .
PROCEDURE ... PROCEDURE ...
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
LINK PROG000C LINKAGE SECTION
COMMAREA(WS-DATA) DFHCOMMAREA
.
PROCEDURE ...
RETURN
10
LINK command (2/2)
PROGRAM – specifies the name of the program that needs to be
invoked.
COMMAREA – value of the commarea that needs to be passed
RESP - response code of the LINK command
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 : [Link]
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 :
EXEC CICS DELAY EXEC CICS DELAY
INTERVAL(001500) TIME(163000) END-EXEC.
END-EXEC.
In Example 1, Task will be suspended for 15 Minutes
In Example 2, Task will be suspended Until [Link]
17
Exception Handling
Exceptional Condition is generated when a CICS command encounters an
unusual situation
Task is abnormally terminated
An Abend code is displayed that identifies the exceptional condition
18
Handling Exceptional Conditions
Exceptions can be handled in three ways :
– Pass control to a specified label.
– Let the application continue.
– Do nothing, and rely on the system (CICS) default action.
19
HANDLE CONDITION
HANDLE CONDITION
– To pass control to a specified label
EXEC CICS HANDLE CONDITION
Condition (label)
[Condition (label)]
[ ERROR(label)]
END-EXEC.
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
To specify that no action is to be taken if a condition occurs
EXEC CICS IGNORE CONDITION
Condition
END-EXEC
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. ………..
B - Control will NOT be passed to LENG-ERR-
PARA. LENGERR condition will be ignored.
23
HANDLE CONDITION - Scope
Remains active
– Until an IGNORE Condition
– Another HANDLE CONDITION for the same error
Deactivated by NOHANDLE Option in commands
This command cannot detect the host language program’s errors
24
IGNORE CONDITION - Scope
Applies only to the program in which it is specified
Active while the program is being executed
Active until a HANDLE CONDITION command for the same condition is
encountered
25
Exception Support
HANDLE CONDITION and IGNORE CONDITION
commands will remain in effect until program ends.
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:
[Link] full word binary (PIC S9(8) COMP) in WORKING STORAGE to store the
response code.
[Link] the RESP option in the CICS command.
[Link] 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
WORKING STORAGE SECTION.
77 WS -ERR-CODE PIC S9(8) COMP.
PROCEDURE DIVISION.
EXEC C ICS RECEIVE INTO (WS-INPUT)
LENGTH (WS-LENGTH) RESP (WS-ERR-CODE)
END-EXEC.
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
ABM0 - Specified map isn’t in the mapset
AICA - Task exceeded the executiontime(task was looping)
APCT - Program could not be found
ASRB - Operating System abend CICS able to abend the
transaction and continue processing
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