Académique Documents
Professionnel Documents
Culture Documents
Identification Division.
No differences
Environment Division
MUST be EMPTY in CICS Program! No SELECT statements allowed!
Data Division
No FILE SECTION (No SELECTS)
CICS-Prg
Data Division
WORKING-STORAGE SECTION.
x Switches, Flags, Variables, Records, etc. x You get fresh copy each time program loaded!
CICS-Prg
Procedure Division
Uses most COBOL statements Also uses CICS Commands like:
x x x x x RETURN XCTL SEND MAP RECEIVE MAP READ DATASET
CICS-Prg
` ` ` `
Program must be able to determine! Always starts at beginning of Program Starts with initialized Working-Storage Can use several methods:
EIBCALEN (First time program loaded) COMMAREA (Tran-ID, EIBAID) Hidden Data on Screen
CICS-Prg
` `
CICS-Prg
WORKING-STORAGE SECTION.
Switches, Flags, and Misc Variables COMMUNICATION-AREA (Your copy!) RESPONSE-CODE PIC S9(08) COMP. RECORD Descriptions COPY Library for MAP Other COPY Members as needed
CICS-Prg
LINKAGE SECTION.
DFHCOMMAREA PIC X(nnn).
` ` ` `
If you dont code it, CICS Will! The commarea (if any) placed here! EIBCALEN gives length of commarea 0 (ZERO) means there is NO commarea
CICS-Prg
PROCEDURE DIVISION
EVALUATE TRUE WHEN EIBCALEN = 0 First time in Program WHEN EIBAID = DFHENTER Process Screen WHEN EIBAID = DFHPF3 or DFHPF12 Exit Program WHEN OTHER Invalid key END-EVALUATE
CICS-Prg 9
` General
Structure:
CICS-Prg
10
[ TRANSID(name) ]
[ COMMAREA(data-area) ] [ LENGTH(data-value) ]
END-EXEC Length PIC S9(4) COMP or Literal
CICS-Prg
11
CICS-Prg
12
END-EXEC
CICS-Prg
13
END-EXEC
CICS-Prg
14
END-EXEC
CICS-Prg
15
EXEC CICS ABEND [ ABCODE(name) ] END-EXEC (ABCODE used to identify storage dump Usually omitted!)
CICS-Prg
16
` ` `
Event-driven design Structure Chart - Consider All Functions Identify Events and Context
Any action that starts program List All (Valid) Possible User Actions
CICS-Prg
17
CICS-Prg
18
Event/Response Chart
Helps with design or Program Serves as Documentation of Program Sometimes replaced with Structure Chart
CICS-Prg
19
END-EXEC
CICS-Prg
20
DATASET(filename) FROM(data-area)
END-EXEC NOTES: Record MUST be READ with UPDATE! data-area - NOT have to match Read
CICS-Prg
21
CICS-Prg
22
EXEC CICS UNLOCK DATASET(filename) END-EXEC NOTE: If READ/UPDATE command is used and you determine that record does not need to be updated. Usually not needed as record is unlocked when the task is terminated.
CICS-Prg
23
CICS-Prg
24
` `
ALL CICS Commands allow RESP Parm 01 RESP-CODE PIC S9(8) COMP.
IF RESP-CODE = DFHRESP(NORMAL) MOVE Y TO OK-COMMAND ELSE IF RESP-CODE = DFHRESP(NOTFND) MOVE N TO REC-NOT-FOUND ELSE PERFORM DISPLAY-MISC-ERROR END-IF END-IF
CICS-Prg
25
PREVENT
Add busy flag in record (Special Maint) All programs MUST follow procedure Extra I/O required (to Set/Reset flag)
DETECT
Save copy and compare before updating OR Add Maint-Timestamp and check it Notify User to get latest version of data
CICS-Prg
26
` `
Sometimes called Deadly Embrace Happens when records from multiple files must be updated as a unit
Withdraw from Savings Deposit to Check Crash after withdraw? Wheres money?
CICS-Prg
27
END-EXEC
CICS-Prg
28
END-EXEC NOTE: Program name must be in PPT. Works like COBOL PERFORM statement.
CICS-Prg
29
EXEC CICS XCTL PROGRAM(name) [ COMMAREA(data-area) ] [ LENGTH(data-value) ] END-EXEC NOTE: Program name must be in PPT.
CICS-Prg
30
CICS-Prg
31
CICS-Prg
32
Determining the position of CURSOR when the user types an AID key.
EIBCPOSN in EIB Block (binary halfword) READ only-Available before RECEIVE MAP Can be used to determine user selection instead of requiring user to enter character
CICS-Prg
33
` ` ` ` ` `
Symbolic Map includes Attribute byte Field Name with A appended Cryptic bit codes and names used Copy library supplied by IBM (Horrible) Most shops have their own copy book We dont have extended attributes!
CICS-Prg
34
` ` ` ` ` ` `
All data entered should be validated Required data must be present Numeric data needs to be normalized Alpha data should not be spaces Meaningful error messages displayed Very tedious coding required! Do checking from bottom to top!
CICS-Prg
35
CICS-Prg
36
CICS-Prg
37
CICS-Prg
38
END-EXEC NOTE: HANDLE AID sets up RECEIVE MAP! Not executed when encountered! In OLD Progs.
CICS-Prg
39
` ` `
There are over 70 CICS error Conditions Mercifully only a few are handled TWO Methods of handling exceptions:
HANDLE CONDITION (Old Method)
x Similar in function to HANDLE AID
CICS-Prg
40
MAPFAIL Condition
Raised by RECEIVE MAP with no data
x User entered no data but pressed AID key x User pressed CLEAR key or PA key
CICS-Prg
41
CICS-Prg
42
Common CONDITIONS
DUPREC Record already exists MAPFAIL No data sent by user NOSPACE No space left in file NOTOPEN Data set not OPEN NOTFND Record not in file PGMIDERR Program not in PPT ERROR ALL conditions not coded
CICS-Prg
43
EXEC CICS HANDLE CONDITION MAPFAIL(500-NO-DATA) DUPREC(600-DUPLICATE) NOTOPEN END-EXEC NOTE: Condition by itself will nullify it!
CICS-Prg
44
` ` ` ` ` ` `
Not an executable command Establishes paragraph to correct error Can issue multiple times Last one executed is in effect Causes GO TO to paragraph named Done BEFORE CICS Command executed OLD method of coding AVOID!
CICS-Prg
45
` ` ` ` `
ADD RESP option to CICS Command Define binary fullword PIC S9(8) COMP Name that field in each RESP option COPY of EIBRESP from EIB EIBRESP2 (RESP2) also available
Not many CICS Commands use it Seldom needed as RESP is usually enough
CICS-Prg
46
` ` `
Most shops have a standard error handling method If not, use sample linkage on Page 255 Sample program is on Page 257 Called whenever a condition is not handled in the program Displays error to user and terminates
CICS-Prg
47
` ` ` ` `
Used to access data left by previous execution of a program Data should be moved to your W/S! Each execution starts with initial W/S Define COMMAREA in Working-Storage DEFINE DFHCOMMAREA in Linkage RETURN references Working-Storage
CICS-Prg
48
` ` `
EIB definition added by CICS Compiler In Linkage Section after DFHCOMMAREA Contains several useful fields
EIBCALEN, EIBAID, EIBCPOSN, EIBDATE, EIBTIME, EIBTRNID, EIBTRMID, EIBRSRCE
` `
Most kept current by CICS (Page 258) You can update a few of them-EIBTRNID
CICS-Prg
49
` ` ` ` ` ` ` ` `
Length of COMMAREA Current AID Key pressed Position of CURSOR Task DATE (00YYDDD) Task Time (0HHMMSS) Transaction of Task Terminal ID of Task Recently used Resource Name Recently accessed Data Set
CICS-Prg 50
` ` ` ` `
Last CICS Command Completion Status More Completion Status Response Code (OLD) Recent Resource Name
Map Name Program Name Data Set Name
CICS-Prg
51
Common System Area Transaction Work Area Terminal Control Table User Area Must establish Addressability if needed
CICS-Prg
52
CICS-Prg
53
EXEC CICS ADDRESS CWA(ADDRESS OF CWA) END-EXEC NOTE: Holdovers from MACRO-Level CICS Seldom needed any more!
CICS-Prg
54