Sei sulla pagina 1di 35

CICS DAY II

Accumulating Text

Used to accumulate the text in to buffer. exec cics send text from(var) accum end-exec. exec cics send text from(var1) end-exec. exec cics send page end-exec.

Program (send text with accum)

77 T1 PIC X(20) VALUE WELCOME. 77 T2 PIC X(20) VALUE TO MAPLES. PROCEDURE DIVISION. MAINPARA. EXEC CICS SEND TEXT FROM(T1) ERASE ACCUM END-EXEC. EXEC CICS SEND TEXT FROM(T2) ACCUM END-EXEC. EXEC CICS SEND PAGE END-EXEC.

HEADER

Specifies a data area that contains the text to be placed at the beginning of each page of text data.

TRAILER

Specifies a data area that contains the text to be placed at the bottom of each page of text data.

Header and trailer

Heading Body of the text Footer

Header From trailer

Header Declaration

01 heading. 02 head-len pic s9(4) comp. 02 page-sym pic x value &. 02 f pic x. 02 head-text pic x(79) value Welcome to Renault Page-&. 01 msgtext pic x(79).

Syntax for send text with accum

Exec cics send text Header(heading) From(msgtext) Erase Accum End-exec. Exec cics send page Trailer End-exec.

ABEND codes while executing header and trailer

ABMA , ABM9 Improper header and trailer AEIV Length error

Handling AID keys

Two ways of handling AID keys. Through CICS statement (Handleaid) is handled after the receive statement. Through COBOL statement (EIBAID) is handled before the receive statement.

EIBAID (Execute Interface Block Attention Identifier Keys)

CICS control block CICS translator generates, in the Linkage Section, field named DFHEIBLK, the Execute Interface Block (EIB). There is one EIB for each task, and it exists for the duration of the task.

DFHEIBLK

01 DFHEIBLK. 02 EIBTIME PIC S9(7) COMP-3. 02 EIBDATE PIC S9(7) COMP-3. 02 EIBTRNID PIC X(4). 02 EIBTASKN PIC S9(7) COMP-3. 02 EIBTRMID PIC X(4). 02 EIBCPOSN PIC S9(4) COMP. 02 EIBCALEN PIC S9(4) COMP. 02 EIBAID PIC X. .... .....

EIBAID

EIBAID The attention identifier (AID), tells you which keyboard key was used to transmit the last input. This field is one byte long ("PIC X(1)").

EIBCALEN

EIBCALEN The length of the communication area (COMMAREA) that has been passed to this program, either from a program that invoked it using a CICS command, or from a previous transaction in a pseudoconversational sequence. It is in halfword binary form (PIC S9(8) COMP).

EIBPOSN

EIBCPOSN The position of the cursor at the time of the last input command, for 3270-like devices only. This position is expressed as a single number relative to position zero on the screen (row 1,column 1), in the same way that you specify the CURSOR parameter on a SEND MAP command. It is also in halfword binary form ("PIC S9(4) COMP"). After a RECEIVE MAP command, your program can find the inbound cursor position by inspecting the value held in EIBCPOSN. Identifier of the current task, four characters long ("PIC X(4)").

EIBDATE

EIBDATE The date on which the current task started, in Julian form, with two leading zeros. The COBOL "PICTURE" for the field is "S9(7) COMP-3", and the format is: "00YYDDD+".

EIBTASKN

EIBTASKN The task number, as a sevendigit packed decimal number ("PIC S9(7) COMP-3"). CICS assigns a sequential number to each task it executes.

EIBTIME

EIBTIME The time at which the current task started, also in "PIC S9(7) COMP-3" form, with one leading zero: 0HHMMSS+".

EIBTRMID

EIBTRMID The name of the terminal associated with the task This name is four characters long, and the COBOL "PICTURE" is "X(4)".

EIBTRNID

EIBTRNID The transaction identifier of the current task, four characters long ("PIC X(4)").

EIBAID

EIBAID is one byte long and holds the actual attention identifier value used in the 3270 input stream. As it is hard to remember these values and hard to understand code containing them, it is a good idea to use symbolic rather than absolute values when testing EIBAID. CICS provides you with a precoded set which you simply copy into your program by writing: COPY DFHAID

Copy Book (DFHAID)

