Вы находитесь на странице: 1из 47

Chapter 8

Additional CICS commands and programming techniques

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 1

Objectives
1. Use the symbolic cursor positioning technique to control the position of the cursor when you issue a SEND MAP command. 2. Code appropriate MOVE statements to change standard and extended field attributes. 3. Explain the techniques used to optimize the transmission of data from a CICS program to a terminal using the SEND MAP command. 4. Code appropriate INSPECT statements to add and remove underscore characters from a symbolic map. 5. Given editing requirements for the fields in a symbolic map, code an appropriate edit procedure to detect and indicate each possible error. 6. Use the SEND TEXT command to display a short message on the terminal.

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 2

Objectives (continued)
7. Identify the contents of the following Execute Interface Block fields: EIBAID EIBRESP EIBCALEN EIBRESP2 EIBCPOSN EIBRSRCE EIBDATE EIBTIME EIBDS EIBTRMID EIBFN EIBTRNID 8. Code the CICS commands necessary to access the Common Work Area. 9. Code the CICS commands necessary to retrieve the current date and time and to format the values appropriately for the application.

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 3

How to use the IC option in the DFHMDF macro for a field to control cursor positioning
CUSTNO DFHMDF POS=(2,26), LENGTH=6, ATTRB=(NORM,UNPROT, IC), COLOR=TURQUOISE, INITIAL='______' X X X X

When you issue a SEND MAP command, CICS positions the cursor in the field defined with the IC (initial cursor) attribute. If you specify IC for more than one map field, CICS positions the cursor in the last one on the screen.

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 4

How to use direct cursor positioning


EXEC CICS SEND MAP('MNTMAP1') MAPSET('MNTSET1') FROM(MNTMAP1O) CURSOR(346) END-EXEC.

The CURSOR value specifies a screen position that represents a displacement from the start of the screen. To calculate the displacement for a screen position, use this formula:
(Row-number 1) x 80 + (Column-number 1) = Displacement

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 5

How to use symbolic cursor positioning


MOVE 1 TO CUSTNO1L. EXEC CICS SEND MAP('MNTMAP1') MAPSET('MNTSET1') FROM(MNTMAP1O) CURSOR END-EXEC.

When you issue the SEND MAP command with a CURSOR option that has no displacement value, CICS positions the cursor in the field whose length field (suffix L) in the symbolic map has a value of -1. If you move -1 to more than one length field, CICS positions the cursor in the first one on the screen.

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 6

How screen attributes are modified


If an attribute field is Set to anything other than Low-Value Set to Low-Value And this SEND MAP option is used The screen attribute is MAPONLY DATAONLY None MAPONLY DATAONLY None Unchanged MAPONLY DATAONLY None Changed to physical map settings Changed to new symbolic map settings Changed to new symbolic map settings Changed to physical map settings Unchanged (the terminal settings remain in effect) Changed to physical map settings Changed to physical map settings Unchanged (the terminal settings remain in effect) Changed to physical map settings

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 7

Data name suffixes for attribute fields in the symbolic map


Suffix A Usage A one-character field that contains the attribute byte for output operations. Occupies the same storage location as the F (flag) field. A one-character field that contains the attribute for extended color. Generated only if DSATTS=COLOR is specified in the mapset. A one-character field that contains the attribute for extended highlighting. Generated only if DSATTS=HILIGHT is specified in the mapset. Example CUSTNOA

MSGC

INVNOH

Move statements that change the attributes of three fields


MOVE 'Q' TO CUSTNOA. MOVE ATTR-RED TO MSGC. MOVE ATTR-REVERSE TO INVNOH.

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 8

How to modify field attributes


