CICS BY Asad

73
Asad Privet 2011 CICS BY Asad INTRODUCTION TO CICS Customer Information Control System CICS is a database/data communication (DB/DC) system. Interface between operating system and application program. CICS allows data to be transmitted from the terminal to the host computer, have data processed, access files/data bases, and then have transmitted back to termINTRODUCTION TO CICS Customer Information Control System CICS is a database/data communication (DB/DC) system. Interface between operating system and application program. CICS allows data to be transmitted from the terminal to the host computer, have data processed, access files/data bases, and then have transmitted back to terminal. Provides control services necessary for online processing. It manages the terminals, application program and data. CICS Components There are 3 components of CICS. They are Data communication services. Data management services. CICS management services. Data Communication Services : An interface between the terminals and printers with CICS via telecommunication access method (TCAM or VTAM) Free application programs from terminal hardware through BMS (Basic Mapping Support) which provides Device independence Format independence Multi-region operation (MRO), through which more than one CICS region of a system can communicate. Intersystem communication (ISC), through which one CICS reign of a system can communicate with other CICS region in other system. Data Management Services : Not for sale Page 1

Transcript of CICS BY Asad

Page 1: CICS BY Asad

Asad Privet 2011

CICS BY Asad

INTRODUCTION TO CICS

Customer Information Control System CICS is a database/data communication (DB/DC) system.Interface between operating system and application program.CICS allows data to be transmitted from the terminal to the host computer, have data processed, access files/data bases, and then have transmitted back to termINTRODUCTION TO CICS

Customer Information Control System CICS is a database/data communication (DB/DC) system.Interface between operating system and application program.CICS allows data to be transmitted from the terminal to the host computer, have data processed, access files/data bases, and then have transmitted back to terminal.Provides control services necessary for online processing. It manages the terminals, application program and data.

CICS ComponentsThere are 3 components of CICS. They areData communication services.Data management services.CICS management services.Data Communication Services : An interface between the terminals and printers with CICS via telecommunication access method (TCAM or VTAM)Free application programs from terminal hardware through BMS (Basic Mapping Support) which provides Device independence Format independence Multi-region operation (MRO), through which more than one CICS region of a system can communicate.Intersystem communication (ISC), through which one CICS reign of a system can communicate with other CICS region in other system.Data Management Services : An interface with databases accesses methods such as DB2, DL/1 and VSAM.An interface with error-checking and reporting facilities.CICS management services :Program control, such as load and release of application programs.Storage control, such as acquiring and freeing of storage.Task control, such as scheduling based on task priority.Transient data control

Not for sale Page 1

Page 2: CICS BY Asad

Asad Privet 2011

Temporary storage controlDump controlTrace controlJournal controlApplication Programming Interface :Interfaces with programming language such as COBOL and Assembler. A Screen Definition Facility (SDF).An Execution Diagnostic Facility (EDF). CICS MACRO LEVELIn macro level programming, application programs use assembler-macro type CICS macros for requesting CICS services.CICS COMMAND LEVELIn command level programming, CICS commands are used to request CICS services. It simplifies programming, eliminating need to learn the internal structure & operation of CICS. Here CICS automatically acquires a Unique copy of the working storage section of the application program for each task. Therefor the application program does not have to acquire Dynamic Work Storage ( DWS ) for each task.In the case of application program is altered by the program itself during the execution of a program for a task , the information of the program alteration will be kept in the Task Global Table ( TGT ) which is a part of the program. This is how the Quasi rentrancy is ensured automatically thus taking away this responsibility from the programmer and thus making his life easy.Features Of CICS• Multi tasking • Multi threading • Quasi-reentrancy • Pseudo-conversation• Priority processing • Security processing • Recovery processing• Transaction driven

Command Language Translator and CompilerCICS command language translator converts CICS commands into the statements, which can be, understand by the compiler. It replaces CICS commands with host language CALL statements.

Not for sale Page 2

Page 3: CICS BY Asad

Asad Privet 2011

BATCH VS ONLINE

STRUCTURE OF CICS APPLICATION PROGRAMThe identification division should contain:Program-idOther commands, such as below, are optional, but recommendedAUTHOR DATE-WRITTEN DATE-COMPILED REMARKS

Environment division must satisfy the following requirements Only the header is required No other entries, such as CONFIGURATION SECTION, INPUT-OUTPUT SECTION, FILE CONTROL, or SELECT, are needed.Data division must satisfy the following requirements FILE SECTION (including FD, RD and SD ) not required.WORKING-STORAGE SECTION is required. The length of working storage plus the length of task global table (TGT) must not exceed 64k bytes.LINKAGE SECTION optional.

Procedure division ACCEPT, CURRENT DATE, DATE, DAY, DISPLAY, EXHIBIT, STOP RUN, TRACE are not allowed.Any I/O statements (OPEN, CLOSE, READ, WRITE, REWRITE, DELETE, and START) are not allowed.REPORT WRITER, SORT features are not allowed.A CICS application program must end with the CICS RETURN command or GOBACK command.The CALL statement is allowed if the called program does not issue any CICS commands.COBOL SECTIONS FOR CICSIDENTIFICATION DIVISIONPROGRAM-IDREMARKS ABOUT THIS PROGRAMENVIRONMENT DIVISION

Not for sale Page 3

Page 4: CICS BY Asad

Asad Privet 2011

CONFIGURATION SECTIONINPUT- OUTPUT SECTIONDATA DIVISION FILE SECTION WORKING -STORAGE SECTION LINKAGE SECTIONPROCEDURE DIVISION Steps For CICS Program Development:Step 1: Develop a complete set of program specificationsStep 2: Design the programStep 3: Create the necessary CICS table entries.Step 4: Prepare the BMS mapsetStep 5: Code the ProgramStep 6: Compile the programStep 7: Test the program under CICS

CONTROL PROGRAMS & TABLES

CICS Control Programs CICS Control TablesTerminal Control Program (TCP) Terminal Control Table (TCT)Task Control Program (KCP) Program Control Table (PCT)Storage Control Program (SCP) --------------File Control Program (FCP) File Control Table (FCT)Basic Mapping Support (BMS) Terminal Control Table (TCT)Program Control Program (PCP) Processing Program Table (PPT)Temporary Storage Program (TSP) ----------------Transient Data Program TDP) Destination Control Table (DCT)Dump Control (DCP) --------------Journal Control (JCP) Journal Control Table (JCT)Interval Control (ICP) ----------------------inal.

Terminal ControlSEND Command EXEC CICS SEND FROM(data-area) LENGTH(data-value) ERASE WAIT END-EXEC.

Writes data to a terminal from an application program.

Not for sale Page 4

Page 5: CICS BY Asad

Asad Privet 2011

LENGTH (half word binary field S9(4) COMP) indicates the length of the message to be sent.

With wait option, CICS will not return control to the application program until write operation has been completed.

ERASE option erases all data on the screen prior to sending the message.Exceptional condition to the SEND command.

LENGERR : An out of range or negative length value is specified.

RECEIVE CommandEXEC CICS RECEIVE INTO(Data-Area) / SET (pointer-ref) LENGTH(data-area) ASISEND-EXEC.

Reads data from a terminal into the application program.When ASIS is specified, the message is received containing both upper and lower case data.LENGTH indicates the length of the message to be received.If input message is longer than the value specified in the data-area for LENGTH, the message is truncated to that length, the data-area is updated to actual length of the input message received and the LENGERR exception is raised.LENGTH data-area must be defined as half word binary (S9(4) COMP).

ISSUE PRINT Command

Produces hard copy of data currently displayed on the terminalFormat is:- EXEC CICS ISSUE PRINT END-EXEC.

ISSUE COPY command Used to copy a screen image of the terminal into the another terminalFormat is EXEC CICS ISSUE COPY TERMID(name) END-EXEC.

Not for sale Page 5

Page 6: CICS BY Asad

Asad Privet 2011

TERMID indicates the 1 to 4 character terminal id of the terminal to which the screen image is to copied.ATTENTION IDENTIFIER (AID)

Attention Identifier (AID) indicates which method the terminal operator had used to initiate the transfer of information from the terminal device to CICS.

For 3270 terminals, ENTER KEY, CLEAR key, up to 3 attention keys (PA1-PA3) and 24 function keys (PF1-PF24).

No data is transmitted when PA1, PA2, PA3 and clear keys are used. Should be used only when application does not required input from terminal.

The following is an example of using AID information in a program.

IF EIBAID = DFHPF3 PERFORM END-ROUTINEIF EIBAID = DFHPA1 PERFORM CANCEL-ROUTINEIF EIBAID = DFHENTER PERFORM NORMAL-ROUTINEGO TO WRONG-EKY-ROUTINE Handle Aid CommandUsed to specify the label to which control is to be passed when the specified AID is received. Format is

EXEC CICS HANDLE AID Option (Label) END-EXEC

Options - ENTER, CLEAR PA1-PA3, PF1-PF24Label - Name of the paragraph to which control is passedANKEY - Branches to the label for any key depressed other than the ones already specified in the command.

Upto 16 options in a command can be is sued.

