Академический Документы
Профессиональный Документы
Культура Документы
com
Presents
PART I
INTRODUCTION TO CICS
Copyright: IBMMAINFRAMES.com
OBJECTIVES
y y y y y Batch & Online systems Why CICS? CICS System components CICS control program & tables CICS startup and shutdown
Copyright: IBMMAINFRAMES.com 3
ONLINE SYSTEM DEFINITION : ONLINE processing allows a user to interact with a computer and access its resources via a terminal Example : Railway Reservation system
Copyright: IBMMAINFRAMES.com 4
ONLINE
Data from terminal random, concurrent
Start of A job
Operator (or operating system) Once CICS is initialized, initiates the job. Other jobs in entering transaction id triggers the transaction the same region must wait. to start. Multi task multi thread. Priority processing. Each transaction. Once CICS is terminated, no transactions can be entered.
5
Processing Single task single thread. Priority in job scheduling Mode End of job Each job
Copyright: IBMMAINFRAMES.com
ONLINE
printed reports, output files. Message terminals User must wait for batch jobs updated files, system to produce reports (day, week, Instant feed back month) Less More
Copyright: IBMMAINFRAMES.com
WHAT IS CICS?
y Customer Information Control System (CICS) was
developed in 1960 by IBM y ONLINE CONTROL SYSTEM y General purpose data communication control system y Provides services to handle all the special requirements for online processing
Copyright: IBMMAINFRAMES.com 7
Application Program
Other Systems
Data Storage
CICS / MVS
Terminals
Note : Role of CICS is to interface between application programs and the DB/DC control system.
Copyright: IBMMAINFRAMES.com 8
Copyright: IBMMAINFRAMES.com
CICS / VS CONTROL
T E R M I N A L
TASK CONTROL
TERMINAL CONTROL
CICS TABLES
FILE CONTROL
F I L E S
PROGRAM CONTROL
PROGRAM LIBRARY
Copyright: IBMMAINFRAMES.com
10
y JCP (JOURNAL CONTROL PROGRAM) y KCP (TASK CONTROL PROGRAM) y PCP (PROGRAM CONTROL PROGRAM) y SCP (STORAGE CONTROL PROGRAM) y TCP (TERMINAL CONTROL PROGRAM) y TDP (TRANSIENT DATA PROGRAM) y TSP (TEMPORARY STORAGE PROGRAM)
OTHERS
Copyright: IBMMAINFRAMES.com 11
CICS START UP
y y CICS is submitted as a batch job. CICS System Initialization program (SIP) is the main job step SIP loads System Initialization Table (SIT) SIP further loads all control programs and tables
y y
CICS SHUTDOWN
y Master terminal transaction is entered with shutdown option CICS job produces various logs, statistics, dumps and other reports and ends No transaction can be executed after that
Copyright: IBMMAINFRAMES.com
14
ROLE OF CICS
y
y MULTI TASKING - More than one task can be executed concurrently. MULTI THREADING - Tasks share the same program under the multi tasking environment. RE-ENTRANT PROGRAM - Program when does not modify itself in any way during execution. QUASI RE-ENTRANT - Is a reentrant program under the CICS environment.
Copyright: IBMMAINFRAMES.com 15
Chapter - 2
Copyright: IBMMAINFRAMES.com
16
INTRODUCTION TO BMS
y To make the application program device independent and format independent CICS provides Basic Mapping Support (BMS) BMS is a standard facility, to deal with the formatted screen operations Screen defined through BMS is called a "MAP"
Copyright: IBMMAINFRAMES.com
17
For input operations, it defines the maximal data length and starting position of each field to be read and allows BMS to interpret an input data stream For output operations it defines starting position, length, field characteristics (Attribute Bytes) and default data for each field, and allows BMS to construct an output data stream.
Copyright: IBMMAINFRAMES.com 18
LOAD MODULE
LOAD LIB
TO BE USED BY CICS
y y y
Physical map is a program in the form of Load module Physical map is coded using BMS macros BMS macros are assembled separately and link edited into the CICS load library
Copyright: IBMMAINFRAMES.com 19
SYMBOLIC MAP
y Ensures the device and format independence to the application programs A layout change in the formatted screen can be done independent of the application program coding as long as field name and length remain the same
COMPILER
SYMBOLIC MAP
LINK EDIT
Copyright: IBMMAINFRAMES.com
21
COPY LIB
OUTPUT MAPPING
MAP ONLY
EXEC CICS SEND MAP (mapname1) MAPSET (mapset1) MAPONLY END-EXEC DATA ONLY EXEC CICS SEND MAP (mapname1) MAPSET (mapset1) DATA ONLY. END-EXEC.
Copyright: IBMMAINFRAMES.com 25
OUTPUT MAPPING
y MAP ONLY option. - Use the physical map only. - Field headings, attribute bytes, and the location of where all information is to be placed is sent. y DATA ONLY - Use the symbolic map only - only the data in the symbolic map is sent to the screen.
Copyright: IBMMAINFRAMES.com 26
Copyright: IBMMAINFRAMES.com
27
Copyright: IBMMAINFRAMES.com
28
CURSOR POSITIONING
Static positioning
If IC option is specified in the ATTRB field of DFHMDF macro the cursor will be placed at this field.
Copyright: IBMMAINFRAMES.com
31
LINKAGE SECTION
Copying a symbolic description map structure here does NOT mean the storage will be available. Some available. methods for providing storage are passing a COMMAREA, acquiring temporary storage with the SET option, or using a GET MAIN command. command.
Copyright: IBMMAINFRAMES.com 32
SEND / RECEIVE
y Sending from the Symbolic description map
SEND MAP (`MAP1') (`MAP1 MAPSET(`SET1 MAPSET(`SET1') MOVE `MAP1' TO MAPVAR `MAP1 MOVE `SET1' TO SETVAR `SET1 SEND MAP (MAPVAR) MAPSET(SETVAR) FROM (MAP1O) (MAP1 SEND MAP Coding Alternatives
You can code the SEND MAP command to locate the symbolic description map in several ways: ways: y Using constants in the name field for MAP and MAPSET(FROM is not required)
Copyright: IBMMAINFRAMES.com 33
Copyright: IBMMAINFRAMES.com
34
OUTBOUND FUNCTIONS
SEND MAP (`MAPA') MAPSET (`SETA') [ERASE/ ERASEAUP] [FREEKB] [ALARM] [FRSET] [PRINT] ERASEERASE-Erase Buffer, place cursor in upper left corner then write or ERASEAUPERASEAUP-Erase all the unprotected fields before the Write FREEKBFREEKB-Unlock Keyboard after the write ALARMALARM-Active alarm with the write FRSETFRSET-Set all MDT currently on to off PRINTPRINT-Start the 3270 print operation. operation.
Copyright: IBMMAINFRAMES.com
38
OUTBOUND FUNCTIONS
Control Functions: Functions: y Typically the first type of command in the program is a SEND MAP. MAP. Certain control functions may be included in that command. command. y ERASEAUP will clear out each field whose attribute is unprotected. It will unprotected. NOT alter any attribute settings. settings. y If you do not free the keyboard using FREEKB, the operator will have to press the RESET key before entering data. data. y If you code FRSET, all attribute bytes currently having Modified Data Tags (MDT) set on will be set off. Selective resetting of the MDT's must off. be done another way. way. y When sending data to a 3270 screen the actual printing from the buffer will occur when the PRINT function is requested. requested.
Copyright: IBMMAINFRAMES.com 39
EXTENDED ATTRIBUTES
y DSATTS (for symbolic map) and MAPATTS (for physical map) support the extended attribute characteristics y The MAPATTS allows you to set up the physical map with any of the characteristic(s) coded. coded.
y The DSATTS will create appropriate suffixed labels for the attribute characteristic(s) coded. coded.
y To illustrate the result of coding these parameters, the generated symbolic map follows. follows.
Copyright: IBMMAINFRAMES.com 41
OUTBOUND FUNCTIONS
y The generated symbolic map: map: - COPY MAPSETA, PART I WORKINGWORKING-STORAGE SECTION. SECTION. COPY MAPSETTA. MAPSETTA. 01 MAP1I. MAP1 02 FILLER PIC x(12). x(12) 02 NAMEL COMP PIC 39(4). 39( 02 NAME F PICTURE x. 02 FILLER REDEFINES NAMEF. NAMEF. 02 NAMEA PICTURE x. 02 FILLER PIC X(5) X(5 02 NAMEI PIC X(20). X(20)
Copyright: IBMMAINFRAMES.com 42
Copyright: IBMMAINFRAMES.com
44
EIBAID/CURSOR
WORKINGWORKING-STORAGE SECTION. SECTION. COPY DFHAID. DFHAID. ...... PROCEDURE DIVISION. DIVISION. IF EIBAID = DFHPF12 THEN DFHPF12 ...... IF EIBAID = DFHENTER THEN ...... IF EIBCPOSN LESS THAN 80 THEN ...... y When you first enter your program as a result of a transaction id, you can test EIBAID and/or EIBCPOSN. This EIBCPOSN. may be done prior to issuing a RECEIVE command, if so chosen. chosen.
Copyright: IBMMAINFRAMES.com 45
CURSLOC
Sample Map
MAPSETA DFHMSD TYPE=&SYSPARM,MODE=INOUT, TERM=ALL,LANG=COBOL, TIOAPFX=YES, STORAGE=AUTO MAP1 MAP1 DFHMDI SIZE=(24,80),LINE=1,COLUMN=1, SIZE=(24,80),LINE=1,COLUMN=1 CURSLOC=YES DFHMDF POS(2,1), LENGTH=4, INITIAL=`NAME', POS(2 LENGTH=4 ATTRIB=ASKIP NAME DFHMDF POS(2,6),LENGTH=20, POS(2 ),LENGTH=20, ATTRB=(UNPROT, IC) DFHMDF POS(2,27), POS(2 27), LENGTH=1, LENGTH=1 ATTRB=PROT
Copyright: IBMMAINFRAMES.com 47
CURSLOC - Contd
y CURSLOC= YES allows you to determine after a RECEIVE MAP command, which map field had the cursor in it. it. CURSLOC=NO is the default. default. y CURSLOC=(NO/YES) may be coded on the DFHMSD or the DFHMDI macro. If coded on the DFHMSD macro, it will macro. provide a default for all the maps in that mapset. mapset. y When CURSLOC=YES, BMS will set the `F' suffix field to X'02'' indicating that field contained the cursor. If the cursor X'02 cursor. is in a field for which there is no symbolic label (i.e. a (i. DFHMDF with no label the program will not be notified. notified. Note : The `F' suffix field continues. continues.
Copyright: IBMMAINFRAMES.com 48
CURSLOC - Contd
To be used to indicate the operator pressed the erase to end of fixed (EOF) key by being set to X'80''. X'80 Therefore, if CURSLOC=YES it is possible to have both these conditions occur for the same field, in which case the `F' suffix field will contain a X'82''. X'82
Copyright: IBMMAINFRAMES.com
49
EDITING
y Map field Definition PICIN/PICOUT y Built in function DeDe-edit command - When data is sent out via the `O' suffix fields or received into the `I' suffix fields you may want a definition other than PIC x. PICIN AND PICOUT allows the user to use other COBOL PICS such as $,Z etc. etc. - If the date contains special characters, you may want to remove them using the BIF DEEDIT command. command.
Copyright: IBMMAINFRAMES.com
50
EXEC CICS BIF DEEDIT FIELD (amount) LENGTH (8) END-EXEC. END-EXEC.
Copyright: IBMMAINFRAMES.com 52
FIELD EDIT
- BIF DEEDIT is used to remove the special characters from the input field. field. y The Amount field displayed has a dollar sign and a decimal point y By using BIF DEEDIT dollar sign and decimal point is removed. removed. Thus the number can be used for arithmetic operations. operations. y COBOL compiler requires LENGTH specification: specification: VS COBOL-II uses the implied length of the data-area COBOLdataused in the field parameter. parameter.
Copyright: IBMMAINFRAMES.com 53
OBJECTIVES
y
y y y y y y y
Structure of CICS Application Program CICS Management Functions Starting a Task Conversational& Pseudoconversational transactions CICS Program preparation CICS Program testing & Debugging CICS commands Passing Data across tasks
Copyright: IBMMAINFRAMES.com 55
Copyright: IBMMAINFRAMES.com
57
y CALL statement is allowed if the called program does not issue any CICS commands or inhibited COBOL statements mentioned above. above.
Copyright: IBMMAINFRAMES.com
58
TERMINATION STATEMENTS
CALLER
CICS SYSTEM
CALLED
Notes :This is not the way to terminate a CICS program. CICS has a program.
command for that purpose. Nevertheless, COBOL and VS COBOL II purpose. have three statements to conclude programs. CICS Program. Program.
Program Security
Recovery
Terminal
Queue
Copyright: IBMMAINFRAMES.com
61
DEFINITIONS
y
Transactions An exchange between a terminal and a data base representing an application process. For process. example, an inquiry or a deposit and balance update Task A specific instance of a transaction i.e. a unique unit of work. work. Program Prepared statements compiled or assembled into an executable module of machine instructions. instructions.
Copyright: IBMMAINFRAMES.com 62
CONVERSATIONAL TRANSACTION
y y y y Program uses a pair of SEND and RECEIVE commands. commands. Program waits until the user responds. responds. Resources are held until the user responds. responds. Very inefficient way of conversing with the user. user.
Copyright: IBMMAINFRAMES.com
63
y y
The task is terminated after a message is sent with a linkage for the next task. CICS provides a task. facility (COMMAREA) to made it easier to accomplish this. this. When the user completes response (by pressing enter) reset task is automatically initiated by CICS. CICS. The task receives the message from the terminal & processes it. it. This is a multitask operation from system's point of view. view.
Copyright: IBMMAINFRAMES.com 64
CONCURRENT EXECUTION
The procedure Division represents the executable instructions of a program. In CICS, tasks may concurrently program. use the same program. program. y The working storage section contains data items used by the program, tasks cannot share data items; each task items; requires its own unique set of data items. items. y Working storage is not the only type of storage maintained by CICS for each executing task. task. y The command level interface initialized each task copy of invoking storage according to the VALUE classes in the program before program gets control. control. y
Copyright: IBMMAINFRAMES.com
65
PROGRAM PREPARATION
Source
DB2 Precompiler
CICS Translator
COBOL Compiler
Copyright: IBMMAINFRAMES.com
66
Running the DB2 precompiler first is the preferred DB2 method. DB2 method. DB2 precompiler precedes another process, binding, not mentioned here. here.
y Output of the DB2 precompiler can serve as input to the DB2 translator. translator. y Output of the translator will be input to the compiler. compiler.
y Output of the transaction is i/p to the compiler y The o/p of the linkage editor is executable. The load executable. module is placed in the CICS online program library. library. Messages or warnings are provided on all the listings. The listings. compiler listing is or limited use if the translator listing would not process all commands. commands.
Copyright: IBMMAINFRAMES.com
69
TESTING
Copyright: IBMMAINFRAMES.com
70
TESTING Contd
CEMT set program (prg1) New comp (prg1 Or CEMT S PR (prg1) N (prg1 y After making changes to a program the new version replaces old version, but CICS which is currently executing has no way of knowing this automatically. The CICS automatically. processing program table PPT still points to the old-version. old-version. y To avoid testing with the old version, you must use the CICS-provided CEMT transaction to update the pointer CICSto the program. program.
Copyright: IBMMAINFRAMES.com 71
COMMON FORMAT
EXEC CICS SEND FROM (FLDA) LENGTH (5) ENDEXEC
Keywords
Function
Option Argument
y A CICS command consists of a keyword phrase, delimiter, function, options and their argument values. values. y Be careful about periods. Avoid them after END-EXEC. periods. END-EXEC. Where you don't really want them. For eg. within an them. eg. y If .... then ... else statement
y The translator will place a period into the generated code if a period follows end-exec. end-exec.
Copyright: IBMMAINFRAMES.com 72
ARGUMENT VALUES
data - value PIC S9(4) comp Halfword binary PIC S9(8) comp Fullword binary PIC X(15) character string constants X(15) permitted COBOL data name eg :(Not a constant) 01 Record-area. Record-area. 05 Fld 1 05 Fld 2 COBOL data name Character string Paragraph name PIC S9(7) comp 3 Packed decimal BLL cell Usage pointer
Copyright: IBMMAINFRAMES.com 73
data - area
RECEIVE COMMAND
y EXEC CICS RECEIVE INTO (data area) LENGTH(ml) ENDEND-EXEC RECEIVE command is used to receive incoming data from the terminal to which this CICS transaction is associated. associated. A receiving area must be defined in working storage section and has to be specified in the INTO parameter. parameter. Length field must be defined in working storage section as a S9(4) comp. It has to be specified in length option. comp. option.
Copyright: IBMMAINFRAMES.com 74
SEND COMMAND
y EXEC CICS SEND FROM (data area) LENGTH(ln) ENDEND-EXEC The data to be sent must be stored in working storage section, and this field name has to be specified in the FROM parameter. parameter. Length must be specified the same as that of the Receive command. command.
Copyright: IBMMAINFRAMES.com 75
EXCEPTIONAL CONDITIONS
y RESP option Define a full word binary field S9(8) comp in the working storage section as the response field. field. Place RESP option with the response field in any CICS command. command. After command execution, check the response code in the response field with DFHRESP (xxxx) where xxxx is NORMAL for normal completion Or Any exceptional condition
Copyright: IBMMAINFRAMES.com 76
HANDLE CONDITION
y Handle condition command is used to transfer control to the procedure label specified if the exceptional condition, specified occurs. occurs. y Remains active until the end of program or another handle condition request overrides it. it.
Copyright: IBMMAINFRAMES.com
77
IGNORE CONDITION
y Ignore condition command causes no action to
be taken if the condition specified occurs in the programs. programs. Request by the IGNORE CONDITION command is valid until the subsequent HANDLE CONDITION command for the same condition. condition.
Copyright: IBMMAINFRAMES.com
78
NO HANDLE OPTION
If NOHANDLE option is specified in any CICS command, no action will be taken for any exceptional condition occurring during execution of this command. command. Eg : EXEC CICS SEND From (...) ...) Length (...) ...) NOHANDLE ENDEND-EXEC
y
Copyright: IBMMAINFRAMES.com 79
y -
- EIBDATE and EIBTIME fields have the values at the task initiation time. time. y FORMAT EXEC CICS ASKTIME END-EXEC END-
Copyright: IBMMAINFRAMES.com
80
Copyright: IBMMAINFRAMES.com
82
DELAY COMMAND
y DELAY command used to delay the processing of a task for the specified time interval or until the specified time. time.
FORMAT EXEC CICS DELAY INTERVAL (002000) 002000) TIME (152000) 152000) End - EXEC - Task will be suspended for 20 minutes if INTERVAL is specified or until 15:20:00 if TIME is specified. 15:20: specified.
Copyright: IBMMAINFRAMES.com 83
COMMAREA
Passing data via the COMMAREA pseudo conversational task to task Linking program to program
Copyright: IBMMAINFRAMES.com
84
PSEUDO CONVERSATIONAL
PCT ENTRIES
TRN 1 TRN2 Program 1 Program 2 Program 1 Send Return Transid TRN 2
RETURN TRANSID will terminate the task and specify the next transaction ID as TRN2 TRN2 When the operator enters data, TRN2 will automatically start (a task will TRN2 be created) and the program program 2 will be invoked. invoked.
Copyright: IBMMAINFRAMES.com 85
TRN2 Program 2
Linkage DFHcommarea
A commarea is a CICS maintained unit of storage for passing and receiving data between CICS program The first time a COMMAREA is passed. It must begin as an area passed. storage in the working storage section of the program passing commarea. commarea. The RETURN statement has a parameter for passing a COMMAREA to the program associated with a subsequent transaction. transaction.
Copyright: IBMMAINFRAMES.com 86
Copyright: IBMMAINFRAMES.com
87
PSEUDO CONVERSATIONAL
PCT
PAYR
ENTRIES
PAYROLL
Notes : y This pseudo conversational design will invoke the same program for each part of the conversation. conversation. The Return transid will terminate the task and specify the next transaction. transaction. When the operator enters data PAYR will automatically start (task will be created) and the program PAYROLL will be invoked. invoked.
Copyright: IBMMAINFRAMES.com 88
PAYR PAYROLL
Linkage DFHcommarea
Notes : y The first time commarea is passed, it must begin as an area of storage in the working storage section of the program passing it. it. y A commarea parameter in the RETURN will pass the area to the program associated with the subsequent transaction. In this case, itself. transaction. itself. y The subsequent program (in this case the same program) must define access to all the commarea that was passed to it. it.
Copyright: IBMMAINFRAMES.com 89
EIBCALEN
y First time into the program no commarea exists, therefore EIBCALEN = 0
While returning the control to CICS the working storage is loaded and this is sent via the commarea parameter in the RETURN Transid. Transid.
On subsequent entry, commarea exists and is automatically made addressable by CICS in the linkage section of DFHCOMMAREA
Copyright: IBMMAINFRAMES.com 91
The link command passes control to another program defined in CICS PPT expecting that the program will return to the linking program instruction following the LINK command. This happens when command. the linked program issues a RETURN command. command.
Copyright: IBMMAINFRAMES.com 92
y The working storage section for the linking program is retained. retained. Working storage for the linked program is automatically released after its RETURN command is executed. executed. Copyright: IBMMAINFRAMES.com
93
To pass control from one program to another and then return to the original like executing a subroutine. subroutine.
The link command passes control to another program defined in CICS PPT expecting that the program will return to the linking program instruction following the LINK command. This happens when the linked program issues a RETURN command. command. command.
Copyright: IBMMAINFRAMES.com 94
Copyright: IBMMAINFRAMES.com
95
OBJECTIVE
Functional overview
DIRECT RETRIEVAL
- VSAM DATA STRUCTURES DIRECT RETRIEVAL - RELATIONAL TABLE ROW BROWSE - VSAM DATA STRUCTURE BROWSE - RELATIONAL TABLE ROWS
Copyright: IBMMAINFRAMES.com 96
FUNCTIONAL OVERVIEW
CICS FCT RDB
FILEA
Data base
FCP
EIP
Copyright: IBMMAINFRAMES.com
97
TOPICS
y DIRECT RETRIEVAL - VSAM FILE RECORD - RELATIONAL TABLE ROW y BROWSE
Copyright: IBMMAINFRAMES.com
99
Sequential
Keyed Record 4
R1 R2
R3
Relative record
y CICS uses the following VSAM structures - Key sequenced data set (KSDS) - Entry sequenced dataset (ESDS) - Relative record dataset (RRDS)
Copyright: IBMMAINFRAMES.com 100
PROGRAM ORGANIZATION
Working Storage Record layout Definition Record key filed Linkage section
EIB Procedure Division ID entry key of record to be read EXEC CICS Read file....
Files are opened by CICS Immediately after system initialization if specified in the FCT. FCT. In response to a file access request from an application if the file is closed In response to a master terminal CEMT request from an operation. operation. Application program is not responsible for open / close of files
Copyright: IBMMAINFRAMES.com 101
RECORD IDENTIFICATION
y RECORD KEY y RELATIVE BYTE ADDRESS y RELATIVE RECORD NUMBER y PARTIAL KEY - key of the record to be read is specified in the RIDFLD. for KSDS Key specified can be a full key or partial key If partial key, key length has to be provided RBA (Relative Byte Address) Can also be used instead of actual key value y y For ESDS RIDFLD contain a 4 byte RBA For RRDS RIDFLD contains 4 Byte binary relative record number.
Copyright: IBMMAINFRAMES.com 102
READ COMMAND
y F READ command with INTO Option. (FULL KEY) Reads the record specified by the full key. The data content of the record is moved into the specified dataarea defined in the working storage section.
FORMAT EXEC CICS READ DATASET (name) | FILE (name) INTO (data-area) | SET(ptr-ref) RIDFLD (data-area) [ LENGTH (data-values) ] END - EXEC.
DATASET / FILE names the file. It must be defined in FCT.
INTO names the field in the working storage section where the data has to be placed. RIDFLD is the key field. LENGTH is half word binary. It indicates maximum length of the record to be read. It is optional.
Copyright: IBMMAINFRAMES.com 104
EXCEPTIONAL CONDITIONS
DUPKEY NOTFND : If duplicate record is found for the specified key.
: If the record is not found for the key specified. (in LENGTH
LENGER R LENGERR : The specified length OPTION) is shorter than the actual record length. NOTOPEN NOTOPEN :
The exceptional condition can be trapped using RESP option in the READ command.
Copyright: IBMMAINFRAMES.com
105
READ
y READ command with GENERIC OPTION Used to read a nonspecific record based on the generic key. (i.e. higher part of key) specified, instead of full key. FORMAT EXEC CICS READ FILE (FILEAAA) INTO (FILE-IOAREA) RIDFLD (REC-KEY) KEYLENGTH (3) GENERIC LENGTH (WS-LEN) END-EXEC KEY LENGTH specifies length of Generic key.
Copyright: IBMMAINFRAMES.com 106
EXAMPLE
MOVE 50 TO WS - LEN MOVE BAG TO REC - KEY. EXEC CICS READ DATASET (FILEAAA) INTO (data-area) RIDFLD (REC-KEY) KEYLENGTH (3) GENERIC LENGTH (WS-LEN) END-EXEC. DATA IN FILE ARG 112 ARG 111 BAG 110 BAG 112 This record will be read as this is the first TRG 111 record with generic key BAG EXCEPTIONAL condition : INVREQ: Key length specified is greater than the actual key length of the record
Copyright: IBMMAINFRAMES.com 107
READ COMMAND
y READ command with GTEQ option Used to read a non-specific record whose key is equal to or greater than the full key data specified. FORMAT EXEC CICS READ FILE (FILEAAA) INTO (data-area) RIDFLD (REC-KEY) GTEQ <---- Greater than or equal to LENGTH (WS-LEN) Search. END - EXEC.
Copyright: IBMMAINFRAMES.com 108
BROWSE COMMANDS
Establish position STARTBR
BROWSE
y BROWSE - VSAM FILE RECORDS - Establish position - Retrieve and process records - Terminate browse y Record retrieved as a part of browse cannot be updated during browse.
Copyright: IBMMAINFRAMES.com
110
STARTBR
y STARTBR COMMAND - to establish starting position for a file FORMAT EXEC CICS STARTBR FILE (name) RIDFLD (data-area) GTEQ END-EXEC. OPTIONS : GTEQ If no record is found for exact key, CICS places position to next available record EQUAL If no record is found for the exact key, exceptional condition NOTFND occurs GENERIC Places the position at the first record of partial key Exceptional conditions. y DSIDERR : File specified is not found in FCT. OTFND : Specified Record is not found
Copyright: IBMMAINFRAMES.com 111
READNEXT
y READNEXT command Used to read a record of a file sequentially forward
STARTBR must be successfully completed before READNEXT command FORMAT EXEC CICS READNEXT FILE (name) | DATASET(name) INTO (data_area) LENGTH (data_value) RIDFLD (data_area) END-EXEC. EXCEPTIONAL CONDITIONS. DUPKEY : If Duplicate record is found for key specified. ENDFILE : End of file detected. LENGERR: Actual record length greater than the length specified
Copyright: IBMMAINFRAMES.com 112
READPREV
READPREV command Used to read a record of a file sequentially backward STARTBR must have been successfully completed before READPREV command
Options and parameters are same as READNEXT command EXCEPTIONAL Conditions NOTFND: INVREQ: If no record is found for key specified Generic option must not be used in the STARTBR command prior to READPREV command if used, this condition occur.
Copyright: IBMMAINFRAMES.com 113
ADDRESSABILITY TECHNIQUES
Copyright: IBMMAINFRAMES.com
114
XCTL COMMAND
EXEC CICS XCTL PROGRAM (PROGRAM NAME) RESP (EXCEPTION) END-EXEC. END-EXEC. IF EXCEPTION = DFHRESP (PGMIDERR) a module given control through the use of a CICS XCTL command will not return to the program that issued the XCTL. XCTL. The required. program name is character string constant (max required. 8 characters) The PGMIDERR exception condition occurs when the name is not in the PPT. PPT.
Copyright: IBMMAINFRAMES.com 115
LOGICAL LEVELS
Level 0 Level 1
The CICS System
Level 2 y
Second Program
The linked to program runs at a new logical level and returns to a logical level back to the linking program. program. The linking program and its storage area remain available. Copyright: IBMMAINFRAMES.com
116
Link Return
Notes : y To quit the repeated execution simply RETURN without the TRANSID option. option. y Any linked program could use the same COMMAREA of the parameters so indicated. indicated. y The transid & commarea option easy enough to use to make this method practical. practical.
Copyright: IBMMAINFRAMES.com 117
MENU - IN
IN-AREA
. .
y . .
PROCEDURE PROCEDURE .. . RECEIVE INTO (INAREA) . XCTL (PROG BWS) .. INPUT MSG (MENU-IN) RETURN INPUT MSG & INPUT LEN PARAMETERS USED WITH XCTL OR LINK. LINK. INPUT LEN (11)
dotted
Linkage Section
01 DFHCOMMAREA 05 AREA2 PIC X(200)
COMMAREA(AREA1 COMMAREA(AREA1)
LENGTH(100)
EIBCALEN=100 EIBCALEN=100
PROG BWS
PROCEDURE
. .
If data is to be passed to the XCTLed program, a COMMAREA can be used. used. Data area is to be located in the Linkage Section of the receiving program. program. COMMAREA used with RETURN, LINK & XCTL
y
Copyright: IBMMAINFRAMES.com 121
ADDRESSABILITY
y DFHCOMMAREA & DFHEIBLK : Addressable automatically by CICS Dynamically acquired storage : Addressable by program Not necessary to always do a EXEC CICS GETMAIN explicitly
Copyright: IBMMAINFRAMES.com 122
Copyright: IBMMAINFRAMES.com
123
Copyright: IBMMAINFRAMES.com
126
y y y y
y y y
APPLICATION
(1) Interface to batch, TSO, or PC) CICS Application TDQ -File Batch prog (2) Interface from Batch Batch Prog File TDQ CICS Appl PROG. PROG.
Copyright: IBMMAINFRAMES.com 130
131
Copyright: IBMMAINFRAMES.com
132
EXCEPTIONAL CONDITIONS
(i) Special handling required LENGERR - length specified is greater than the maximum record length specified in DCT Qzero - Destination empties or end of TDQ error Qlderr in DCT. DCT. The dest ld specified cannot be found
(ii)
Copyright: IBMMAINFRAMES.com
133
TSP
VSAM (ESDS)
Copyright: IBMMAINFRAMES.com
134
WRITEQ TS
To write or re-write a record in TSQ reEXEC CICS WRITEQ TS QUEUE (NAME) LENGTH (DATA-VALUE) (DATA[ITEM (DATA-AREA). (DATA-AREA). [REWRITE] [MAIN | AUXILIARY] END-EXEC. END-EXEC.
- If this option is coded CICS write return the item number assigned to the record just written. written. REWRITE - is used to rewrite the record identified by ITEM. ITEM. Main / Auxiliary - To specify the storage medium. Will be stored in medium. main if auxiliary storage not supported. supported.
Copyright: IBMMAINFRAMES.com 136
ITEM
READQ TS
Can be used to read records either sequentially or directly. Syntax EXEC CICS READQ TS QUEUE (NAME) INTO (DATA - AREA) LENGTH (DATA-VALUE) (DATA[ITEM (DATA-VALUE) | NEXT] (DATA[NUMREC (DATA-AREA)] (DATAEND-EXEC. END-EXEC. NEXT - to retrieve the next - logical record in the TSQ. TSQ. mutually exclusive to the item option NUMREC the data area is defined as PIC 9(4) comp. to comp. find the Total no. of records in the TSQ. no. TSQ. Item for direct access specify the item no of the record. record.
Copyright: IBMMAINFRAMES.com 137
DELETEQ TS of TSQ
EXEC CICS DELETEQ TS QUEUE (NAME) END-EXEC. END-EXEC. y y All records is TSQ are deleted. deleted. All associated storage is released. released.
Copyright: IBMMAINFRAMES.com 138
EXCEPTIONAL CONDITIONS
(1) Special handling required Itemerr Item number specified is not in the range of entry number assigned for the Queue. Queue. Lengerr Length specified is greater than the maximum record length. length. (2) error Q iderr - specified is Queue id not found. found.
Copyright: IBMMAINFRAMES.com 139
Copyright: IBMMAINFRAMES.com
140
y y
EXCEPTION HANDLING
CICS to respond to exceptional conditions in one of three ways: y RESP option: option: The RESP option can be specified in any CICS command. command. Its function is similar to the return code in the batch program. program. - Define a fullword binary field (S9(8)COMP) in the (S9 working storage section as a response field. field. Place the RESP option with the response filed in a command. command. After command execution, check the response code in the response field with DFHRESP (xxxx), where xxxx is the - NORMAL - Any exceptional condition
Copyright: IBMMAINFRAMES.com 145
EXCEPTION HANDLING
Ex.: Working - Storage Section 77 WS-RESP WSPIC S9 (8) COMP PROCEDURE DIVISION EXEC CICS SEND From (- - -) Erase Resp (WS-Resp) (WSEnd-Exec. End-Exec. If WS-RESP = DFHRESP (NORMAL) WSGO TO NORMAL - PARA If WS-RESP = DFHRESP (LENGERR) WSGO TO LENGERR - PARA GOTO GENERAL - PARA
Copyright: IBMMAINFRAMES.com 146
EXCEPTION HANDLING
y HANDLE CONDITION
This command is used to transfer control to the procedure label specified if the exceptional condition specified occurs. occurs. y IGNORE CONDITION This command causes no action to be taken if the condition specified occurs in the program. program. EXEC CICS HANDLE CONDITION Condition (Label) [Condition (Label)] [Error (Label)] END-EXEC. END-EXEC. or EXEC CICS IGNORE CONDITION Condition [Condition] END-EXEC. END-EXEC.
Copyright: IBMMAINFRAMES.com 147
If an exceptional condition occurs during execution of a CICS application program and if the program does not check the exceptional condition, CICS may continue executing the program or terminate abnormally the execution of the program, depending on the exceptional condition and the command involved. involved.
Copyright: IBMMAINFRAMES.com 148
Copyright: IBMMAINFRAMES.com
149
y y y
SYSTEM DEFAULT
COPYRIGHT
This product is licensed to IBMMAINFRAMES.com. Reproduction or reusing without permission is strictly prohibited.
All Rights reserved. Copyrighted to: IBMMAINFRAMES.com Written By: Mcmillan