You can control a screen fields attributes by moving new hex values to its attribute fields in the symbolic map and issuing the SEND MAP command without the MAPONLY option. Some hex values have EBCDIC equivalents that you can use to set attributes. Most shops provide copy members with data names for common attribute combinations that you can move to an attribute field. Because the flag field (suffix F) and the attribute byte field (suffix A) occupy the same byte of storage, you must set the attribute byte field to Low-Value or a valid attribute byte value before issuing a SEND MAP command if the flag field is set to hex 80 as a result of the user clearing the field. To reset screen attributes to their original values, move those values to the attribute fields in the symbolic map and issue a SEND MAP command with the DATAONLY option.
CICS, C8 2001, Mike Murach & Associates, Inc. Slide 9

A typical copy member for attribute definitions


01 ATTRIBUTE-DEFINITIONS. *STANDARD ATTRIBUTES* 05 ATTR-UNPROT 05 ATTR-UNPROT-MDT 05 ATTR-UNPROT-BRT 05 ATTR-UNPROT-BRT-MDT 05 ATTR-UNPROT-DARK 05 ATTR-UNPROT-DARK-MDT 05 ATTR-UNPROT-NUM 05 ATTR-UNPROT-NUM-MDT 05 ATTR-UNPROT-NUM-BRT 05 ATTR-UNPROT-NUM-BRT-MDT 05 ATTR-UNPROT-NUM-DARK 05 ATTR-UNPROT-NUM-DARK-MDT 05 ATTR-PROT 05 ATTR-PROT-MDT 05 ATTR-PROT-BRT 05 ATTR-PROT-BRT-MDT 05 ATTR-PROT-DARK 05 ATTR-PROT-DARK-MDT 05 ATTR-PROT-SKIP 05 ATTR-PROT-SKIP-MDT 05 ATTR-PROT-SKIP-BRT 05 ATTR-PROT-SKIP-BRT-MDT 05 ATTR-PROT-SKIP-DARK 05 ATTR-PROT-SKIP-DARK-MDT PIC PIC PIC PIC PIC PIC PIC PIC PIC PIC PIC PIC PIC PIC PIC PIC PIC PIC PIC PIC PIC PIC PIC PIC X X X X X X X X X X X X X X X X X X X X X X X X VALUE VALUE VALUE VALUE VALUE VALUE VALUE VALUE VALUE VALUE VALUE VALUE VALUE VALUE VALUE VALUE VALUE VALUE VALUE VALUE VALUE VALUE VALUE VALUE ' '. X'C1'. X'C8'. X'C9'. X'4C'. X'4D'. X'50'. X'D1'. X'D8'. X'D9'. X'5C'. X'5D'. X'60'. X'61'. X'E8'. X'E9'. '%'. X'6D'. X'F0'. X'F1'. X'F8'. X'F9'. X'7C'. X'7D'.

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 10

A typical copy member for attribute definitions (continued)


*EXTENDED HIGHLIGHTING* 05 ATTR-NO-HIGHLIGHT 05 ATTR-BLINK 05 ATTR-REVERSE 05 ATTR-UNDERSCORE *EXTENDED COLOR* 05 ATTR-DEFAULT-COLOR 05 ATTR-BLUE 05 ATTR-RED 05 ATTR-PINK 05 ATTR-GREEN 05 ATTR-TURQUOISE 05 ATTR-YELLOW 05 ATTR-NEUTRAL PIC PIC PIC PIC PIC PIC PIC PIC PIC PIC PIC PIC X X X X X X X X X X X X VALUE VALUE VALUE VALUE VALUE VALUE VALUE VALUE VALUE VALUE VALUE VALUE X'00'. '1'. '2'. '4'. X'00'. '1'. '2'. '3'. '4'. '5'. '6'. '7'.

Notes
Attribute values can be given in hex codes or EBCDIC. IBM also supplies a standard copy member, named DFHBMSCA, that defines many attribute settings.

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 11

How to minimize the data thats sent from your program to the terminal
Use the DATAONLY option of the SEND MAP command whenever you send data using a map thats already on the screen. Move Low-Value to symbolic map fields that are already present on the screen and should remain unchanged.

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 12