01 DFHAID. 02 DFHNULL PIC X VALUE IS ' '. 02 DFHENTER PIC X VALUE IS . 02 DFHCLEAR PIC X VALUE IS '_'. 02 DFHCLRP PIC X VALUE IS ' '. 02 DFHPA1 PIC X VALUE IS '%'. 02 DFHPA2 PIC X VALUE IS '>'. 02 DFHPA3 PIC X VALUE IS ','. 02 DFHPF1 PIC X VALUE IS '1'. 02 DFHPF2 PIC X VALUE IS '2'. 02 DFHPF23 PIC X VALUE IS '.'. 02 DFHPF24 PIC X VALUE IS '<'.

Using EIBAID

If eibaid = dfhpf1 perform add-para. If eibaid = dfhpf2 perform sub-para. (or) If eibaid = 1 perform add-para. If eibaid = 2 perform sub-para.

Using HANDLEAID

exec cics handle aid pf1(add-para) pf2(sub-para) anykey(error-para) end-exec.

Exception Handling in CICS

Expected CICS errors


Record not found DupKey Lengerr Map fail .

CICS commands for exception handling

To handle expected CICS errors

HANDLE CONDITION RESP


The above errors can be ignore by using

IGNORE CONDITION Or NO HANDLE

HANDLE and IGNORE condition

HANDLE CONDITION
EXEC CICS HANDLE CONDITION LENGERR (LENGTH-ERR-PARA) INVREQ (INVREQ-ERR-PARA) DUPKEY (DUPKEY-ERR-PARA) ERROR (GEN-ERR-PARA) END-EXEC.

IGNORE CONDITION
EXEC CICS IGNORE CONDITION LENGERR END-EXEC.

IDENTIFICATION DIVISION. PROGRAM-ID. SAMPLE. ENVIRONMENT DIVISION DATA DIVISION. WORKING-STORAGE SECTION. 77 VAR PIC X(79) VALUE 'ENTER 3 CHAR'. 77 EC PIC X(3). PROCEDURE DIVISION. EXEC CICS HANDLE CONDITION LENGERR(LRTN) END-EXEC. EXEC CICS SEND FROM(VAR) ERASE END-EXEC EXEC CICS SEND CONTROL ERASE END-EXEC EXEC CICS RECIEVE INTO(EC) LENGTH (LENGTH OF EC) END-EXEC MOVE 'NO EXCEP' TO VAR. EXEC CICS SEND FROM(VAR) ERASE END-EXEC EXEC CICS SEND FROM(EC) ERASE END-EXEC EXEC CICS RETURN END-EXEC STOP RUN.

NOHANDLE and HANDLE ABEND

NOHANDLE EXEC CICS RECEIVE INTO (IN-DATA-BUF) LENGTH (20) NOHANDLE END-EXEC.

RESP code handling

Structured way of handling the exception.

WORKING-STORAGE SECTION.
01 WS-RCODE PIC S9(8) COMP. --------PROCEDURE DIVISION. --------EXEC CICS RECEIVE
INTO(-----) LENGTH (-----) RESP (WS-RCODE)

END-EXEC. IF WS-RCODE = DFHRESP (LENGERR)


PERFORM LENGTH-ERROR-PARA-0100

CEDF Execution Diagnostic facility

Useful CICS commands


EXEC CICS ASKTIME [ABSTIME(data_area)] END-EXEC. EXEC CICS FORMATTIME ABSTIME(data_area) [YYDDD(data_area)] [YYMMDD(data_area)] [YYDDMM(data_area)] [DATESEP(data_value)] [TIME(data_area)] [TIMESEP(data_value)] END-EXEC.

01 ASK-TIME PIC S9(15) COMP-3.

Pseudo - conversational techniques

The most important thing is passing of data between pseudo-conversational tasks. We can pass data via a COMMAREA
Ex.WORKING-STORAGE SECTION. 01 WS-COMMAREA. 02 WS-FLAG PIC X(2). LINKAGE SECTION. 01 DFHCOMMAREA. 02 LK-FLAG PIC X(2).

DELAY

Used to DELAY the processing of a task The issuing task is suspended for a specified interval or Until the specified time Syntax: EXEC CICS DELAY INTERVAL(hhmmss) | TIME(hhmmss) END-EXEC Example: EXEC CICS DELAY INTERVAL(002015) END-EXEC. The task will be suspended for 20 mins and 15 secs. EXEC CICS DELAY TIME ( 153000) END-EXEC. The task will be suspended until 15:30:00 .

Potrebbero piacerti anche