EXEC CICS HANDLE AID PF3(END-ROUTINE) PA1(CANCEL-ROUTINE) ENTER(NORMAL-ROUTINE)

Not for sale Page 6

Page 7: CICS BY Asad

Asad Privet 2011

ANYKEY (WRONG-KEY-ROUTINE) END-EXEC

EXEC CICS RECEIVE <=== This could be receive MAP INTO (TERM-AREA) LENGTH (MSG-LEN)END – EXEC

Execution Result: At the completion of the RECEIVE command, control will be passed to the appropriate routine based on the key pressed, just the same as in the previous page IF EIBAID=DFHPF3

Basic Maping Support

BASIC MAPPING SUPPORT

Basic mapping support is CICS facility to deal with formatted screen operations.Interface between CICS & the application program.

Makes the application program device and format independent.A screen defined through BMS is called a map.

BMS map is nothing but a program written in assembler language.A group of maps, which are linkedited together, is called a mapset.

Mapset must be registered in PPT.

Using Maps in a Program: Symbolic map should be copied into the program. MAP Definition Macros

BMS provides assembler macros to define BMS mapsets, maps and fields with in maps

DFHMSD To define a map setDFHMDI To define a mapDFHMDF To define a field

The format at Macro is

Col 1-7 LabelCol 8-13 Operation codeCol 16 onwards operands (Parameters separated by commas)

Not for sale Page 7

Page 8: CICS BY Asad

Asad Privet 2011

Col 72 Continuation …..X is used for this purposeThe continuation line must start in Col 16 or Onwards.

Order of the Macres

DFHMSD TYPE=DSECT or MAP <…… A mapsetDFHMDI -------------- <…….. A mapDFHMDF -------------- DFHMDF -------------- }fields

DFHMDI -------------- <…….. A mapDFHMDF -------------- fieldDFHMDF -------------- field

DFHMDI -------------- <…….. A mapDFHMDF -------------- fieldDFHMDF -------------- field

DFHMSD TYPE = FINALEND

Defining Mapsets

The DFHMSD macro is used to define a mapset and its characteristics or to end a mapset definition. The map set name (1-7 characters) must be specified as the symbol to the DFHMSD macro.

The following are some of the commonly used options of the DFHMSD macro

TYPE = To define the map type.DSECT For symbolic mapMAP For physical map&SYSPARM used to assemble both physical map and symbolic map in one run

FINAL To indicate the end of the mapset coding

MODE

IN For the input map OUT For output map INOUT For the input output map

Not for sale Page 8

Page 9: CICS BY Asad

Asad Privet 2011

LANG= To define the language of application program (COBOL, ASM, PLL or RPG)STORAGE=AUTOTo acquire a separate symbolic for each map area in a Mapset. STORAGE parameter is coded when more than one map is defined in a Mapset. It indicates how storage will be allocated to the symbolic map. Each symbolic map will have its own storage area STORAGE=AUTO is specified. If the STORAGE parameter is omitted the Maps will be Redefining the same storage area.

TIOAPFX=YES To reserve the prefix space (12 bytes) for BMS commands to access TIOA properly in order to skip over control characters. Failure to include this operand would cause the Map to mis aligned when it is sent. It should be always YES for COBOL Maps.

CNTL = To define device control requests FREEKB To unlock the keyboard FSET To reset MDT to zero ALARM To set an alarm at screen display ( at each output time ) time PRINT To indicate the mapset to be sent to the printer.

TERM=ALL / 3270 / 3270-1 / 3270-2 Required if other than 3270 terminal is used. This ensures device independence by means of providing suffixSUFIX=nn To specify the user provided suffix number. This must correspond to the TCT parameter.

Following is the basic example of DFHMSD macro

MAPAMEN DFHMSD TYPE=&SYSPARM X MODE=INOUT X LANG=COBOL X STORAGE=AUTO X TIOAPFX=YES X CNTL=(FREEKB,FRSET,PRINT)

Defining Maps

The DFHMDI macro is used to define a map and its characteristics in a mapset.The Basic format of DFHMDI is MAP DFHMDI SIZE = (line, column) LINE = number JUSTIFY=LEFT/RIGHT

Not for sale Page 9

Page 10: CICS BY Asad

Asad Privet 2011

Size is used to define the size of the map

LINE and COLUMN indicates the starting position of the maps

JUSTIFY is used to specify the map to be LEFT justified or right justified.

The combination of Size , Line ,column and justify makes a variety of maps such as follows

SIZE=(05,20),LINE=01,COLUMN=01,JUSTIFY=LEFT ………………….. aSIZE=(05,20),LINE=06,COLUMN=20,JUSTIFY=LEFT ………………….. bSIZE=(05,20),LINE=15,COLUMN=80,JUSTIFY=RIGHT ………………….. c

In addition to above parameters DFHMDI macro has the same options as specified in the DFHMSD macro.

MAPAMEN DFHMDI SIZE=(24,80) X LINE=1, X COLUMN=1 X JUSTIFY=LEFT

Defining Fields

The DFHMDF macro is used to define in a map and its characteristics.The Basic format of DFHMDF macro is