Code for minimizing data sent from your program to the terminal
. . MOVE LOW-VALUE TO CUSTNO1O ACTIONO SET SEND-DATAONLY-ALARM TO TRUE PERFORM 1500-SEND-KEY-MAP . 1500-SEND-KEY-MAP. * EVALUATE TRUE . . WHEN SEND-DATAONLY-ALARM EXEC CICS SEND MAP('MNTMAP1') MAPSET('MNTSET1') FROM(MNTMAP1O) DATAONLY ALARM CURSOR END-EXEC END-EVALUATE.

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 13

How to minimize the data thats sent to your program when the user presses an attention key
1. Maintain a copy of all the fields on the screen in the communication area. 2. Specify the FRSET option on the SEND MAP command to turn off the modified data tags of all the unprotected fields. If the user changes the field, the MDT will be turned back on, signifying that the new data should be transmitted. 3. When your program issues a RECEIVE MAP command, it must merge the new user entries with the fields saved in the communication area from the previous transmission.

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 14

How to identify entry fields


IBMs CUA guidelines state that data entry fields should be clearly identified on the screen with underlines. If a terminal supports extending highlighting, entry fields can be identified with the underline attribute. If a terminal doesnt support extended highlighting, entry fields should be filled with underscores. Unlike underlining, underscores are part of a fields contents. So the COBOL program has to remove them from the field when its processing the data and add them to the field before sending it back to the screen to be displayed.

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 15

How to use extended highlighting to identify entry fields


CUSTNO DFHMDF POS=(5,26), LENGTH=6, ATTRB=(NORM,UNPROT,IC), COLOR=TURQUOISE, HILIGHT=UNDERLINE X X X X

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 16

How to use underscores to identify entry fields on terminals that dont support extended highlighting
How to initialize a field with underscores
CUSTNO DFHMDF POS=(5,26), LENGTH=6, ATTRB=(NORM,UNPROT,IC), COLOR=TURQUOISE, INITIAL='______' X X X X

How to replace underscores with spaces after a RECEIVE MAP command


INSPECT INQMAP1I REPLACING ALL '_' BY SPACE.

How to replace spaces with underscores before a SEND MAP command


INSPECT INQMAP1I REPLACING ALL SPACE BY '_'.

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 17

Common field edits


Error condition Field was not entered Field contains spaces Field is not numeric Field is not positive Field is zero COBOL statements to test it IF CUSTNOL = ZERO IF CUSTNOI = SPACE (Call appropriate numeric editing routine) IF AMOUNTI NOT > ZERO IF AMOUNTI = ZERO

Description
Most CICS programs have to edit data entered by the user to make sure that no fields are missing, that the entries consist of valid data, and that related fields have logically related values. If the editing is complicated, requiring table or file lookups for example, you can break it down into two or more procedures. In many cases, though, a single procedure is all you need.

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 18

The general structure of an edit procedure


MOVE ATTR-NO-HIGHLIGHT TO extended highlight field for all map fields. IF error-condition-1 for field-1 MOVE ATTR-REVERSE TO extended highlight field for field-1 MOVE 1 TO length field for field-1 MOVE error-message TO message field MOVE 'N' TO VALID-DATA-SW ELSE IF error-condition-2 for field-1 . IF error-condition-1 for field-2 . IF tests for cross-validation conditions .

Note
Its common to edit data entry fields from the bottom of the screen to the top. That way, the error message the program displays relates to the first invalid field on the screen.

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 19

Sample editing code


MOVE ATTR-NO-HIGHLIGHT TO ZIPCODEH STATEH. IF ZIPCODEI = SPACE OR ZIPCODEL = ZERO MOVE ATTR-REVERSE TO ZIPCODEH MOVE 1 TO ZIPCODEL MOVE 'You must enter a zip code.' TO MSG20 MOVE 'N' TO VALID-DATA-SW END-IF. IF OR MOVE MOVE MOVE MOVE END-IF. . . STATEI = SPACE STATEL = ZERO ATTR-REVERSE TO STATEH -1 TO STATEL 'You must enter a state.' TO MSG2O 'N' TO VALID-DATA-SW

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 20

An edit routine that calls a subprogram to do numeric editing


IF AMOUNTL = ZERO MOVE ATTR-REVERSE TO AMOUNTH MOVE 1 TO AMOUNTL MOVE 'You must enter an amount.' TO MSGO MOVE 'N' TO VALID-DATA-SW ELSE CALL 'NUMEDIT' USING AMOUNTI EDITED-AMOUNT VALID-AMOUNT-SW IF NOT VALID-AMOUNT MOVE ATTR-REVERSE TO AMOUNTH MOVE 1 TO AMOUNTL MOVE 'Amount must be numeric.' TO MSGO MOVE 'N' TO VALID-DATA-SW ELSE IF EDITED-AMOUNT NOT > ZERO MOVE ATTR-REVERSE TO AMOUNTH MOVE 1 TO AMOUNTL MOVE 'Amount must be greater than zero.' TO MSGO MOVE 'N' TO VALID-DATA-SW END-IF END-IF END-IF.

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 21

Why numeric input must be edited


Even if a field has been defined with the NUM option, a user can enter more than one decimal point or take the keyboard out of numeric shift and enter alphanumeric data. CICS doesnt provide features for handling decimal-aligned input. Even if the PICIN picture for a field has an assumed decimal point, the decimal point doesnt show up on the screen. And if the user enters a decimal point, its considered invalid.

How to edit numeric input


Most shops have developed specialized subprograms to handle the complexities of editing numeric data.

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 22

The INTEDIT subprogram


IDENTIFICATION DIVISION. * PROGRAM-ID. INTEDIT. * ENVIRONMENT DIVISION. * DATA DIVISION. * WORKING-STORAGE SECTION. * 01 WORK-FIELDS. * 05 INTEGER-PART 05 INTEGER-LENGTH * LINKAGE SECTION. * 01 UNEDITED-NUMBER * 01 EDITED-NUMBER * 01 VALID-NUMBER-SW 88 VALID-NUMBER *

PIC 9(05). PIC S9(03)

COMP-3.

PIC X(05). PIC 9(05). PIC X(01). VALUE 'Y'.

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 23

The INTEDIT subprogram (continued)


PROCEDURE DIVISION USING UNEDITED-NUMBER EDITED-NUMBER VALID-NUMBER-SW. * 0000-EDIT-NUMBER. * MOVE ZERO TO INTEGER-LENGTH. INSPECT UNEDITED-NUMBER REPLACING LEADING SPACE BY ZERO. INSPECT UNEDITED-NUMBER TALLYING INTEGER-LENGTH FOR CHARACTERS BEFORE INITIAL SPACE. IF UNEDITED-NUMBER(1:INTEGER-LENGTH) NUMERIC MOVE UNEDITED- NUMBER(1:INTEGER-LENGTH) TO EDITED-NUMBER MOVE 'Y' TO VALID-NUMBER-SW ELSE MOVE 'N' TO VALID-NUMBER-SW END-IF. * 0000-EXIT. * EXIT PROGRAM.

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 24

The NUMEDIT subprogram


IDENTIFICATION DIVISION. PROGRAM-ID. NUMEDIT. * ENVIRONMENT DIVISION. * DATA DIVISION. * WORKING-STORAGE SECTION. * 01 WORK-FIELDS. 05 INTEGER-PART 05 INTEGER-PART-X 10 INTEGER-CHAR 05 DECIMAL-PART 05 DECIMAL-PART-X 10 DECIMAL-CHAR 05 DECIMAL-POS 05 INTEGER-LENGTH 05 INTEGER-SUB 05 DECIMAL-SUB 05 UNEDIT-SUB PIC 9(10). REDEFINES PIC X(01) PIC V9(10). REDEFINES PIC X(01) PIC S9(03) PIC S9(03) PIC S9(03) PIC S9(03) PIC S9(03) INTEGER-PART. OCCURS 10. DECIMAL-PART. OCCURS 10. COMP-3. COMP-3. COMP-3. COMP-3. COMP-3.

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 25