FIELD DFHMDF POS={number/(line, column) LENGTH=number JUSTIFY={LEFT/RIGHT} {BLANK/ZERO} INITIAL = character data ATTRB= ({ASKIP/PROT/UNPROT/NUM} {BRT/NORM/DRK} {C} {FSET} GRPNAME=Group name OCCURS=number PICIN=Value PICOUT=Value COLOR={DEFAULT/color} HILIGHT={OFF/BLINK/REVERSE/UNDERLINE}

Field name is optional, the length of the field name is 1-7 characters.POS indicates starting position of the fieldLENGTH specifies the length of the field

Not for sale Page 10

Page 11: CICS BY Asad

Asad Privet 2011

INTITAL specifies initial value of the fieldPICIN and PICOUT determine the picture clause of symbolic map in COBOLATTRB defines the attribute character of the field, which defines the characteristics of the field.

Attribute Character

The attribute character is an invisible 1-byte characters which precedes a screen field and determines the characteristics of the field.

Some of the commonly used options areASKIP Autoskip. The data cannot be entered into the field the cursor skips to the next field.

PROT Protected field. The data cannot be entered into the field.UNPROT Unprotected field. The data can be entered. This should be specified for all input fields.NUM Numeric field. Only numeric (0to9) and special characters (“.” And “.”) are allowed.BRT Bright displayNORM Normal displayDRK Dark display. This is useful for the password field.IC Initial cursor. The cursor will be positioned in this field. If IC is specified in more than one field of a map, the cursor will be placed in the last field.FSET Field set MDT is set on so that the field data is to be sent from the terminal to the host computer regardless of whether the filed is actually modified by the user.PICIN Input symbolic map fields will be assigned a picture of X unless the PICIN operand defines the Picture differently Ex. PICIN = ‘999999’ PICOUT Output symbolic map fields will be assigned a picture of X unless the PICIN operand defines the Picture differently Ex. PICOUT = ‘$ZZ,ZZZ.99’

Two types of maps.Physical map.Symbolic map.Physical Map & Symbolic Map

Physical map:It is primarily used by CICSThe primary objective of the physical map is to ensure the device independence to the application programs.For input operations, the physical map defines maximum data length and starting position of each field to be read.For output operations the physical map defines starting position, length, field characteristics (Attribute bytes) and default data for each fieldPhysical map is coded using BMS macros, assembled separately, and linkedited into the CICS load library.

Not for sale Page 11

Page 12: CICS BY Asad

Asad Privet 2011

BMS macro --> Assembly ….> Link edit …..>CodingLoad Module ….> LOADLIB….> to be used by CICS

SYMBOLIC MAP FOR MAPAUPD

01 MAP9UPDI. 02 FILLER PIC X(12). 02 EMPNOL COMP PIC S9(4). 02 EMPNOF PICTURE X. 02 FILLER REDEFINES EMPNOF. 03 EMPNOA PICTURE X. 02 EMPNOI PIC X(6). 02 FILLER PIC X. 02 EMPNAML COMP PIC S9(4). 02 EMPNAMF PICTURE X. 02 FILLER REDEFINES EMPNAMF. 03 EMPNAMA PICTURE X. 02 EMPNAMI PIC X(20). 02 FILLER PIC X. 02 EMPSEXL COMP PIC S9(4). 02 EMPSEXF PICTURE X. 02 FILLER REDEFINES EMPSEXF. 03 EMPSEXA PICTURE X. 02 EMPSEXI PIC X(1). 02 EMPAGEL COMP PIC S9(4). 02 EMPAGEF PICTURE X. 02 FILLER REDEFINES EMPAGEF. 03 EMPAGEA PICTURE X. 02 EMPAGEI PIC X(2). 02 FILLER PIC X. 02 MESSAGEL COMP PIC S9(4). 02 MESSAGEF PICTURE X. 02 FILLER REDEFINES MESSAGEF. 03 MESSAGEA PICTURE X. 02 MESSAGEI PIC X(60). 01 MAP9UPDO REDEFINES MAP9UPDI. 02 FILLER PIC X(12). 02 FILLER PICTURE X(3). 02 EMPNOO PIC X(6). 02 FILLER PIC X. 02 FILLER PICTURE X(3). 02 EMPNAMO PIC X(20). 02 FILLER PIC X. 02 FILLER PICTURE X(3). 02 EMPSEXO PIC X(1).

Not for sale Page 12

Page 13: CICS BY Asad

Asad Privet 2011

02 FILLER PICTURE X(3). 02 EMPAGEO PIC X(2). 02 FILLER PIC X. 02 FILLER PICTURE X(3).02 MESSAGEO PIC X(60). Symbolic Map:

It is primarily used by application programThe primary objective of symbolic map is to ensure the device and format independence to the application program.Symbolic map is a copy lib memberIt is coded using BMS macroes, assembled separately, cataloged into a copy library (COPYLIB) At the time of application program compile, it will be copied into the application program.

BMS macro ……> Assembly ……> Symbolic …..> COPYLIBCoding Map Definition

Receive Map Command

EXEC CICS RECEIVE MAP (MAP name) MAPSET (mapset-name) INTO (data-area)/SET/(ptr-ref) FROM (data-area) ASISEND-EXEC

The receive map command is used to receive a map from a terminal.

Exceptional condition is MAPFAIL.

This happens when the user presses the ENTER key without typing data and FSET is not specified to this field in DFHMDF macro.

Send Map Command

EXEC CICS SEND MAP (mapname)MAPSET(mapset-name)DATAONLY/MAPONLYFROM(data-area)LENGTH(data-value)ALARMCURSOR (data-value)ERASEERASE UPFREEKB

Not for sale Page 13

Page 14: CICS BY Asad

Asad Privet 2011

FRSETEND-EXEC

The send map command is used to send a map to a terminal.

CURSOR makes the application program able to position the cursor dynamically on any part of the screen.

ERASE Erases the current screen before displaying the map to be used.

ERASE UP To erase all unprotected fields

FREEKB To free the key board.

ALARM To make an alarm sound

FRSET To reset MDT to zero for all unprotected fields of the screen.

DATAONLY Only application program data in the symbolic map is to be sent to the terminal.

MAPONLY Only the default data from the physical map is to be sent to the terminal. If this option is specified FROM option must not be specified.

What is MDT ?

MDT is one bit of the attribute character. If it is off ( 0) , it indicates that this field has not been modified by the terminal operator. If it is On (1) it indicates that the field has been modified by the operator. Only when the MDT is on will the field will be sent by the hardware to the application program. It is used to reduce the data traffic and there by the performance.

CNTL=FRSET sets the MDT to 0.CNTL=FSET at DFHMDGF macro field will ensure

TERMINAL CONTROL COMMANDS

Send Control Command

EXEC CICS SEND CONTROL [CURSOR/(data-value)] [ERASE/ERASEUP] [FREE KB] [ALARM] [FRSET]END-EXEC

Not for sale Page 14

Page 15: CICS BY Asad

Asad Privet 2011

The SEND CONTROL command is used by an application program to dynamically establish the device control option without actually sending the map.

CURSOR defines the relative cursor position in the screen, starting from zero. Other options have the same functions as described in the SEND MAP command.

Eg: CICS EXEC SEND CONTROL Screen will be cleared. END-EXEC

CICS EXEC SEND MAP(……) Map specified will be displayed MAPSET(-----) END-EXEC

CURSOR POSITIONING TECHNIQUES

Cursor positioning can be controlled in 3 waysStatic Positioning:In this approach IC is placed in the ATTRB parameter of the DFHMDF macro for a particular field. If there are more than one field with IC specified in one map, the last IC would be honored.

EMPNO DFHMDF POS=(3,16) ATTRB=(UNPROT,FSET,IC) LENGTH=8

Dynamic/Symbolic Positioning:

In this approach -1 will be placed into the length field (fieldname+L) of the field where we wish to place the cursor. The send map command to be issued must have cursor option and map set must be coded with MODE=INOUT in the DFHMSD macro.

MOVE-1 to FLDL

EXEC CICS SEND MAP(MAPAMEN) MAPSET (MAPAMEN) CURSOR ERASE END-EXEC

FLD is field defined in the map MAPAMEN

Dynamic/Relative Positioning:

In this approach, cursor is positioned dynamically through an application program using the cursor

Not for sale Page 15

Page 16: CICS BY Asad

Asad Privet 2011

(Value) option in the SEND MAP command with the value of the relative position (Starting from zero) of the terminal.

EXEC CICS SEND MAP (-----) MAPSET (------) CURSOR (100) ….> Cursor will be placed at position 100 of the terminal, relative to zero at the beginning of the screen. ERASEEND-EXEC.

PROGRAM CONTROL COMMANDS

PROGRAM CONTROL COMMANDSLINKXCTLRETURNLOADRELEASE

The CICS program control program (PCP) governs the flow of control among the CICS application programs and CICS itself.

The name of the CICS application program must be registered in the processing program table (PPT).Link CommandEXEC CICS LINK PROGRAM(name) COMMAREA(data-name) [LENGTH(data-value)]END-EXEC

LINK command is used to pass control from an application program at one logical level to another application at the next logical level.

The calling(LINKING) program expects control to be returned to it.

Data will be passed to called program thru a special communication area called COMMAREA.

Passing Data Using LINK

XCTLCommandEXEC CICS XCTL

Not for sale Page 16

Page 17: CICS BY Asad

Asad Privet 2011

PROGRAM(name) [COMMAREA(data-name)] [LENGTH(data-value)]END-EXEC

XCTL command is used to pass control from one application program to another application program at the same logical level.

The calling (XCTLint) program does nopt expect control to be returned.

Data will be passed to called program through a special communication area called OMMAREA.XCTL command required less overhead,performance is relatively better in comparison to the LINK command.

XCTL is the last executed instruction in a program.

The calling program is released by the task when control goes to Called program.

Common Exceptional Conditions occur during the execution of XCTL or LINK command are

NOAUTH - A resource security check has failed.PGMIDERR - The program specified is not found in PPT.

EXCEPTIONAL CONDITIONS

EXCEPTIONAL CONDITIONS Represents error or abnormal situation during last execution of CICS command.

HANDLE CONDITIONIGNORE CONDITIONNOHANDLE - optionRESP - option

HANDLE CONDITION EXEC CICS HANDLE CONDITION CONDITION (LABEL) CONDITION (LABEL) ERROR (LABEL) END-EXEC. The handle condition command is used to transfer control to the procedure label specified, If the specified exception condition occurs.

Not for sale Page 17

Page 18: CICS BY Asad

Asad Privet 2011

We can specify up to 16 conditions in one command.

Usually placed at the beginning of the program.

To turn off the handle for a condition, specify the condition without label or use IGNORE command.If any exception condition, which is not specified in the handle command occurs, then the control will be transfer to the label specified in ERROR condition. Handle condition is active from the time it is encountered tillThe task terminates.Another HANDLE command for that condition occurred.Ignore command for that condition occurred

An example shows handle with LENGERR and ERROR.WORKING-STORAGE SECTION.01 WK-TIOA05 FILLER PIC X(50).77 WK-LEN PIC S9(4) COMP.

PROCEDURE DIVISION. EXEC CICS HANDLE CONDITION ERROR (GENERAL-ERR-RTN) LENGERR (LENGERR-RTN) END-EXEC.

MOVE 20 TO WK-LENEXEC CICS RECEIVE INTO (WK-TIOA) LENGTH (WK-LEN) END-EXEC.

LENGERR-RTN MOVE 14 TO WK-LEN MOVE ‘TOO MUCH DATA’ TO WK-TIOA EXEC CICS SEND FROM (WK-TIOA) LENGTH (WK-LEN) END-EXEC. GOTO TER-RTN.

Not for sale Page 18

Page 19: CICS BY Asad

Asad Privet 2011

GENERAL-ERR-RTN.MOVE 20 TO WK-LEN MOVE ‘OTHER ERROR OCCURRED’ TO WK-TIOA EXEC CICS SEND FROM (WK-TIOA) LENGTH (WK-LEN) END-EXEC.

RET-RTN. EXEC CICS RETURN

END-EXEC.

IGNORE CONDITION Command

EXEC CICS IGNORE CONDITION CONDITION [CONDITION] END-EXEC.

IGNORE CONDITION command causes no action to be taken if the condition specified occurs in the program.

Control will be returned to the next instruction following the command, which encountered the exceptional condition.

IGNORE CONDITION command is active from the time it encountered until handle command for that condition occurred.

We can specify up to 16 conditions in one command.

EXEC CICS IGNORE CONDITION LENGERR END-EXEC. EXEC CICS RECEIVE INTO (- - - - LENGTH (- - - -) END-EXEC.

At the completion of RECEIVE command, if the LENGERR condition occurs, the condition will be ignored

Not for sale Page 19

Page 20: CICS BY Asad

Asad Privet 2011

and the control will be passed to next statement after the RECEIVE command.

ABEND Command

EXEC CICS ABEND [ABCODE (name)]END-EXEC.

Used to terminate a task intentionally, causing an ABEND.ABCODE is used to specify the user abend code (1 to 4 characters). PUSH and POP Commands

The PUSH and POP commands are used to suspend and reactivate all HANDLE CONDITION requests currently in effect.

PUSH and POP commands are useful while performing a subroutine embedded in main program.

A called route can use a PUSH command to suspend the existing HANDLE CONDITION requests, before returning control to the caller, the called routine can restore the original requests using POP command.

PUSH and POP commands can also be used to suspend and reactivate respectively, the HANDLE AID command and AHNDLE ABEND command.

FILE CONTROL PROGRAM (FCP)

FILE CONTROL PROGRAM (FCP)FCP provides application programs with services to read, update, add and delete records in a file. FCP makes application programs independent of the structure of the database.Opens all the files when CICS is initialized and close them when CICS terminates.Gets exclusive control over resources during updates. Application program is free of all definitions of file attributes as all information is in FCT.

FILE CONTROL - Random processing

READ Command

EXEC CICS READ DATASET(name) INTO(data-area) / SET (pointer-ref) LENGTH (data-area) RIDFLD(data-area)

Not for sale Page 20

Page 21: CICS BY Asad

Asad Privet 2011

KEYLENGTH (data-area) GENERIC GETQ / EQUAL UPDATE RBA RRN END-EXEC

READ command is used to read a record from a direct access dataset.

DATASET option names the file as specified in FCT.

INTO option is used to read the record into data-area specified using the full key.

The READ command with the SET using the full key is used, CICS sets the address pointer to the address of the record in the file input/output area with in CICS. The application program directly refer to the record without moving the record content to the working storage area. This makes the

SET option provides a better performance than the INTO option.

RIDFLD (Record Identifier Field) used to specify the key of the record.

LENGTH option specifies length of the record to be retrieved.

GENERIC option is used to read a non specific record based on the generic key (higher part of the key)

KEYLENGTH option is mandatory with GENERIC and must specify the length of the partial key. If used without GENERIC option, it must contain actual length of the full key.

GTEQ option is used to read a non-specific record whose key is equal or grater than the full key data specified. Default is EQUAL.

UPDATE option is used, the record is read with the intention of updating it.

RRN (Relative record number) is used to read a record sequentially or randomly in VSAM RRDS file.

RRB is used to read a record sequentially or randomly in a VSAM ESDS file. DUPKEY : A duplicate record is found in the specified key. The first record in the file witch has that key will be read.

Not for sale Page 21

Page 22: CICS BY Asad

Asad Privet 2011

NOTFND : No record with the key specified is found.

LENGERR : The specified length is shorter than the actual record length. The record will be truncated at the length specified and moved into the INTO field. The actual length will be placed in the LENGTH field.

REWRITE Command

EXEC CICS REWRITE DATASET(name) FROM(data-area) LENGTH(data-value)END-EXEC.

REWRITE command is used to update an existing record.

Record to be update must have been read with the UPDATE option.

Between READ and REWRITE commands, exclusive control over the will be maintained for this task, so that no other tasks can access this record for updates. Due to this the interval between these two commands should be as short as possible.

UNLOCK Command

EXEC CICS UNLOCK DATASET(name)END-EXEC.

Unlock command is used to release the exclusive control from the recordThe READ command with the UPDATE option normally maintains exclusive control over the record read until

The record is updated by the REWRITE command.

The transaction is normally or abnormally completed.

How ever, there are occasions when after reading a record through the READ command with the UPDATE option, it is found that the update is not longer required. In this case, the application program should release the exclusive control from the record so that the other tasks can access the same record. To achieve this UNLOCK command is used.

WRITE Command

Not for sale Page 22

Page 23: CICS BY Asad

Asad Privet 2011

EXEC CICS WRITE DATASET (name) / FILE (name) FROM(data-area) LENGTH(data-value) RIDFLD(data-area) MASSINSERT END-EXEC.

WRITE command is used to add a new record to the file.

LENGTH option specifies the length of the record to be written. If not used, the data-area must be exactly equal to the record size.

MASSINSERT option is used to add a group of records whose key are ascending order into a file.

MASSINSERT option causes exclusive control over the file, the file must be released by the \

UNLOCK command after the completion of the WRITE command.

Exceptional Conditions Common to WRITE Command

DUPREC Duplicate record is foundNOSPACE No disk space is available for the record addition.LENGERR The length specified is greater than the maximum length specified in the VSAM cluster.

DELETE Command

EXEC CICS DELETE DATASET(name) RIDFLD(data-area) KEYLENGTH(data-value) GENERIC NUMERIC(data-area)END-EXEC.

The delete command is used to delete one record or group of records from a file.

We have three approaches in DELETE command

1. DELETE after READ-UPDATE

Not for sale Page 23

Page 24: CICS BY Asad

Asad Privet 2011

2. Direct DELETE3. Group record DELETE approach.

Delete After Read UpdateEXEC CICS READ DATASET(name) INTO(data-name) RIDFLD(data-area) LENGTH(data-len) UPDATEEND-EXEC.

-------------

EXEC CICS DELETE DATASET(name)END-EXEC.

Here Delete command is issued without the record key information.

Exceptional condition to Delete command

INVREQ : The DELETE commands without the RIDFLD option is issued without prior READ/UPDATE command.

Direct DELETE approach without reading

EXEC CICS DELETE DATASET(name) RIDFLD(Data-area)END-EXEC

In this approach, the DELETE command is issued with full key information in the RIDFLD field. The record specified will be directly deleted from the file.

Exceptional conditions to the DELETE command

DUPKEY There is more than one record with the same key.NOTFND The record specified is not found.

Group records DELETE approach

Not for sale Page 24

Page 25: CICS BY Asad

Asad Privet 2011

WORKING-STORAGE SECTION.

77 WK-DEL-COUNT PIC S9(4) COMP.77 REC-A-KEY PIC X(5).

PROCEDURE DIVISION.

MOVE ‘NY’ to REC-A-KEY

EXEC CICS DELETE DATASET(‘FILEAAA’) RIDFLD(REC-A-KEY) KEYLENGTH(2) GENERIC NUMERIC(WK-DEL-COUNT)END-EXEC.

In this approach DELETE command is issued with the GENERIC option.A group of records, which satisfy the generic key specified, will be deleted from the file.NUMERIC specifies number of records deleted by generic specified.The length of the data-area specified in NUMERIC option is S9(4) COMP.

Exceptional condition is DELETE command

INVREQ : The key-length specified is greater than the actual key-length of the record.

BROWSING COMMANDS

STARTBR CommandEXEC CICS STARTBR DATASET(name) / File(name) RIDFLD(data-area) GENERIC / GTEQ / EQUALEND-EXEC.

Sequential access VSAM file under CICS is called Browsing.

The STARTBR command is used to establish a browse starting position for a file.

STARTBR does not read the data.

Not for sale Page 25

Page 26: CICS BY Asad

Asad Privet 2011

RIDFLD indicates the starting key on the record for the browse operation.

GTEQ is default.

If EQUAL is specified, and if no record is found for the exact key, the exceptional condition NOTFND occurs.

The GENERIC key could be used in the similar manner to the READ command with the GENERIC option.

Exceptional conditions to the STARTBR command.

DSIDERR : The file specified is not found in FCTNOTFND : The specified record is not found.

READNEXT Command

EXEC CICS READNEXT DATASET(name)/FILE(name) INTO(data-area) LENGTH(data-value) RIDFLD(data-area)END-EXEC.

READNEXT command is used to read a record of a file sequentially forward

Before READNEXT, a STARTBR command must be issued, otherwise INVREQ exceptional condition is raised

SET option can also be used instead of INTO option.

RIDFLD data area must be the same area as the one specified for STARTBR. However the contents of the field may be changed. (It can only be greater than the last record used). This is referred to as skip sequential process.

Exceptional conditions associated with REDNEXT command are

DUPKEY : The key of the record is a duplicate of the next record’s keyENDFILE : The end of the file detected.LENGERR : The actual record length is greater than the length specified.

Not for sale Page 26

Page 27: CICS BY Asad

Asad Privet 2011

READPREV Command

EXEC CICS READPREV DATASET(name) / FILE(name) INTO(data-area) RIDFLD(data-area) LENGTH(data-value)END-EXEC.

READPREV command is used to read a record of a file backward.The STARTBR command must have been successfully completed prior to issuing READPREV command.

Exceptional conditions associated with READPREV command.

INVREQ : The GENERIC option must not be used in the STARTBR command prior to READPREV command. If the READPREV command is issued after the Generic STARTBR command, the INVREQ exceptional condition occurs.NOTFND : The specified record in STARTBR or RESETBR is not found.

RESETBR Command

EXEC CICS RESETBR DATASET(name) / (FILE(name) RIDFLD(data-area) GTEQ / EQUAL / GENERICEND-EXEC.

The RESETBR command is used to re-establish another starting point with in the same browse operation against the same file.

The RESETBR command performs exactly the same function as the STARTBR command

Must be issued only if STARTBR has been previously issued.

RIDFLD provides the area where the new key is stored.

Used to change the characteristics of the browse operation. For example from generic key positioning to full key positioning or vice versa.

Exceptional condition associated with RESETBR

Not for sale Page 27

Page 28: CICS BY Asad

Asad Privet 2011

INVREQ : The RESETBR command is issued without the prior STARTBR command

ENDBR command

EXEC CICS ENDBR DATASET(name)END-EXEC.

The ENDBR operation is used to terminate the browse operation, which was initiated by prior STARTBR command.

Sequential Reading of VSAM / ESDS File

Similar to VSAM / KSDS file. VSAM/ESDS file can be read sequentially forward or backward using STARTBR, READNEXT and READ PREV by using RBA option.

Define a full word BINARY field S9(8) COMP for RBA ( Relative Byte address)

ISSUE STARTBR command with EQUAL and RBA options

GTEQ option is not valid for VSAM/ESDS file

EQUAL option is used instead of GTEQ option.

The other options and parameters are same as the options specified in the STARTBR command for VSAM/KSDS

Temporary Storage Queues

Temporary Storage QueuesThe temporary program (TSP) provides the application program with an ability to do store and retrieve the data in a temporary storage queue (TSQ)

TSQ can be used as scratch pad memory.

TSQ can be created and deleted dynamically by an application program without specifying anything in CICS control tables.

Temporary storage queue which are to recovered in the event of failure should be registered in TST (Temporary Storage Table)

A TSQ is identified by the queue id (1 to 8 bytes).

Not for sale Page 28

Page 29: CICS BY Asad

Asad Privet 2011

A record in a TSQ can be read any number of times, they can be read both sequentially and randomly and records in a TSQ can also be updated.

TSQ can be written in the main storage or in the auxiliary storage. If the TSQ is written in main storage, accessing TSQ is very fast but TSQ in this mode is not recoverable.

TSQ which is written in auxiliary storage (external VSAM file) can be recoverable.

WRITEQ TS Command

EXEC CICS WRITEQ QUEUE (name) FROM (data-area) LENGTH (data-value) ITEM (data-area) REWRITE MAIN / AUXILIARY NOSUSPENDEND-EXEC.

The WRITEQ command is used to write a record (item) in a TSQ.

LENGTH indicates the length of data records. It is a half word binary (S9(4) COMP) ITEM specifies the relative position number. It is defined as a half word binary (S9(4) COMP)MAIN : specifies main storage.AUXILIARY : specifies auxiliary storage. This is default.REWRITE : Option is used to rewrite a record in a TSQ, which has been read.NOSUSPEND : If no space is detected in the TSQ for the new record, CICS will return the control to the next statement after the WRITEQ command instead of suspending the task if NOSUSPEND is specified in the WRITEQ command.

At the end of the write command CICS places item number of the record written into ITEM parameter.

Exceptional condition to WRITEQ are: NOSPACE Sufficient space is not available. The default action is suspend the task untill space is available.

READQ TS Command

EXEC CICS READQ

Not for sale Page 29

Page 30: CICS BY Asad

Asad Privet 2011

QUEUE (name) INTO (data-area) / SET (data-area) LENGTH (data-area) ITEM (data-value) / NEXT END-EXEC.

The READQ command is used to read all the records in a TSQ sequentially or to read a particular record randomly.

INTO determines the area to which the record data is to be placed.LENGTH indicates the length of the record to be read.ITEM indicates item number of the record to be read.SET option can also be used instead of INTO option.

Other options of the READQ command is

NUMITEMS Specify NUMITEMS (data-area) in READQ command. The data area defined as S9(4) COMP. At the completion of the read command, CICS will place the actual number of the records in the TSQ specified. NEXT if this option is specified, task will read the next sequential record in the TSQ specified. This option should be used very carefully.

Exceptional conditions are QIDERR : The specified QID is not found.ITEMERR : The specified item number is not found. For sequential read it indicates end of the queue.

DELETEQ TS Command

EXEC CICS DELETEQ TS QUEUE (name)END-EXEC.

The DELETEQ command is used to delete a TSQ entirely.Cannot delete a single item from the TSQ.

Exceptional conditions are QIDERR : The specified QID is not found.

CONVERSATIONAL AND PSEUDO CONVERSATIONAL TECHNIQUES

Not for sale Page 30

Page 31: CICS BY Asad

Asad Privet 2011

Conversational modeA program accomplish a conversation by simply sending a message to the terminal waiting for the user to respond and receiving the response from the terminal.

This is very inefficient way of conversing because program waits until the use responds and hold the resources unnecessarily.

Pseudo-Conversational ModeIn this, program will not wait until the user responds. Terminating the task every time the application needs a response from the user and specifying the next transaction to be started when the end user presses any6 attention key (enter PF1, PF24, PA1-PA3).From the System point of view it is a Multi Tasking operation but from the User point of view it is a Conversational method

There are 3 types of techniques for the above.

Technique 1 : Multiple transaction identifiers and multiple programs. It involves many PCT entries and many PPT entries. Easy to develop but increases the number of entries.

Technique 2 : Multipe transaction Identifiers but One program. This involves many PCT entries but will have one PPT entry Which contains many logical but one physical file.

Technique 3 : One trasnaction Identifier and One program. This is the most Preferred technique. This contains one PCT entry for One PPT entry. The physical program will have many logical programs with in it. Every time the control is RETURNED to the same Transid. To achieve the above EIBCALEN and COMMAREA is used in the program logic.

Non conversational ModeProgram does not involve any conversation. The transaction in this mode is one-way transaction for output only, such asReport writingMessage switching.

TRANSACTION, TASK and PROGRAMTransaction:An exchange between a terminal and a data base representing an application process.

Not for sale Page 31

Page 32: CICS BY Asad

Asad Privet 2011

For example an inquiry or a deposit and balance updates.

Task:A specific instance of a transaction, that is a unique unit of work. Multiple terminals may invoke the same transaction.

Program:A program is a set of instructions to perform some unit of work (i.e. CICS task).

Flow Of Transaction1. Read input message : - TCP gets control- Validate terminal existence from TCT - Through SCP acquire terminal input output area (TIOA) in the dynamic storage area (DSA)- Updates TCTTE ( Terminal Entry of TCT ) with address of TIOA- Requests initiation of task thru KCP

2. Start the transaction :- KCP validates transaction by searching PCT- Acquire any area (TWA) and assigns a task sequence number- Links TCTTE & TCA with pointers- Passes control to program control

3. Process the input :- PCP checks PPT for load module - Loads the program in DSA - Creates a copy at working storage in DSA and links to TCA - Application program gets control & reads input message from TIOA

4. Read the record :- Application program calls FCP / Databases

5. Prepare the output :- Application program calls TCP and sends the formatted message.

6. End the transaction :- Task control releases all storage associated with this task. 7. Write the output :- TCP sends output from TIOA to terminal as soon as communication line to terminal is free.- Releases TIOA

Not for sale Page 32

Page 33: CICS BY Asad

Asad Privet 2011

- Begins polling for new transaction.

Various ways of Initiating a CICS Transaction.

By a Transaction identifier entered in a terminal with Enter Key.

By a transaction Identifier associated with a Terminal for Psuedo conversation.

By a START command which initiates a transaction specified in the Parameter.

By ATI . The destination control table entry for an intra partition transient data queue can have a trigger level parameter and the associated CICS transaction to be initiated if the trigger level is reached.By a 3270 attention identifier. For the IBM 3270 type terminals any of the PFKEYS and PA KEYS could be defined in PCT to initiate a CICS transaction.

MULTITASKING AND MULTITHREADING

Multitasking:Multitasking means that the operating system allows more than one task to be executed concurrently,regardless of whether the tasks use the same program or different programs.

Multithreading:Multithreading is the system environment where the tasks are sharing the same program under the multitasking environment. Multithreading is a subset of multitasking ,since it concerns tasks which use the same program.Under the multithreading environment ,a program is shared by several tasks Concurrently .For each task ,the program( ie instructions and data area)must work as if it were executing instructions exclusively for each task.Therefore,it requires special considerations such as reentrancy.

INTERVAL CONTROL

INTERVAL CONTROLCICS interval control program (ICP) provides application program with time-controlled functions, such as the time-oriented task synchronization, providing current data and time, and the automatic initiation of the time oriented tasks.

Available commands are ASKTIME To request the current date and time.FORMATTIME To select a format of date and time.

Not for sale Page 33

Page 34: CICS BY Asad

Asad Privet 2011

DELAY To delay the processing of task.START To start a transaction and store data for the task.RETRIEVE To retrieve the data stored by the start command for a transaction. CANCEL To cancel the effect of the previous interval control command.

ASKTIME CommandEXEC CICS ASKTIMEEND-EXEC. Used to request current data and time.Upon completion of the command EIBDATE and EIBTIME fields will be updated to have the current data and time.

FOMATTIME CommandEXEC CICS FORMATTIME [YYDDD (data-area)] [YYMMDD (data-area)] [YYDDMM (data-area)] [MMDDYY (data-area)] [DDMMYY (data-area)] [DATESEP (data-value)] [DAYOFWEEK (data-area)] [DAYOFMONTH (data-area)] [DAYOFYEAR (data-area)] [YEAR (data-area)] [TIME (data-area)] [TIMESEP (data-area)]END-EXEC.

Used to retrieve the information of date and time in various formats.

The default date separator (DATSEP) is ‘/ ’

The default time separator (TIMESEP) is ‘: ’

DELAY CommandEXEC CICS DELAY INTERVAL (hhmmss) / TIME (hhmmss) REQID (name)END-EXEC.

Not for sale Page 34

Page 35: CICS BY Asad

Asad Privet 2011

Used to delay the processing of a task for the specified time interval or until the specified time.

EXEC CICS DELAY INTERVAL (1000) REQID (‘KLMN’)END-EXEC.

START Command.EXEC CICS START INTERVAL(hhmmsss) / TIME(hhmmss) TRANSID(name) REQID(name) FROM(data-area) LENGTH(data-value) TERMID(name)END-EXEC.Used to start a transaction at the specified terminal and at the specified time or interval. Date can be passed to the to-be-initiated transaction.

TRANSID Defines the transaction Id of a transaction which is to be initiated.

TERMID Defines the terminal id of a terminal in which the transaction is initiated.

TIME & INTERVAL Indicates the time interval of the transaction initiation.Other options used with START command are

RTRANSID To pass the transaction id (4 bytes) of the return transaction which initiated the new transaction.

RTERMID To pass the terminal id (4 bytes) of the return terminal where the current transaction is being executed.

QUEUE To pass the queue id(8 bytes) of a TSQ.

RETRIEVE CommandEXEC CICS RETRIEVE INTO(data-area) LENGTH(data-value) RTRANSID(name) RTERMID(name)

Not for sale Page 35

Page 36: CICS BY Asad

Asad Privet 2011

QUEUE(name)END-EXEC.

Used to retrieve the data passed by START command RTRANSID(4 BYTES), RTERMID(4 bytes) and QUEUE ( 8 bytes) define the fields to which the transaction id, terminal id, and QID passed by the START command are to be placed.The CICS task control program(KCP) provides functions of synchronization of task activities and exclusive control of resources.

Available commands are

SUSPEND To Suspend a taskENQ To gain exclusive control over a resource.DEQ To release exclusive control from a resource.

SUSPEND Command.

SUSPEND Command.EXEC CICS SUSPENDEND-EXEC.Used to suspend a task. During the execution of this command, the task will be suspended and control will be given to other tasks with higher priority. As soon as higher priority task have been executed control will be returned to the suspended task. ENQ and DEQ commandsThe ENQ command is used to gain exclusive control over a resource.

EXEC CICS ENQ RESOURCE(queue-id) END-EXEC

The DEQ command is used to free the exclusive control over the resource.

EXEC CICS DEQ RESOURCE(queue-id) END-EXEC.

Other options are

LENGTH : If the resource is a character string, the LENGTH parameter must be Specified in both ENQ and DEQ commands. The half word

Not for sale Page 36

Page 37: CICS BY Asad

Asad Privet 2011

binay (S9(4) COMP) must have the length of character string.

NOSUSPEND : If this option is specified, even if ENQBUSY condition occurs, control will be returned to the statement after the ENQ command.

Exceptional condition to ENQ command is

ENQBUSY : The resource specified is reserved to another task. The task will be Suspended until the resource is freed by other task.

CICS Supplied Transactions ID’S Execution Diagnostic facility (CEDF)Command Level Interpreter ( CECI)Temporary Storage Browse (CEBR)MASTER Terminal Transaction ( CEMT)CICS supplied Message and Codes ( CICS )Logoff transaction (CESF)Logon transactions(CESN,CSSN)

Command Level Interpreter (CECI)

It is a CICS supplied transaction checks the syntax of CICS command. If the syntax is satisfied it will actually execute the command.

CECI SEND MAP(MAPNAME)

Temporary Storage Browse(CEBR)

It is a CICS supplied transaction used to browse the temporary storage queue (TSQ).It is a very convenient tool if we wish to display the content of TSQ when monitoring an application program through EDF.

Master Terminal Transaction (CEMT)It is a CICS supplied transaction, which manipulates the CICS environment such as transactions,Programs, files, TSQ and tasks.

The CEMT transaction performs the following major functions.

INQUIRE : To inquire about the status of CICS environment.SET : To update the status of CICS environment

Not for sale Page 37

Page 38: CICS BY Asad

Asad Privet 2011

Opens or closes the file Enables or disables a transaction Issues new copy.

CICS supplied transactions

List of CICS transactionsThe following table lists all the transactions that are supplied with CICS.

Transaction is the transaction identifier. Program indicates the program that is specified in the supplied transaction definition.

CEBR - temporary storage browseUse the CEBR transaction to browse temporary storage queues and to delete them. You can also use CEBR to transfer a transient data queue to temporary storage in order to look at its contents, and to recreate the transient data queue when you have finished. The CEBR commands that perform these transfers allow you to create and delete transient data queues as well.

CEBT - master terminal (alternate CICS)Use CEBT to control an alternate CICS system in an extended recovery facility (XRF) environment.

CECI - command-level interpreterUse CECI, which invokes the CICS command-level interpreter, to enter an EXEC CICS command, check its syntax, and modify it if necessary. In most cases, you can also process the command.

CEDA - resource definition onlineUse CEDA to define resources to your CICS system while the system is running. With CEDA, you can update both the CICS system definition (CSD) file and the running CICS system.

Not for sale Page 38

Page 39: CICS BY Asad

Asad Privet 2011

CEDF and CEDX - the execution diagnostic facilityThe CICS execution diagnostic facility (EDF) provides two transactions that you can use for testing application programs.

CEMT—master terminalUse CEMT to invoke all the master terminal functions.The master terminal program provides dynamic user control of the CICS system. By using this function, an operator can inquire about and change the values of parameters used by CICS, alter the status of the system resources, terminate tasks, and shut down the CICS system.

Starting the CEMT transactionYou can construct a CEMT request in stages, or you can enter a complete request in one go. The CEMT transaction checks the syntax of requests and diagnoses errors. If your request is syntactically correct, it is processed immediately. If your request cannot be processed because of severe syntax errors, the full syntax of your request is displayed.

CEMT DISCARD commandsThe DISCARD command allows you to remove an installed resource definition and its corresponding catalog entry from an active CICS system.

CEMT INQUIRE commands

CEMT PERFORM commands

CEMT SET commandsThe SET command changes the status of one or more named instances of a resource (such as a terminal), a particular subgroup of resources (such as a class of terminals), or all resources of a particular type (such as all terminals).

CESF - sign offUse the CESF transaction to sign off from the CICS system.

CESN - sign on

CETR - trace controlUse CETR to control CICS tracing activity.

IMP CICS commands

CICS API commands

Not for sale Page 39

Page 40: CICS BY Asad

Asad Privet 2011

ABENDTerminate a task abnormally. ABEND terminates a task abnormally. CICS releases the main storage that is associated with the terminated task; optionally, you can obtain a dump of this storage first. The following example shows how to terminate a task abnormally:

EXEC CICS ABEND ABCODE('BCDE')

ACQUIREAcquire access to a BTS activity from outside the process that contains it.

ADDRESSObtain access to CICS storage areas.

ADDRESS gets access to the following areas: • The communication area that is available to the invoked program (COMMAREA) • The common work area (CWA) • The EXEC interface block (EIB) • The terminal user area (TCTUA) • The transaction work area (TWA)

ALLOCATE ALLOCATE requests a conversation with a remote region. CICS returns the four-byte CONVID (conversation identifier) in the EIBRSRCE field of the EIB. The application program uses the CONVID in all subsequent commands that relate to the conversation. If the session is not available, the application is suspended until one is available; this is the default action. ASKTIMERequest current date and time of day. ASKTIME updates the date (EIBDATE) and CICS time-of-day clock (EIBTIME) fields in the EIB. These two fields initially contain the date and time of when the task started.ASSIGNRequest values from outside the application program's local environment.

ASSIGN obtains values from outside the local application program environment. The data that is obtained depends on the specified options. You can specify up to 16 options in one ASSIGN command.

CANCELCancel interval control requests.

Not for sale Page 40

Page 41: CICS BY Asad

Asad Privet 2011

CANCEL cancels a previously issued DELAY, POST, or START command. The effect of the cancelation varies depending on the type of command that is being canceled, as follows:

A DELAY command can be canceled only before it expires. The task that issued the DELAY command is suspended for the duration of the request, so that it can be canceled only by another task. You must specify the REQID that is used by the suspended task. Canceling the command has the same effect as the early expiration of the original DELAY. The suspended task becomes dispatchable, as though the expiration time of the original has been reached. When a START command is to be canceled, you must specify the REQID of the original command. The effect of the cancelation is as if the original command was never made. The cancelation is effective only before the expiration of the original command. It is not possible to cancel a START command that is currently locally queued.

CONVERTTIMEConverts an architected date and time stamp string to the ABSTIME format.

DELAYDelay the processing of a task. DELAY suspends the processing of the issuing task for a specified interval of time or until a specified time of day. The following example shows how to suspend the processing of a task for five minutes, using the INTERVAL option: EXEC CICS DELAY INTERVAL(500) REQID('GXLBZQMR')The following example shows how to suspend the processing of a task until 12:45 p.m., using the TIME option: EXEC CICS DELAY TIME(124500) REQID('UNIQCODE')DELETEDelete a record from a file — VSAM KSDS, VSAM RRDS, and data tables only.

DELETE deletes a record from a KSDS, a KSDS through an alternative index path, or an RRDS. The file can be on a local or a remote system. Note that DELETE cannot delete records from an ESDS. Three forms of this command are available:

You identify, in the RIDFLD option, the specific record that is to be deleted.

You can delete a group of records in a similar way with a single invocation of this command. You use the

Not for sale Page 41

Page 42: CICS BY Asad

Asad Privet 2011

GENERIC option to identify the group.

You can use a different form of this command to delete a single record that has previously been retrieved for update (by a READ UPDATE command). The record is deleted, instead of being rewritten, by this command. In this case, you must not specify the RIDFLD option.

The following example shows how to delete a group of records in a file:

EXEC CICS DELETE FILE('MASTFILE') RIDFLD(ACCTNO) KEYLENGTH(4) GENERIC NUMREC(NUMDEL)

DELETEQ TDDelete all transient data.

DELETEQ TSDelete a temporary storage queue.

DEQSchedule use of a resource by a task (dequeue).

ENDBREnd browse of a file.

ENQSchedule use of a resource by a task (enqueue).

FORMATTIMETransform absolute date and time into a specified format.

FREEReturn a terminal or logical unit.

FREEMAINRelease main storage acquired by a GETMAIN command.

GETMAIN

Not for sale Page 42

Page 43: CICS BY Asad

Asad Privet 2011

Get main storage.

HANDLE ABENDHandle an abnormal termination exit.

HANDLE AIDHandle attention identifiers (AIDs).

HANDLE CONDITIONHandle conditions.

IGNORE CONDITIONIgnore conditions.

ISSUE ABENDAbend the mapped conversation with an APPC partner.

ISSUE COPY (3270 logical)Copy data from 3270 logical unit.

ISSUE PRINTPrint displayed data on first available printer.

JOURNALCreate a journal record.

LINKLink to another program expecting return. The external CICS interface (EXCI) provides a LINK command that performs all six commands of the interface in one invocation. See the CICS External Interfaces Guide for information about the EXCI.

LOADLoad a program from the CICS DFHRPL concatenation library into main storage.

POP HANDLERestore the stack.

POST

Not for sale Page 43

Page 44: CICS BY Asad

Asad Privet 2011

Request notification when a specified time has expired.

PURGE MESSAGEDiscontinue building a BMS logical message.

PUSH HANDLESuspend the stack.

READRead a record from a file.

READNEXTRead next record during a browse of a file.

READPREVRead previous record during a file browse; VSAM and data tables only.

READQ TDRead data from the transient data queue.

READQ TSRead data from temporary storage queue.

RECEIVE MAPReceive screen input into an application data area.

RELEASERelease a loaded program, table, or mapset.

RESETBRReset start of browse.

RETRIEVERetrieve data stored for a task.

RETURNReturn program control.

REWRITEUpdate a record in a file.

Not for sale Page 44

Page 45: CICS BY Asad

Asad Privet 2011

SEND CONTROLSend device controls to a terminal without map or text data. The keywords are separated into those supported by minimum, standard, and full BMS.

SEND MAPSend mapped output data to a terminal. The keywords are separated into those supported by minimum, standard, and full BMS.

SEND PAGESend last page of data. Only supplied by full BMS.

SEND PARTNSETThis command is available on standard and full BMS only.

SEND TEXTSend data without mapping. The keywords are separated into those supported by standard and full BMS.

SIGNOFFSign off from a terminal.

SIGNONSign on to a terminal.

STARTStart task at a specified time.

STARTBRStart browse of a file.

SUSPENDSuspend a task.

SYNCPOINTEstablish a syncpoint.

SYNCPOINT ROLLBACKBack out to last syncpoint.

UNLOCKRelease exclusive control.

Not for sale Page 45

Page 46: CICS BY Asad

Asad Privet 2011

WAIT EVENTWait for an event to occur.

WRITEWrite a record.

WRITEQ TDWrite data to transient data queue.

WRITEQ TSWrite data to a temporary storage queue.

XCTLTransfer program control.

The DFHAID copy book

Attention identifier constants list (DFHAID)

The standard attention identifier list, DFHAID, simplifies the testing of the contents of the EIBAID field after a Basic Mapping Support (BMS) or terminal control input operation. The following table shows the symbolic name for each attention identifier (AID) value and the corresponding 3270 function.

You can get the standard attention identifier list by including the DFHAID copybook in your application program:

For COBOL users, it consists of an 01 statement and a set of 02 statements that must be copied into the working storage section, as follows:

COPY DFHAID

For C or C++ users, it consists of a series of defined constants that are included in the application program as follows:

#include <dfhaid.h>

For PL/I users, it consists of DECLARE statements defining elementary character variables as follows:

%include DFHAID

Not for sale Page 46

Page 47: CICS BY Asad

Asad Privet 2011

Standard DFHAID

The DFHBMSCA copy book

Field attributes and printer control characters

The standard list DFHBMSCA simplifies the provision of field attributes and printer control characters.

Bit map of attributes shows a bit map of attributes to help you do this. Attributes and orders can be set only by their constant names or by their associated graphic values (for example, "A" for unprotected and Modified Data Tag (MDT) set).

You can get the standard attribute and printer character control list by including the DFHBMSCA copybook in your application program.

For COBOL users, it consists of an 01 statement and a set of 02 statements that must be copied into the working storage section, as follows:

COPY DFHBMSCA

For C or C++ users, it consists of a series of defined constants that are included in the application program as follows:

#include <dfhbmsca.h>

For PL/I users, it consists of DECLARE statements defining elementary character variables as follows:

Not for sale Page 47

Page 48: CICS BY Asad

Asad Privet 2011

%include DFHBMSCA;

You must use the symbolic name DFHDFT in the application structure to override a map attribute with the default. On the other hand, to specify default values in a Set Attribute (SA) sequence in text build, you should use the symbolic names DFHDFCOL, DFHBASE, or DFHDFHI.

Standard Attribute and Printer Control Character List, DFHBMSCA

Not for sale Page 48

Page 49: CICS BY Asad

Asad Privet 2011

Not for sale Page 49

Page 50: CICS BY Asad

Asad Privet 2011

Not for sale Page 50

Page 51: CICS BY Asad

Asad Privet 2011

Notes:

1 Ignored on TXSeries for Multiplatforms. 2 Use for constructing embedded Set Attribute (SA) orders in user text or for constructing datastreams with Start Field Extended (SFE) orders. 3 Ignored by cicsterm but can be used for transaction routing to other terminals.

Bit map of attributes

As an alternative to using the symbolic values that are given in Table 29, you can construct attribute bytes by using the following table. For portability of applications between EBCDIC and ASCII systems, the value in the char column should be used. Note that existing applications that have been developed on an EBCDIC system can use the hexadecimal values that are listed in the EBCDIC column. These should be changed to the char values to run on CICS.

Attributes:

prot: Protection

spd: Selector pen detectable (see note)

a/n: Autoskip or numeric

hi: High intensity

ndp: Non-display print

Not for sale Page 51

Page 52: CICS BY Asad

Asad Privet 2011

mdt: Modified Data Tag

Hex (and other) codes:

EBCDIC: Extended Binary-Coded Decimal Interchange Code

ASCII: American National Standard Code for Information Interchange

char: Graphic character equivalent to hex code

Characters that are used for attributes in the body of the table:

U: Unprotected

N: Numeric

H: High intensity

P: Protected

S: Autoskip

Y: Yes

EXEC Interface block

EXEC Interface Block

This information describes the fields of the EXEC Interface Block (EIB). An application program can read all the fields in the EIB of the associated task by name, but must not change the contents of any of them.

For each field, the contents and format (for each of the application programming languages, COBOL, C, C++, or PL/I) are given. All fields contain zeros in the absence of meaningful information. Fields are listed in alphabetic sequence.

EIBAID

This EIB field contains the attention identifier (AID) that is associated with the last terminal control or Basic Mapping Support (BMS) input operation from a display device such as a terminal. For COBOL: PIC X(1)

Not for sale Page 52

Page 53: CICS BY Asad

Asad Privet 2011

For C or C++ : For C: cics_char_t eibaid; For PL/I: CHAR(1)

EIBATT

This EIB field indicates that the request/response unit (RU) contains attach header data (X'FF'). For COBOL: PIC X(1) For C or C++ : cics_char_t eibatt; For PL/I: CHAR(1)

EIBCALEN

This EIB field contains the length of the communication area that has been passed to the application program from the last program, using the COMMAREA and LENGTH options. If no communication area is passed, this field contains zeros. For COBOL: PIC S9(4) COMP For C or C++ : cics_ushort_t eibcalen; For PL/I: FIXED BIN(15)

EIBCOMPL

This EIB field indicates, on a terminal control RECEIVE or CONVERSE command, whether the data is complete (X'FF'). If the NOTRUNCATE option has been used on the RECEIVE or CONVERSE command, CICS retains data in excess of the amount that is requested via the LENGTH or MAXLENGTH option. EIBRECV is set to indicate that further RECEIVE or CONVERSE commands are required. EIBCOMPL is not set until the last of the data has been received.

EIBCOMPL is always set when a RECEIVE or CONVERSE command without the NOTRUNCATE option is executed. For COBOL: PIC X(1) For C or C++ : cics_char_t eibcompl; For PL/I: CHAR(1)

EIBCONF

This EIB field indicates that the conversational partner has issued a CONFIRM request (X'FF') and that a response is required. For COBOL: PIC X(1) For C or C++ : cics_char_t eibconf; For PL/I: CHAR(1)

Not for sale Page 53

Page 54: CICS BY Asad

Asad Privet 2011

EIBCPOSN

This EIB field contains the cursor address (position) that is associated with the last terminal control or Basic Mapping Support (BMS) input operation from a display device such as a terminal. For COBOL: PIC S9(4) COMP For C or C++ : cics_ushort_t eibcposn; For PL/I: FIXED BIN(15)

EIBDATE

This EIB field contains the date the task is started (this field is updated by the ASKTIME command). The date is in packed decimal form (0CYYDDD+) where C shows the century with values 0 for the 1900s and 1 for the 2000s. For example, the dates 31 December 1999 and 1 January 2000 have EIBDATE values of 0099365 and 0100001 respectively.

For COBOL: PIC S9(7) COMP-3 For C or C++ : cics_char_t eibdate [4]; For PL/I: FIXED DEC(7,0)

EIBDS

This EIB field contains the symbolic identifier of the last file that was referenced by a file control request.

For COBOL: PIC X(8) For C or C++ : cics_char_t eibds [8]; For PL/I: CHAR(8)

EIBEOC

This EIB field is set to X'FF' after a successful advanced program-to-program communications (APPC) RECEIVE or CONVERSE; otherwise it is not set. (An APPC conversation allows a program to send data to, and receive data from, a program that is running in a remote system. Programming that uses APPC conversations is called Distributed Transaction Programming (DTP). For guidance information on DTP, refer to the TXSeries for Multiplatforms Intercommunication Guide.)

For COBOL: PIC X(1) For C or C++ : cics_char_t eibeoc; For PL/I: CHAR(1)

EIBERR

Not for sale Page 54

Page 55: CICS BY Asad

Asad Privet 2011

This EIB field indicates that an abnormal condition has occurred (X'FF') on an APPC conversation. The error code is in EIBERRCD. For COBOL: PIC X(1) For C or C++ : cics_char_t eiberr; For PL/I: CHAR(1)

EIBERRCD

This EIB field when EIBERR is set, contains the error code that has been received. The following values can be returned in the first two bytes of EIBERRCD: For COBOL: PIC X(4) For C or C++ : cics_char_t eiberrcd [4]; For PL/I: CHAR(4)

EIBFMH

This EIB field indicates that the user data just received or retrieved contains an FMH (X'FF'). This cannot arise in TXSeries for Multiplatforms, which always sets this field toX'00'. For COBOL: PIC X(1) For C or C++ : cics_char_t eibfmh; For PL/I: CHAR(1)

EIBFN

This EIB field contains a code that identifies the last CICS command to be issued by the task (updated when the requested function has been completed). For COBOL: PIC X(2) For C or C++ : cics_char_t eibfn [2]; For PL/I:CHAR(2)

EIBFREE

This EIB field indicates that the application program cannot continue using the facility. The receiver must issue a FREE command for the conversation. For COBOL: PIC X(1) For C or C++ : cics_char_t eibfree; For PL/I: CHAR(1)

EIBLABEL

Not for sale Page 55

Page 56: CICS BY Asad

Asad Privet 2011

This field, which is used for COBOL programs only, is used to contain values that relate to handled conditions or abends. The values are: • 0: RETURN or XCTL • 1: Abend • 2 to nn: A value that identifies a label for a handled condition or abend

EIBNODAT

This EIB field indicates that no data has been sent by the remote application (X'FF'). A message has been received from the remote system that conveyed only control information. For example, if the remote application executed a SEND command with a WAIT option, any data would be sent across the link. If the remote application then executes a SEND INVITE command without using the FROM option to transmit data at the same time, it would be necessary to send the INVITE instruction across the link by itself. In this case, the receiving application finds EIBNODAT set. The use of this field is restricted to application programs that are holding conversations across APPC links only.

For COBOL: PIC X(1) For C or C++ : cics_char_t eibnodat; For Pl/I: CHAR(1)

EIBRCODE

This EIB field contains the CICS response code that is returned after the function that was requested by the last CICS command to be issued by the task has been completed. For a normal response, this field contains hexadecimal zeros (X'00'). For COBOL programs only, almost all the information that is in this field can be used within application programs by the HANDLE CONDITION command.

For COBOL: PIC X(6) For C or C++ : cics_char_t eibrcode [6]; For PL/I: CHAR(6)

The following list shows the EIBRCODE values that correspond to the conditions that can occur for each group of commands (as indicated by byte 0 of EIBFN), together with the names of the associated conditions. For some conditions, further information is provided in EIBRCODE. This is indicated by a note that follows the list of values. For some commands (for example, INQUIRE and SET), byte 3 of EIBRCODE contains the hexadecimal equivalent of the value in EIBRESP. Any further information that relates to conditions that are occurring on these commands can be found in EIBRESP2 rather than EIBRCODE. The RESP2 values are given in the

Not for sale Page 56

Page 57: CICS BY Asad

Asad Privet 2011

descriptions of the individual commands.

EIBRECV

This EIB field indicates that the application program is to continue receiving data from the facility by executing RECEIVE commands (X'FF'). For COBOL: PIC X(1) For C or C++ : cics_char_t eibrecv; For PL/I: CHAR(1)

EIBREQID

This EIB field contains the request identifier that is assigned to an interval control command by CICS; this field is not used when a request identifier is specified in the application program. For COBOL: PIC X(8) For C or C++ : cics_char_t eibreqid [8]; For PL/I: CHAR(8)

EIBRESP

This EIB field contains a 32-bit binary number that corresponds to the condition that has occurred.. For COBOL: PIC S9(8) COMP For C or C++ : cics_slong_t eibresp; For PL/I: FIXED BIN(31)

EIBRESP2

This EIB field contains more detailed information that can help explain why the condition that is indicated by EIBRESP has occurred. For TXSeries for Multiplatforms, this field contains meaningful values for SET commands only. The relevant values are documented with each command as applicable. For COBOL: PIC S9(8) COMP For C or C++ : cics_slong_t eibresp2; For PL/I: FIXED BIN(31)

EIBRLDBK

This EIB field indicates that the remote transaction has sent SYNCPOINT ROLLBACK in response to a SYNCPOINT request (X'FF'). The transaction that issued the SYNCPOINT command has been rolled back. For COBOL: PIC X(1) For C or C++ : cics_char_t eibrdbk; For PL/I: CHAR(1)

Not for sale Page 57

Page 58: CICS BY Asad

Asad Privet 2011

EIBRSRCE

This EIB field contains the symbolic identifier of the resource that is being accessed by the last API command to be issued by the task. For COBOL: PIC X(8) For C or C++ : cics_char_t eibrsrce [8]; For PL/I: CHAR(8)

EIBSIG

This EIB field indicates that the conversation partner has issued an ISSUE SIGNAL command (X'FF'). For COBOL: PIC X(1) For C or C++ : cics_char_t eibsig; For PL/I: CHAR(1)

EIBSYNC

This EIB field indicates that CICS syncpointing is in progress and that the application should issue a SYNCPOINT command. For COBOL: PIC X(1) For C or C++ : cics_char_t eibsync; For PL/I: CHAR(1)

EIBSYNRB

This EIB field indicates that CICS syncpointing is in progress and that the application program should issue a SYNCPOINT ROLLBACK command (X'FF'). This field is set only in application programs that are holding a conversation on an APPC link. For COBOL: PIC X(1) For C or C++ : cics_char_t eibsynrb; For PL/I: CHAR(1)

EIBTASKN

This EIB field contains the task number that is assigned to the task by CICS. This number appears in trace entries that are generated while the task is in control. For COBOL: PIC S9(7) COMP-3 For C or C++ : cics_char_t eibtaskn [4];

Not for sale Page 58

Page 59: CICS BY Asad

Asad Privet 2011

For PL/I: FIXED DEC(7,0)

EIBTIME This EIB field contains the time at which the task is started (this field is updated by the ASKTIME command). The time is in packed decimal form (0HHMMSS+). For COBOL: PIC S9(7) COMP-3 For C or C++ : cics_char_t eibtime [4]; For PL/I: FIXED DEC(7,0)

EIBTRMID This EIB field contains the name of the principal facility that is associated with the task. For a back-end transaction, it is the conversation identifier (CONVID). This name must be acquired if the program states explicitly the CONVID for the principal facility. For COBOL: PIC X(4) For C or C++ : cics_char_t eibtrmid [4]; For PL/I: CHAR(4)

EIBTRNID

This EIB field contains the symbolic transaction identifier of the task. For COBOL: PIC X(4) For C or C++ : cics_char_t eibtrnid [4]; For PL/I: CHAR(4)

Not for sale Page 59