The NUMEDIT subprogram (continued)


LINKAGE SECTION. * 01 UNEDITED-NUMBER. 05 UNEDITED-CHAR OCCURS 10 PIC X. * 01 EDITED-NUMBER PIC 9(07)V99. * 01 VALID-NUMBER-SW PIC X(01). 88 VALID-NUMBER VALUE 'Y'. * PROCEDURE DIVISION USING UNEDITED-NUMBER EDITED-NUMBER VALID-NUMBER-SW. * 0000-EDIT-NUMBER. * MOVE 'Y' TO VALID-NUMBER-SW. MOVE ZERO TO INTEGER-PART DECIMAL-PART DECIMAL-POS. INSPECT UNEDITED-NUMBER TALLYING DECIMAL-POS FOR CHARACTERS BEFORE INITIAL '.'.

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 26

The NUMEDIT subprogram (continued)


IF DECIMAL-POS < 10 PERFORM 1000-EDIT-DECIMAL-NUMBER ELSE PERFORM 2000-EDIT-INTEGER END-IF. IF VALID-NUMBER COMPUTE EDITED-NUMBER = INTEGER-PART + DECIMAL-PART END-IF. * 0000-EXIT. * EXIT PROGRAM. * 1000-EDIT-DECIMAL-NUMBER. * MOVE 10 TO INTEGER-SUB. PERFORM 1100-EDIT-INTEGER-PART VARYING UNEDIT-SUB FROM DECIMAL-POS BY -1 UNTIL UNEDIT-SUB < 1. MOVE 1 TO DECIMAL-SUB. ADD 2 TO DECIMAL-POS. PERFORM 1200-EDIT-DECIMAL-PART VARYING UNEDIT-SUB FROM DECIMAL-POS BY 1 UNTIL UNEDIT-SUB > 10. *
CICS, C8 2001, Mike Murach & Associates, Inc. Slide 27

The NUMEDIT subprogram (continued)


1100-EDIT-INTEGER-PART. * IF UNEDITED-CHAR(UNEDIT-SUB) NUMERIC MOVE UNEDITED-CHAR(UNEDIT-SUB) TO INTEGER-CHAR(INTEGER-SUB) SUBTRACT 1 FROM INTEGER-SUB ELSE IF UNEDITED-CHAR(UNEDIT-SUB) NOT = SPACE MOVE 'N' TO VALID-NUMBER-SW END-IF. * 1200-EDIT-DECIMAL-PART. * IF UNEDITED-CHAR(UNEDIT-SUB) NUMERIC MOVE UNEDITED-CHAR(UNEDIT-SUB) TO DECIMAL-CHAR(DECIMAL-SUB) ADD 1 TO DECIMAL-SUB ELSE IF UNEDITED-CHAR(UNEDIT-SUB) NOT = SPACE MOVE 'N' TO VALID-NUMBER-SW END-IF. *

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 28

The NUMEDIT subprogram (continued)


2000-EDIT-INTEGER. * INSPECT UNEDITED-NUMBER REPLACING LEADING SPACE BY ZERO. MOVE ZERO TO INTEGER-LENGTH. INSPECT UNEDITED-NUMBER TALLYING INTEGER-LENGTH FOR CHARACTERS BEFORE INITIAL SPACE. MOVE 10 TO INTEGER-SUB. PERFORM 1100-EDIT-INTEGER-PART VARYING UNEDIT-SUB FROM INTEGER-LENGTH BY -1 UNTIL UNEDIT-SUB < 1. MOVE ZERO TO DECIMAL-PART.

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 29

The syntax of the SEND TEXT command


EXEC CICS SEND TEXT FROM(data-name) [ERASE] [FREEKB] END-EXEC

Option FROM ERASE FREEKB

Description Specifies the name of the field containing the data to be displayed on the terminal. Indicates that the screen should be erased before the data is displayed. Indicates that the terminal keyboard should be unlocked after the data is sent. If FREEKB is omitted, the user has to press the Reset key to unlock the keyboard.

Description
The SEND TEXT command makes it easy to display a brief message on the screen without having to create a BMS mapset. A SEND TEXT message is displayed starting at the top left corner of the screen.
CICS, C8 2001, Mike Murach & Associates, Inc. Slide 30

A SEND TEXT command that displays a termination message


WORKING-STORAGE SECTION. * 01 TERMINATION-MESSAGE . . PROCEDURE DIVISION. * . . EXEC CICS SEND TEXT FROM(TERMINATION-MESSAGE) ERASE FREEKB END-EXEC. PIC X(14) VALUE 'Session ended.'.

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 31

How to handle unrecoverable errors


Most shops have standards for handling unrecoverable errors, and many provide a generic error handling program that can be invoked when an unrecoverable error is detected. An error handling program usually displays an error message, writes detailed error information to an error log, reverses any changes made to recoverable files, and produces a storage dump. It may also cause the program to abend. Any program that branches to the error handling program will probably be required to pass along information on its current status.

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 32

Code that invokes the error handling program


* C C C C C C * WORKING-STORAGE SECTION. COPY ERRPARM. 01 ERROR-PARAMETERS. 05 ERR-RESP PIC S9(8) COMP. 05 ERR-RESP2 PIC S9(8) COMP. 05 ERR-TRNID PIC X(4). 05 ERR-RSRCE PIC X(8). . PROCEDURE DIVISION. . IF RESPONSE-CODE NOT = DFHRESP(NORMAL) PERFORM 9999-TERMINATE-PROGRAM. . 9999-TERMINATE-PROGRAM. MOVE EIBRESP TO ERR-RESP. MOVE EIBRESP2 TO ERR-RESP2. MOVE EIBTRNID TO ERR-TRNID. MOVE EIBRSRCE TO ERR-RSRCE. EXEC CICS XCTL PROGRAM('SYSERR') COMMAREA(ERROR-PARAMETERS) END-EXEC.

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 33

The error message displayed by the error handling program

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 34

The SYSERR program


* * * * IDENTIFICATION DIVISION. PROGRAM-ID. SYSERR. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 ERROR-MESSAGE. 05 ERROR-LINE-1. 10 FILLER 10 FILLER 10 FILLER 10 FILLER 05 ERROR-LINE-2 05 ERROR-LINE-3. 10 FILLER 10 EM-RESP 10 FILLER 05 ERROR-LINE-4. 10 FILLER 10 EM-RESP2 10 FILLER 05 ERROR-LINE-5. 10 FILLER 10 EM-TRNID 10 FILLER

PIC PIC PIC PIC PIC

X(20) X(20) X(20) X(19) X(79)

VALUE VALUE VALUE VALUE VALUE

'A serious error has '. 'occurred. Please co'. ' ntact technical supp'. 'ort. '. SPACE. = '.

PIC X(11) VALUE 'EIBRESP PIC Z(08)9. PIC X(59) VALUE SPACE.

PIC X(11) VALUE 'EIBRESP2 = '. PIC Z(08)9. PIC X(59) VALUE SPACE. PIC X(11) VALUE 'EIBTRNID = '. PIC X(04). PIC X(64) VALUE SPACE.

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 35

The SYSERR program (continued)


05 05 ERROR-LINE-6. 10 FILLER 10 EM-RSRCE 10 FILLER ERROR-LINE-7 PIC PIC PIC PIC X(11) VALUE 'EIBRSRCE = '. X(08). X(60) VALUE SPACE. X(79) VALUE SPACE.

* * * * * *

COPY ERRPARM. LINKAGE SECTION. 01 DFHCOMMAREA PIC X(20).

PROCEDURE DIVISION. 0000-DISPLAY-ERROR-MESSAGE. MOVE MOVE MOVE MOVE MOVE EXEC DFHCOMMAREA TO ERROR-PARAMETERS. ERR-RESP TO EM-RESP. ERR-RESP2 TO EM-RESP2. ERR-TRNID TO EM-TRNID. ERR-RSRCE TO EM-RSRCE. CICS SEND TEXT FROM(ERROR-MESSAGE) ERASE ALARM FREEKB END-EXEC. EXEC CICS RETURN END-EXEC.

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 36

The Execute Interface Block


Field name EIBAID EIBATT EIBCALEN EIBCOMPL EIBCONF EIBCPOSN EIBDATE EIBDS EIBEOC EIBERR EIBERRCD EIBFMH EIBFN EIBFREE EIBNODAT EIBRCODE COBOL Picture X(1) X(1) S9(4) COMP X(1) X(1) S9(4) COMP S9(7) COMP-3 X(8) X(1) X(1) X(4) X(1) X(2) X(1) X(1) X(6) Description Most recent AID character RU attach header flag Length of DFHCOMMAREA RECEIVE command completion flag APPC confirmation flag Most recent cursor address, given as displacement value Task start date in the format 0CYYDDD Most recent data set name RU end-of-chain flag APPC error flag APPC error code FMH flag Most recent CICS command code Free facility flag APPC no-data flag CICS response code

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 37

The Execute Interface Block (continued)


Field name EIBRECV EIBREQID EIBRESP EIBRESP2 EIBRLDBK EIBRSRCE EIBSIG EIBSYNC EIBSYNRB EIBTASKN EIBTIME EIBTRMID EIBTRNID COBOL Picture X(1) X(8) S9(8) COMP S9(8) COMP X(1) X(8) X(1) X(1) X(1) S9(7) COMP-3 S9(7) COMP-3 X(4) X(4) Description RECEIVE command more-data flag Interval control request-id Exceptional condition code Exceptional condition extended code Rollback flag Last resource SIGNAL flag Syncpoint flag Syncpoint rollback flag Task number Task starting time in the format 0HHMMSS Terminal-id Transaction-id

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 38

The syntax of the ADDRESS command


EXEC CICS ADDRESS [CWA(pointer)] [TWA(pointer)] [TCTUA(pointer)] END-EXEC Option CWA TWA TCTUA Description Establishes addressability to the Common Work Area, a user-defined storage area common to all tasks in a CICS system. Establishes addressability to the Transaction Work Area, an area of storage assigned to the current task. Establishes addressability to the Terminal Control Table User Area, an area of storage associated with the terminal.

Description
You can use the ADDRESS command to establish addressability to areas of CICS storage that can be accessed through fields defined in the Linkage Section.

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 39

Code that accesses the Common Work Area


LINKAGE SECTION. * 01 DFHCOMMAREA PIC X. * 01 COMMON-WORK-AREA. * 05 CWA-CURRENT-DATE PIC X(8). 05 CWA-COMPANY-NAME PIC X(30). * PROCEDURE DIVISON. * 0000-PROCESS-CUSTOMER-INQUIRY. * . . EXEC CICS ADDRESS CWA(ADDRESS OF COMMON-WORK-AREA) END-EXEC. MOVE CWA-COMPANY-NAME TO COMPO.

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 40

The syntax of the ASKTIME command


EXEC CICS ASKTIME [ABSTIME(data-name)] END-EXEC Option ABSTIME Description Specifies a 15-digit packed-decimal field (PIC S9(15) COMP-3) where CICS places an absolute time value representing the number of milliseconds that have elapsed since midnight, January 1, 1900.

Description
The ASKTIME command retrieves the current date and time as an absolute time. Each time this command is executed, the date and time in the EIBDATE and EIBTIME fields are updated. You can convert an absolute time value to a more useful format using the FORMATTIME command.

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 41

Code that retrieves the absolute time


WORKING-STORAGE-SECTION. . . 01 DATE-AND-TIME-FIELDS. 05 ABSOLUTE-TIME PIC S9(15) COMP-3. . . PROCEDURE DIVISION. . . EXEC CICS ASKTIME ABSTIME(ABSOLUTE-TIME) END-EXEC. . .

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 42

The syntax of the 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)] [DAYCOUNT(data-name)] [DAYOFWEEK(data-name)] [DAYOFMONTH(data-name)] [MONTHOFYEAR(data-name)] [YEAR(data-name)] [TIME(data-name) [TIMESEP[(data-name | literal)]]] END-EXEC

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 43

The syntax of the FORMATTIME command (continued)


Option ABSTIME DATE FULLDATE Description Specifies a 15-digit packed-decimal field that contains the date to be formatted. Specifies an eight-byte field where CICS places the date formatted according to the installation default. Specifies a ten-byte field where CICS places the date formatted according to the installation default, but with the year expanded to four digits. Specifies a ten-byte field where CICS places the month, day, and year in the form mmddyyyy. Specifies a ten-byte field where CICS places the day, month, and year in the form ddmmyyyy. Specifies a ten-byte field where CICS places the year, month, and day in the form yyyymmdd. Specifies a ten-byte field where CICS places the year, day, and month in the form yyyyddmm. Specifies an eight-byte field where CICS places the year and day within the year in the form yyyyddd.

MMDDYYYY DDMMYYYY YYYYMMDD YYYYDDMM YYYYDDD

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 44

The syntax of the FORMATTIME command (continued)


Option DATESEP Description Specifies a single character value to be used as a separator between the month, day, and year components of a date value. If you omit DATESEP, no separator is used. If you specify DATESEP without a value, a slash (/) is used. Specifies a six-byte field where CICS returns YYMMDD, DDMMYY, or MMDDYY to indicate the installations default date format. Specifies a binary fullword where CICS places the number of days that have passed since January 1, 1900. Specifies a binary fullword where CICS places a number that corresponds to the day of the week, starting with Sunday (0). Specifies a binary fullword where CICS places the day within the current month. Specifies a binary fullword where CICS places a number that corresponds to the current month. Specifies a binary fullword where CICS places the year expanded to four digits.

DATEFORM

DAYCOUNT DAYOFWEEK DAYOFMONTH MONTHOFYEAR YEAR

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 45

The syntax of the FORMATTIME command (continued)


Option TIME TIMESEP Description Specifies an eight-byte field where CICS places the time in the form hhmmss. The time is based on a 24-hour clock. Specifies a single character value to be used as a separator between the hours, minutes, and seconds components of a time value. If you omit TIMESEP, no separator is used. If you specify TIMESEP without a value, a colon (:) is used.

Description
The FORMATTIME command formats an absolute time and places the date and time portions in the named fields. The date and time that are returned by the FORMATTIME command are always left justified in the named field. You can also use the MMDDYY, DDMMYY, YYMMDD, YYDDMM, and YYDDD options to format a date with a two-digit year.
CICS, C8 2001, Mike Murach & Associates, Inc. Slide 46

A FORMATTIME command that formats the date and time in the default format with the default separators
EXEC CICS FORMATTIME ABSTIME(ABSOLUTE-TIME) DATE(WS-DATE) DATESEP TIME(WS-TIME) TIMESEP END-EXEC.

A FORMATTIME command that formats the date in the format dd-mm-yyyy


EXEC CICS FORMATTIME ABSTIME(ABSOLUTE-TIME) DDMMYYYY(WS-FULL-DATE) DATESEP('-') END-EXEC.

CICS, C8

2001, Mike Murach & Associates, Inc.

Slide 47

Вам также может понравиться