Top Banner

of 184

cics mainframes

May 30, 2018

Download

Documents

sankarreddy116
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 8/9/2019 cics mainframes

    1/184

    1

    CICS(Customer Information Control System)

  • 8/9/2019 cics mainframes

    2/184

    2

    Table of Contents

    Introduction to CICS

    Basic Mapping Support

    Program Control

    File Processing Error Handling

    Queues

    Interval and Task Control

    Recovery and Restart Program preparation

    CICS Supplied Transactions

    Case Study

  • 8/9/2019 cics mainframes

    3/184

    3

    Introduction to CICS

    Customer Information Control System -CICS developed in late1960s as a DB/DC control system

    CICS provides an interface between the Operating System and

    application programs Macro Level CICS - initial version Assembler macro to request

    CICS services

    Command Level CICS - high level lang.version - commands torequest CICS services - Single command can replace series of

    macros

  • 8/9/2019 cics mainframes

    4/184

    4

    Batch & Online : Differences

    BATCH SYSTEM2. Input data is prepared and

    given in sequence (file)3. Processing sequence is

    predictable and hencerestarting the process in caseof failure is easy.

    4. Programs and files cant beshared

    5. Programs are scheduledthrough jobs

    6. O/P printed on paper or insequential of VSAM or Indexedfiles

    7. Response time: Could be

    scheduled to be Hours or days

    ONLINE SYSTEM2. Data is entered as needed not

    in sequence (terminal)3. Since processing sequence is

    unpredictable, specialrecovery/restart proc. isrequired in case of failure

    4. Programs and files can beshared

    5. Transaction can be run at anytime

    6. O/p displayed on Terminalupdated files

    7. Response Time: Could be inminutes or second. Usually in

    seconds

  • 8/9/2019 cics mainframes

    5/184

    5

    CICS & Operating System

    Operating SystemOperating System

    CICSCICS

    Users

    App.Files &

    Database

    EnterCode :

  • 8/9/2019 cics mainframes

    6/184

    6

    DB/DC System

    Terminals

    Central System

    Data

    Base

    CICS SystemEnvironment &API routines,and Application

    Programs

  • 8/9/2019 cics mainframes

    7/184 7

    CICS System Services

    Data-Communication Functions

    Data-Handling Functions

    Application Program Services

    System Services

    Monitoring Functions

  • 8/9/2019 cics mainframes

    8/184 8

    Task :- A basic unit of work which is scheduled by the

    operating system or CICS

    Ex -Read from and write to the terminal

    Transaction :- An entity which initiates execution of a task. InCICS, transaction is identified by the transaction identifier(Trans-id)

    Task & Transaction

  • 8/9/2019 cics mainframes

    9/184 9

    Application Programming

    Concepts

    Pseudo-Conversational

    Multitasking

    Multithreading

    Quasi-Reentrancy

  • 8/9/2019 cics mainframes

    10/184 10

    Conversational : A mode of dialogue between program andterminal based on a combination of sending message andreceiving message within the same task

    Since human response is slower than the CPU speed, a

    significant amount of resource will be wasted just waiting

    Pseudo-Conversational. A mode of dialogue between programand terminal which appears to the operator as a continuousconversation but which is actually carried by a series of tasks

    Terminal Conversation

  • 8/9/2019 cics mainframes

    11/184 11

    PROCEDURE DIVISION.:FIRST-PROCESS.

    EXEC CICS RECEIVE ----

  • 8/9/2019 cics mainframes

    12/184 12

    Transaction TSK1Program PROG1

    PROCEDURE DIVISION.:

    EXEC CICS RECEIVEEND-EXEC.

    :EXEC CICS SEND

    END-EXEC.EXEC CICS RETURN

    TRANSID (TSK2)END-EXEC.

    Transaction TSK2Program PROG2

    PROCEDURE DIVISION.:

    EXEC CICSRECEIVE

    END-EXEC.:

    EXEC CICS SEND

    END-EXEC.EXEC CICS RETURNEND-EXEC.

    Pseudo-Conversation Example

  • 8/9/2019 cics mainframes

    13/184 13

    Control Programs (or Management Modules)

    Programs that interface between OS and app. pgm

    Handle the general functions that are crucial to operation of

    CICS Control Tables

    Define the CICS environment

    Functionally associated with the management module

    Control Blocks (or Areas)Contain system type information. Eg. Task Control Area

    contains information about the task

    CICS Components

  • 8/9/2019 cics mainframes

    14/184 14

    Programs

    Program Control PCP

    File control FCP

    Terminal Control TCP

    Task Control KCP

    Temporary Storage TSP

    Transient Data TDP

    Storage Control SCP

    Interval Control ICPJournal Control JCP

    Tables

    Processing ProgramTable PPT

    File Control Table FCTTerminal Control Table TCTProgram Control Table PCTTemp. Storage Table TSTDestin. Control Table DCT

    Mangement Pgms & Ctrl Tables

  • 8/9/2019 cics mainframes

    15/184

    15

    CICS Program Considerations

    Considerations:

    Must eventually return control to CICS

    Cant modify procedure division instructions because CICSprograms may be shared by many tasks

    Can modify working storage since a unique copy of workingstorage is created for each task

  • 8/9/2019 cics mainframes

    16/184

    16

    CICS Program Restrictions

    Restrictions:

    No CONFIG. SECTION, I/O SECTION to be specified in theENVIRONMENT DIVISION.

    FILE SECTION, OPEN, CLOSE, and non-CICS READ & WRITEstatements are not permitted because file management is handledby CICS.

    COBOL commands such as ACCEPT, DISPLAY, EXHIBIT,TRACE, STOP RUN, GOBACK are avoided. (STOP RUN &GOBACK are sometimes included in order to eliminate compilerdiagnostic but never executed)

  • 8/9/2019 cics mainframes

    17/184

    17

    Sample CICS Program

    IDENTIFICATION DIVISION.

    PROGRAM-ID. SAMPLE.

    ENVIRONMENT DIVISION.

    DATA DIVISION.WORKING-STORAGE SECTION.

    01 WS-INPUT.

    05 WS-TRANSID PIC X(4).

    05 FILLER PIC X(1).

    05 WS-IN-EMP-CD PIC X(4) VALUE ALLX.

  • 8/9/2019 cics mainframes

    18/184

    18

    Sample Program (Contd..)

    01 WS-OUTPUT.05 FILLER PIC X(16) VALUE EMP CODE : .05 WS-OUT-EMP-CD PIC X(4).

    01 WS-LENGTH PIC S9(4) COMP.

    LINKAGE SECTION.CAN Include DFHCOMMAREA if data needs to be communicatedbetween two transactions or multiple iterations of the same

    transaction.PROCEDURE DIVISION.

    000-MAINLINE.PERFORM 100-RECV-INPUT.PERFORM 200-SEND-OUTPUT.EXEC CICS RETURN END-EXEC.

  • 8/9/2019 cics mainframes

    19/184

    19

    100-RECV-INPUT. MOVE 9 TO WS-LENGTH.

    EXEC CICS RECEIVEINTO (WS-INPUT) LENGTH (WS-LENGTH)

    END-EXEC.MOVE WS-IN-EMP-CODE TO WS-OUT-EMP-CODE

    200-SEND-OUTPUT. EXEC CICS SEND

    FROM (WS-OUTPUT) LENGTH (20)

    ERASEEND-EXEC.

    Sample Program (Contd..)

  • 8/9/2019 cics mainframes

    20/184

    20

    The CICS translator converts CICS commands into the COBOLcode so that it could be compiled by a Standard Cobol compiler

    CICS program with CICS

    CommandsCICS Translator

    COBOL Statements

    CICS Translator

  • 8/9/2019 cics mainframes

    21/184

    21

    When you compile a CICS/VS program the translator willautomatically add many lines of code to your program, which can

    be seen in the compiled listing

    Translator

  • 8/9/2019 cics mainframes

    22/184

    22

    Basic Mapping Support

  • 8/9/2019 cics mainframes

    23/184

    23

    Topics in BMS

    Introduction to BMS

    Map and Mapset

    Physical and Symbolic Map

    Map Definition Macros

    Screen Manipulation/Handling

    Screen Design Considerations

    Interfacing with Terminal using a Map

  • 8/9/2019 cics mainframes

    24/184

    24

    Introduction to BMSIntroductory concepts

    In online systems, formatted screens are used. In order todisplay formatted screen, a terminal (e.g. 3278) mustreceive a series of data stream called Native Mode DataStream (NMDS) based on the hardware protocol; thisNMDS is a mixture ofBuffer Control Characters (BCCs)and text data. NMDS is designed for a particular terminaland is thus both device dependent and format dependent.So if NMDS is used, re-coding is required whenever there is

    change in the terminal device or screen format. To removethis device and format dependency from applicationprogram, CICS provides a facility called Basic MappingSupport (BMS).

  • 8/9/2019 cics mainframes

    25/184

    25

    Removal of device dependent codes from Application Program

    Removal of constant information from Application program(Headers, Titles...)

    Construct NMDS - Native Mode Data Stream

    Text handling

    Terminal Paging & Message routing

    Contents of the screen defined thru BMS is called Map.

    Map is a program written in assembly language.

    BMS macros are available for Map coding.

    The BMS Macros are coded in the form of Maps, and Mapsets todefine the screen attributes, screen field positions, and fieldcharacteristics.

    Primary Functions of BMS

  • 8/9/2019 cics mainframes

    26/184

    26

    Map and Mapset

    Representation of one screen format is called Map (screen

    panel).

    One or more maps, link edited together, makes up a Mapset

    (load module).

    Mapset must have a entry in PPT as given below:

    DFHPPT TYPE=ENTRY,MAPSET=nameOr DFHPPT TYPE=ENTRY,PROGRAM=name

  • 8/9/2019 cics mainframes

    27/184

    27

    Mapset name has two parts.

    Generic name 1- 7 chars. Used in App. Program.

    Suffix 1 char. To identify the device type

    Multimap Panel

    Dynamically constructing a screen panel with multiple maps at

    the execution time

    Map and Mapset (Contd..)

  • 8/9/2019 cics mainframes

    28/184

    28

    The concepts of map and mapset can be utilized in twotype of cases as given below:

    Case 1: A mapset consist of a single map. For e.g.

    MAPSET1 MAPNUM1

    Case 2: A mapset consists of several maps. For e.g.

    MAPSET2 MAPNUM1

    MAPNUM2

    Map and Mapset (Contd..)

  • 8/9/2019 cics mainframes

    29/184

    29

    Types of MAPSThere are 2 types of MAPS

    Physical Map

    Physical Map is a map used by CICS (CSECT)

    Ensure device independence in the application program

    BMS macro coding ==> Assembly==> Link edit ==> Load module ==>LOADLIB ===> To be used by CICS

    Symbolic Map

    Ensure device and format independence in the application programSymbolic Map is a map used by Application Program (DSECT)

    BMS macro coding ==> Assembly ==> Symbolic map definition ==>COPYLIB ==> Copied (COPY) into CICS application program.

  • 8/9/2019 cics mainframes

    30/184

    30

    01 EMPRECI.02 FILLER PIC X(12).02 EMPNAL PIC S9(4) COMP.02 EMPNAF PIC X.

    02 FILLER REDEFINES EMPNAF.03 EMPNAA PIC X.

    02 EMPNAI PIC X(21).

    01 EMPRECO REDEFINES EMPRECI.

    02 FILLER PIC X(12).02 FILLER PIC X(03).02 EMPNAO PIC X(21).

    Example Symbolic Map

  • 8/9/2019 cics mainframes

    31/184

    31

    Physical & Symbolic Map - Logic Flow

    BMS

    source

    Assembler

    Physical MAP

    Linkage editorSymbolic MAP

    Load module (MVS)

  • 8/9/2019 cics mainframes

    32/184

    32

    Physical Map.

    The BMS macros are assembled and link-edited into CICS loadlibrary to create the physical map. The mapset like any other CICSprogram is stored in CICS runtime library the PPT(Program

    Processing Table). At the program execution time the physicalmap is being used by CICS to load the screen image.

    In case of input operations, the physical map defines themaximum length, the starting position for each field to be read and

    allows BMS to interpret an input NMDS.

    In case of output operations, the physical map defines the startingposition, length, field characteristics and the default data for eachfield and allows BMS to construct an output NMDS.

    Physical Map

  • 8/9/2019 cics mainframes

    33/184

    33

    The symbolic map is coded using the BMS macro, assembledseparately and catalogued into a copy library. The symbolic mapserves as a DSECT for referencing the Terminal Input/Output Area(TIOA). The program issues a COBOL COPY statement to include it

    in the program.

    The symbolic maps represents the actual data structure of the fieldsdefined in the physical map, and is used by the application programto send and receive information from the terminal, in the CICSSEND-MAP & RECEIVE MAP commands.

    The symbolic map can be used by the CICS application programs todynamically to alter the field attributes, modify screen cursor

    position, and highlight , protect , unprotect specific fields on thescreen.

    Symbolic Map

  • 8/9/2019 cics mainframes

    34/184

    34

    Map definition Macros

    General FormatColumn Number1 16 72setname operation operands contd.

    ExampleEMPMAP DFHMSD TYPE=MAP, X

    MODE=INOUT, XLANG=COBOL, XSTORAGE=AUTO, X

    TIOAPFX=YES** ANY COMMENTS

  • 8/9/2019 cics mainframes

    35/184

    35

    Explanations:

    SETNAME : Name of the mapset. Used in CICS commandto read or write one of the maps in the mapset. Itis the load module name.

    OPERATION : Macro identifier. Mapset/Map/Field definition.

    OPERANDS : Optional key words (parameters)separated by comma.

    CONTD : Current line can be continued by leaving

    this column non-blank (usually X) andthe next line have to be started in16th column.

    Comments : * in column 1 makes the line comment.

    Map definition Macros (Contd..)

  • 8/9/2019 cics mainframes

    36/184

    36

    INITIAL VALUES : Always surround initial valuesby single quote marks

    Escape Chars : and &

    Map definition Macros (Contd..)

  • 8/9/2019 cics mainframes

    37/184

    37

    Order of Macros

    DFHMSD TYPE=DSECT Mapset

    DFHMDI Map

    DFHMDF A field

    DFHMDF A field:

    DFHMDI Map

    DFHMDF A field

    DFHMDF A field

    :

    DFHMSD TYPE=FINAL Mapset

    END

  • 8/9/2019 cics mainframes

    38/184

    38

    DFHMSD Macro

    The DFHMSD macro is used to define a mapset (TYPE=MAP)and its characteristics or to end a mapset definition(TYPE=FINAL). Only one mapset is allowed in one assemblyrun. All the maps in a map set get assembled together, andthey're loaded together at execution time.

    Example:TSTMSET DFHMSD TYPE=&SYSPARM, X

    MODE=INOUT, XLANG=COBOL,

    X STORAGE=AUTO, XTIOAPFX=YES,

    XCNTL=(FREEKB,FRSET,PRINT)

  • 8/9/2019 cics mainframes

    39/184

    39

    Options

    TYPE= To define the map type

    DSECT For symbolic map

    MAP For physical map

    &SYSPARM For special assembly procedure

    FINAL To indicate the end of a mapsetcoding

    MODE= To indicate input/output operations

    IN For an input map only

    OUT For an output map only

    INOUT For maps involving both input and

    output.

    DFHMSD Macro (Contd..)

  • 8/9/2019 cics mainframes

    40/184

    40

    STORAGE =

    AUTO To acquire a separate symbolic map area foreach mapset

    BASE To have the same storage base for the symbolic

    maps of from more than one mapset

    TIOAPFX=

    YES To reserve the prefix space (12 bytes) forBMS

    commands to access TIOA properly. Requiredfor the CICS command level.

    DFHMSD Macro (Contd..)

  • 8/9/2019 cics mainframes

    41/184

    41

    CNTL= To define the device controlrequests

    FREEKB To unlock the keyboardFRSET To reset MDT to zero status

    ALARM To set an alarm at screen display timePRINT To indicate the mapset to be sent to the

    printer

    TERM=type This ensures device independence,required if other than 3270 terminal is beingused

    SUFFIX=nn To specify the user provided suffix number.This must correspond to the TCT

    parameter.

    DFHMSD Macro (Contd..)

  • 8/9/2019 cics mainframes

    42/184

    42

    DFHMDI Macro

    Defines a map and its characteristics

    Example

    EMPMAP DFHMDI SIZE=(ll,cc), XLINE=nn, XCOLUMN=mm, XJUSTIFY=LEFT/RIGHT

    Options

    SIZE=(ll,cc) To define the size of the map by the line size (ll)and the column size (cc). Useful when the screen

    contains.LINE Indicates the starting line number of the map.

    COLUMN Indicates the starting column number of the map.

    JUSTIFY To specify the entire map (map fields) is to be left or

    right justified.

  • 8/9/2019 cics mainframes

    43/184

    43

    The DFHMDF macro is used to define a field in a map and itscharacteristics. This is the position on the screen where the fieldshould appear. It's the position relative to the beginning of themap. Field starts with its attribute byte, so if POS=(1,1) is coded,

    then the attribute byte for that field is on line 1 in column 1, andthe actual data starts in column 2. The length of the field (notcounting the attribute byte) is specified. Literals can be specifiedwithin quotes; these character data is for an output field. It isused to define labels and titles for the screen and keep them

    independent of the program.

    DFHMDF Macro

  • 8/9/2019 cics mainframes

    44/184

    44

    Sample Screen layout

    The above defines the screen layout as given below:

    Where

    & Is the Attribute character

    n Is unprotected numeric_ Is Cursor

    ITEM NUMBER :&nnnnnnnn

  • 8/9/2019 cics mainframes

    45/184

    45

    DFHMDF

    Macro For The Above LayoutDefine a field and its characteristics

    Example

    DFHMDF POS(ll,cc), X

    INITIAL=Customer No. :, XATTRB=ASKIP, X

    LENGTH=14

    CUSTNO DFHMDF POS=(ll,cc),X

    ATTRB=(UNPROT,NUM,FSET,IC), X

    JUSTIFY=RIGHT, X

    PICIN=9(8), X

    PICOUT=9(8), X

    LENGTH=8

  • 8/9/2019 cics mainframes

    46/184

    46

    Attribute character

    Function:

    The attribute character is an invisible 1-byte character, whichprecedes a screen field and determines the characteristics of afield.

    ASKIP Autoskip. Data cannot be entered in this field. The cursorskips to the next field.

    PROT Protected field. Data cannot be entered into this field. Ifdata is entered, it will cause the input-inhibit status.

    UNPROT Unprotected field. Data can be entered and this is usedfor all input fields.

    NUM Numeric field. Only numbers (0 to 9) and special characters(. and -) are allowed.

  • 8/9/2019 cics mainframes

    47/184

    47

    Attribute character (Contd..)

    BRT Bright display of a field (highlight).

    NORM Normal display.

    DRK Dark display.

    IC Insert cursor. The cursor will be positioned in this field. Incase, IC is specified more than once, the cursor is placed inthe last field.

    FSET Field set. MDT is set on so that the field data is to be sentfrom the terminal to the host computer regardless of

    whether the field is actually modified by the user.

  • 8/9/2019 cics mainframes

    48/184

    48

    Modified Data Tag

    Function:

    Modified Data Tag (MDT) is a one bit of the attributecharacter. If it is off (0), it indicates that the terminaloperator has not modified the field. If it is on (1), it

    indicates that the operator has modified this field. Onlywhen MDT is on, the data of the field will be sent by theterminal hardware to the host computer. An effectiveuse of MDT drastically reduces the amount of datatraffic in the communication line and thus improvesperformance.

    Three ways of setting and resetting the MDT.

    1. Terminal user modifies a field on the screen, it isautomatically set to 1 (on) by the terminal hardware.

  • 8/9/2019 cics mainframes

    49/184

    49

    Modified Data Tag (Contd..)

    2. If CNTL=FRSET is specified in the DFHMSD or DFHMDImacro, when the mapset or the map is sent to the terminal,MDT will be reset to 0 (off) i.e. not modified for all the

    fields of the mapset or the map.

    3. If FSET is specified in the ATTRB parameter of theDFHMDF macro for a field, when the map is sent to theterminal, MDT will be set to 1. (on i.e. modified) for the fieldregardless of whether the field has been modified by theterminal user.

  • 8/9/2019 cics mainframes

    50/184

    50

    Skipper Technique

    Unlabelled 1-byte field with the autoskip attribute

    DFHMDF POS(ll,cc),ATTRB=ASKIP,LENGTH=1

    To skip the cursor to the next unprotected field after oneunprotected field.

    Screen Layout :

    &xxxxx&$ &xx

    where

    $ Skipper field

    & Attribute byte

    X Unprotected field

  • 8/9/2019 cics mainframes

    51/184

    51

    Stopper Technique

    Unlabelled 1-byte field with the protect attribute

    DFHMDF POS(ll,cc),ATTRB=PROT,LENGTH=1

    To stop the cursor in order to prevent erroneous field overflow byterminal user.

    Screen Layout :

    &xxxxx&$#&$

    where

    # Stopper field

  • 8/9/2019 cics mainframes

    52/184

    52

    Format Of the Symbolic Map

    Format of Symbolic Map

    Once the symbolic map is assembled and is placed inthe COPY library, the COBOL COPY statement can beused to include it in the application program.

    The symbolic map starts with the 01 level definition ofthe map name specified in the DFHMDI macro with thesuffix I for the input map and the suffix O for the

    output map.

    Next is the definition of FILLER PIC X(12), which is theTIOA prefix created by the TIOAPFX=YES of the DFHMSDmacro; this is required by the BMS under the CICS

    command level.

  • 8/9/2019 cics mainframes

    53/184

    53

    Format Of the Symbolic Map

    (Contd..)For each field name (1 to 7 characters) specified in theDFHMDF macro, BMS creates three fields for inputs andthree fields for outputs, by placing one character suffix tothe original field name. The meaning of these fields are

    given below:

    Name + L: The half-word binary (PIC S9(4) COMP)field. For the input field, the actual number ofcharacters typed in the field will be placed by the BMSwhen the map is received. For the output field, this isused for the dynamic cursor positioning.

  • 8/9/2019 cics mainframes

    54/184

    54

    Format Of the Symbolic Map

    (Contd..) Name + F: Flag Byte. For the input field, it will be

    X80 if the field has been modified but no data issent (i.e. the field has been cleared). Otherwise thisfield is X00.

    Name + A: The Attribute byte for both input andoutput fields.

    Name + I: The input data field. X00 will be

    placed if no data is entered. Note that space X40is data. The application program should differentiateX00 from space (X40).

    Name + O: The output data field.

  • 8/9/2019 cics mainframes

    55/184

    55

    Example Of Symbolic Map

    01 EMPRECI.02 FILLER PIC X(12).

    02 EMPNAL PIC S9(4) COMP.

    02 EMPNAF PIC X.02 FILLER REDEFINES EMPNAF.

    03 EMPNAA PIC X.

    02 EMPNAI PIC X(21).

    01 EMPRECO REDEFINES EMPRECI.02 FILLER PIC X(12).

    02 FILLER PIC X(03).

    02 EMPNAO PIC X(21).

  • 8/9/2019 cics mainframes

    56/184

    56

    Cursor Positioning Techniques

    CICS provides multiple ways of to specify where toposition the cursor on the screen. The cursor positioningis important to prompt an user of an entry he has tomake, or to point to an error which has occurred during

    editing the user entries.

    Static positioning (Achieved thru Map definitionATTRIB=IC).

    Example :DFHMDF

    POS=(5,8),ATTRB=(UNPROT,FSET,IC),LENGTH=10

  • 8/9/2019 cics mainframes

    57/184

    57

    Cursor Positioning Techniques(Contd..)

    Dynamic/Symbolic Positioning.

    The cursor is placed dynamically through an

    application program by moving -1 to thesymbolic map field-length field (i.e. fieldname +L) for the field where the cursor is to be placed. The SEND MAP command must be issued withthe CURSOR option (without value). Also, the

    mapset should be coded with MODE=INOUT inthe DFHMSD macro. This approach is veryuseful when the cursor is to be placed at thefield where data entry error has been detectedby the data edit routine.

  • 8/9/2019 cics mainframes

    58/184

    58

    Cursor Positioning Techniques(Contd..)

    Example Of Dynamic Cursor Positioning.

    WORKING-STORAGE SECTION.

    :COPY MAPSET1

    01 MAPSET1I

    05 FILLER PIC X(6).

    05 FIELD1L PIC X(5).

    05 FIELD1F PIC X.05 FIELD1I PIC X.

  • 8/9/2019 cics mainframes

    59/184

    59

    Cursor Positioning Techniques(Contd..)

    PROCEDURE DIVISION.

    : MOVE 1 TO FIELDL.

    EXEC CICS SEND MAP(MAP1)

    MAPSET(MAPSET1)

    CURSOR

    ERASE

    END-EXEC.

    The cursor will be placed at FIELD1 field of the map

    during execution.

  • 8/9/2019 cics mainframes

    60/184

    60

    Cursor Positioning Techniques(Contd..)

    Dynamic/Relative Positioning (application program)

    The cursor is placed dynamically through an application programusing the CURSOR(data-value) option in the SEND MAP

    command with the value of the relative position (starting fromzero) of the terminal. At the completion of the SEND MAPcommand, the map will be displayed with the cursor placed atthe specified position, overriding the static cursor positiondefined at the map definition time.

  • 8/9/2019 cics mainframes

    61/184

    61

    Cursor Positioning Techniques(Contd..)

    Example EXEC CICS SEND

    MAP(MAP1)

    MAPSET(MAPSET1)

    CURSOR(100)

    ERASE

    END-EXEC.

    The cursor will be placed at FIELD1 field of the map MAP1during execution.

  • 8/9/2019 cics mainframes

    62/184

    62

    Interfacing with a Terminalusing a Map

    The BMS maps are used in the application programs forthe actual terminal input/output operation. Theseoperations are performed by a set of CICS commandsfor BMS.

    The following are the three basic functionsperformed by CICS commands:

    Map Sending function using the data in the symbolic map,BMS prepares the output NMDS, the corresponding physicalmap, and sends to the terminal.

    Map Receiving Function using the input NDMS from theterminal, BMS prepares data in the symbolic map through thecorresponding physical map.

    Text Handling Function BMS prepares text without using a

    map and sends to the terminal.

  • 8/9/2019 cics mainframes

    63/184

    63

    Interfacing with a Terminalusing a Map (Contd..)

    Flow of Information from 3270 Terminal and the Application Program.

    ApplicationProgram

    Send MapCommand

    SymbolicMap

    BMS

    PhysicalMap

    BMSSymbolicMap

    ApplicationProgram

    Receive MapCommand

    OutputNDMS

    InputNDMS

    Terminal

    DataEntry

    Terminal

  • 8/9/2019 cics mainframes

    64/184

    64

    Interfacing with a Terminalusing a Map (Contd..)

    The following are the available commands:

    RECEIVE MAP : To receive a map

    SEND MAP : To send a map SEND CONTROL : To send a control function to the

    terminal

    SEND TEXT : To send a text

    SEND PAGE : To send the accumulated text or

    maps as a logical message

  • 8/9/2019 cics mainframes

    65/184

    65

    Receive Map Command

    RECEIVE MAP Command is used to receive input from a terminal.At the completion of the command, the symbolic map will containvalid data from the terminal in the following three fields as per eachfield defined by the DFHMDF macro:

    Field name + L : The length field, which contains the actual

    number of characters, typed in the screenfield.

    Field name + F : The Flag Byte which is normally X00. It will

    be X80 if the field has been modified butcleared.

    Field name + I : The actual input data field. X00 will be placedif no data is entered.

  • 8/9/2019 cics mainframes

    66/184

    66

    Receive Map Command(Contd..)

    Syntax: EXEC CICS RECEIVEMAP (MAPNAME)MAPSET(MAPSETNAME)

    [ SET(POINTER)|INTO(DATANAME) ][ LENGTH(MSG-LEN)]

    [ HANDLE | NOHANDLE ][ RESP() ]

    END-EXEC. Conditions: INVREQ, MAPFAIL

  • 8/9/2019 cics mainframes

    67/184

    67

    Receive Map Command(Contd..)

    MAP specified the name of the MAP defined thru DFHMDIcommand , which describes the screen details.

    MAPSET specified the name of the MAPSET defined thru DFHMSDcommand which includes the MAP.

    INTO is used to specify the area in the working storage section towhich the data from the terminal is to be placed.

    SET is used when the address pointer is to be set to the address ofthe symbolic map (by CICS) so that the application program candirectly refer to the record without moving the record content into theworking storage area defined in the program.

  • 8/9/2019 cics mainframes

    68/184

    68

    Receive Map Command(Contd..)

    RESP will be used by CICS to place a response code at acompletion of the command.

    HANDLE is used to transfer control to the procedure labelspecified if the exceptional condition specified occurs.

    NOHANDLE will cause no action to be taken for any exceptionalcondition occurring during execution of the CICS command.

    Conditions :INVMPSZ , INVREQR , LENGERR, MAPFAIL

    MAPFAIL is set when the data being mapped has a lengthof zero. It occurs when the following keys are pressed inresponse to the RECEIVE MAP command: CLEAR orAttention Keys & ENTER or PF keys without enteringdata.

  • 8/9/2019 cics mainframes

    69/184

    69

    SEND MAP Command

    The SEND MAP command is used to send formatted output toa terminal. Before issuing this command, the applicationprogram must prepare the data in the symbolic map of themap to be sent, which has the following three fields per each

    field defined by the DFHMDF macro:

    Name + L: The length field, for which the applicationprogram need not prepare except when used for the dynamiccursor positioning.

    Name + A: The Attribute byte for output fields.Application program will use it for dynamic cursor positioning.

    Name + O: The actual output data field, where the

    application program places the data.

  • 8/9/2019 cics mainframes

    70/184

    70

    SEND MAP Command (Contd..)

    EXEC CICS SEND MAP(MAP1)

    MAPSET(MAPSET1) ]

    [FROM(DATANAME) ], [DATAONLY] |MAPONLY],

    [ CURSOR(VALUE) ],[ FREEKB ] , [ ERASE ] , [ FRSET ] ,

    [ HANDLE | NOHANDLE ] ,

    [ RESP (DATANAME) ]

    END-EXEC.

    Conditions : INVREQ,LENGERR

  • 8/9/2019 cics mainframes

    71/184

    71

    SEND MAP Command (Contd..)

    MAP specified the name of the MAP defined thru DFHMDI command, which describes the screen details.

    MAPSET specified the name of the MAPSET defined thru DFHMSDcommand which includes the MAP.

    MAPONLY is used when no data from your program is to be mergedinto the map.

    DATAONLY is used when only the data from the program is to besent to the screen. The constants in the map are not sent.

  • 8/9/2019 cics mainframes

    72/184

    72

    SEND MAP Command (Contd..)

    FROM is used to specify the area in the working storage sectionfrom which the data is to be sent to the terminal.

  • 8/9/2019 cics mainframes

    73/184

    73

    AID KEYS

    First time when a transaction is initiated the application programthrows the screen image on the terminal thru SEND MAP command.Once the screen appears, the AID (Attention Identifier ) Keys arebeing used to send the information back from the terminal to CICS toapplication program. CICS application program needs to trap theattention identifier keys and process various functions related to theAID keys.

    Salient Points

    PF keys, PA keys, ENTER & CLEAR key

    EIBAID in the CICS Executive Interface Block contains, recentlyused AID key.

  • 8/9/2019 cics mainframes

    74/184

    74

    AID KEYS (Contd..) DFHAID CICS System copybook which stores the values of

    the EIBAID field for the various AID keys. Flow : User hitsAID key Control goes to CICS To Application program.EIBAID contains information about the last AID key pressed.Program compares EIBAID to the DFHAID field and

    performs processing logic as per the AID key pressed.

    HANDLE AID establish the routines that are to be invokedwhen the aid is detected by a RECEIVE MAP command.Syntax : EXEC CICS HANDLE AID

    Option (label)END-EXEC

    Conditions : INVREQ

  • 8/9/2019 cics mainframes

    75/184

    75

    Screen Design Considerations

    Functional Screen Design

    Screen layout should be similar to source where terminalusers enter data.

    Screen id should be placed at the top right corner of ascreen. This helps at problem determination time.

    Screen title and field descriptions should be self-explanatory.Instructions should be concise.

  • 8/9/2019 cics mainframes

    76/184

    76

    Screen Design Considerations(Contd..)

    Large fields can be broken into a number of small fields. E.g.the field contact information can be split into contactnumbers, email ids and postal address.

    In case of repeated fields or group of fields, sequencenumbers helps.

    Error messages should be provided. Preferably the last fewlines can be used for the error messages.

  • 8/9/2019 cics mainframes

    77/184

    77

    Screen Design Considerations

    User-Friendly Screen Design

    Screens should be simple and friendly.

    Default values in fields helps in reducing keystrokes by theusers. Also, in case the user forgets to enter a field data,

    defaults values are assigned according to the field. Calculations should be done by program and not by users.

    The cursors should be placed in the appropriate fields.

    Highlight the error field. Using a different colour or blinkingthe error field can achieve this. This enables users to identify

    the erroneous field easily.

  • 8/9/2019 cics mainframes

    78/184

    78

    Screen Design Considerations(Contd..)

    Alarm sound can be used for error entries.

    Provide suitable help messages for erroneous entries. Thehelp message should be instructive and kind and should notbe rude.

    Provide help on fields and their meanings. Using an attentionkey for a help menu, which has details on each field, makesa screen user-friendly.

    Artistic Screen Design

    A simple screen layout is always preferred. Proper use of indentations, spaces, and lines makes a

    screen look good.

  • 8/9/2019 cics mainframes

    79/184

    79

    Screen Design Considerations(Contd..)

    Colour can help in improving the screen design; however thecolour used should be in accordance with the norms andstandards followed.

    Considerations for Human Errors Important and useful fields can be placed at the top part of

    the screen.

    Related fields can be grouped together.

    Protected fields should be skipped automatically. This

    reduces manual skipping and is preferred. Skipper/Stopper techniques can be used at appropriate

    places.

  • 8/9/2019 cics mainframes

    80/184

    80

    Exercise - 1

    Exercise - 1

  • 8/9/2019 cics mainframes

    81/184

    81

    CICS File ProcessingTechniques

  • 8/9/2019 cics mainframes

    82/184

    82

    CICS VS FILE PROCESSING

    File handling in CICS is achieved thru a set of file handlingcommands. It is essential to know the various file handlingcommands for application programming.

    File Specific functions to be performed are the following. Defining a specific file to the CICS system. Reading a file sequentially

    Reading a Key Sequenced file randomly

    Reading a file sequentially starting from a specific point.

    Reading and Updating a record Deleting a Record.

    Handle any errors that occur during file processing

  • 8/9/2019 cics mainframes

    83/184

    83

    CICS VS FILE PROCESSING

    Instead, CICS has a list of all the files it is allowed

    To access.

    This list is called the FILE CONTROL TABLE

    (FCT) and is maintained by the systems

    programmers

    When CICS/VS is started up. It goes through the

    FCT and makes all the files available. When

    CICS/VS is closed down it closes all the files.

    Application programs do not need

    The FD Section, and the Input Output

    Section. Application program directlyRefer to filenames in EXEC CICS

    Command.

    Files do not need to exclusively

    defined in Application

    programs. The files do not need

    to opened and closed in a CICS

    application program , before

    being used in the program.

  • 8/9/2019 cics mainframes

    84/184

    84

    CICS COBOL V/S COBOL

    BATCH COBOL CICS

    COBOL

    READ DATAFILE INTO REC-AREA EXEC CICS READ

    DATASET (FILE IDENTIFIER)

    INTO (RECORD NAME)RID-FLD (record-key)

    END-EXEC.

    WRITE RECORD-NAME FROM

    RECORD-AREA

    EXEC CICS WRITE

    DATASET (File identifier)

    FROM (Record-Name)RID-FLD (Record- key)

    END-EXEC.

    Replaced by

    Replaced by

    AT END MOVE Y TO

    EOF-FLAG

  • 8/9/2019 cics mainframes

    85/184

    85

    VSAM

    Different types of VSAM Datasets used in CICS are :

    ESDS Entry Sequenced Dataset KSDS Key Sequenced Dataset

    RRDS Relative Record Dataset

  • 8/9/2019 cics mainframes

    86/184

    86

    Services Provided By CICS

    Basic Operations required for a file are

    Adding a Record.

    Modifying an Existing Record.

    Deleting an Existing Record.

    Browsing One or Selected or All Records.

    In Addition, CICS Provides

    Exclusive Control. (Record Level Locking).

    Data Independence.Journaling.

    Opening and closing Files.

  • 8/9/2019 cics mainframes

    87/184

    87

    Defining Files

    In CICS, files cannot be created. Files can be created usingIDCAMS Utility.

    Re-indexing, Creating new indexes, etc. should be done usingIDCAMS Only.

  • 8/9/2019 cics mainframes

    88/184

    88

    Defining A File in CICS

    Files should be defined in FCT (File Control Table).

    FCT will contain all the Information about a file (like datasetname, access methods, permissible file service request, etc.)

    Defining files can be done either by CEDA Transaction orDFHFCT Macro.

  • 8/9/2019 cics mainframes

    89/184

    89

    Syntax of DFHFCT Macro

    DFHFCT TYPE=FILE,ACCMETH=VSAM,

    DATASETNAME=NAME,

    SERVRQ=(ADD,BROWSE,DELETE,READ,UPDATE),

    FILSTAT=(ENABLED,OPENED)

  • 8/9/2019 cics mainframes

    90/184

    90

    File Handling in Programs

    Files should not be defined in the Program.

    Program should not open or close a File.

    Records can be written in any order. A number of records can be

    added at a time.

    Records can be inserted, updated or deleted.

  • 8/9/2019 cics mainframes

    91/184

    91

    Important Key-Words

    Dataset/File :- Name in the FCT.

    Into/From (WS-Rec) :- Working-Storage Area defined in theprogram where the CICS Puts/Gets the Data.

    RIDFLD :- Contains the Record Key.

    RESP :- Contains the return code of the executed

    command.

    LENGTH :- Length of the Record to be Retrieved or Written.

  • 8/9/2019 cics mainframes

    92/184

    92

    Random READ

    EXEC CICS READ File(filename)

    [SET() | Into()]

    RIdfld(Rec-Key)

    END-EXEC.

    Condition: DISABLED, NOTOPEN, NOTFND, LENGERR,DUPKEY, IOERR.

  • 8/9/2019 cics mainframes

    93/184

    93

    Example for Random Read

    EXEC CICS READ

    File( 'INVMAS ')

    Into(WS-INVMAS-REC)

    Length(WS-INVMAS-LEN)

    RIdfld('7135950602') |RIdfld(WS-INVMAS-KEY)

    END-EXEC.

  • 8/9/2019 cics mainframes

    94/184

    94

    Sequential Read

    Sequential Read is done by Browse Oper.

    Establish the pointer to the First Record to be Read UsingStartBr.

    Next and Previous Records can be Read as required UsingReadNext and ReadPrev.

    End the Browse Operation at last.

    Browse can be re-positioned.

    During Browse Operation, Records cannot be Updated.

  • 8/9/2019 cics mainframes

    95/184

    95

    Syntax for STARTBR

    EXEC CICS STARTBR

    FILE(filename)

    RIDFLD(data-area)

    END-EXEC.

    Condition : DISABLED, IOERR, NOTFND, NOTOPEN.

    R di th R d ft

  • 8/9/2019 cics mainframes

    96/184

    96

    Reading the Record afterSTARTBR

    Sequentially the Next or Previous Record can be read by aREADNEXT or READPREV.

    The first READNEXT or READPREV will read the Recordwhere the STARTBR has positioned the File Pointer.

  • 8/9/2019 cics mainframes

    97/184

    97

    Syntax of READNext/READPrev

    EXEC CICS READNext | READPrev

    FILE(name)

    INTO(data-area)|SET(ptr-ref)

    RIDFLD(data-area)

    END-EXEC.

    Condition : DUPKEY, ENDFILE, IOERR, LENGERR, NOTFND.

  • 8/9/2019 cics mainframes

    98/184

    98

    ENDBRowse

    ENDBRowse terminates a Previously issued STARTBR.

    SYNTAX :

    EXEC CICS ENDBRFILE(filename)

    END-EXEC.

    Condition: INVREQ

  • 8/9/2019 cics mainframes

    99/184

    99

    RESETBR

    Its effect is the same as ENDBR and then giving anotherSTARTBR.

    Syntax :

    EXEC CICS RESETBR

    FILE(filename)

    RIDFLD(data-area)

    END-EXEC.

    Condition: IOERR, NOTFND.

  • 8/9/2019 cics mainframes

    100/184

    100

    WRITE Command

    Adds a new record into the File.

    For ESDS, RIDFLD is not used but after write execution, RBAvalue is returned and Record will be written at the end of theFile.

    For KSDS, RIDFLD should be the Record Key. The record willbe written depending on the Key.

    MASSINSERTion must be done in ascending order of theKey.

  • 8/9/2019 cics mainframes

    101/184

    101

    Syntax for WRITE

    EXEC CICS WRITE

    FILE(filename)

    FROM(data-area)

    RIDFLD(data-area)END-EXEC.

    Condition: DISABLED, DUPREC, IOERR, LENGERR,NOSPACE, NOTOPEN.

  • 8/9/2019 cics mainframes

    102/184

    102

    REWRITE Command

    Updates a Record which is Previously Read with UPDATE

    Option.

    REWRITE automatically UNLOCKs the Record afterexecution.

  • 8/9/2019 cics mainframes

    103/184

    103

    Syntax for REWRITE

    EXEC CICS REWRITE

    FILE(filename)

    FROM(data-area)END-EXEC.

    Condition: DUPREC, IOERR, LENGERR, NOSPACE.

  • 8/9/2019 cics mainframes

    104/184

    104

    DELETE Command

    Deletes a Record from a dataset.

    Record can be deleted in two ways,

    1. RIDFLD with the full key in it2. The record read with READ with UPDATE will bedeleted.

    Multiple Records Delete is possible using Generic Option.

  • 8/9/2019 cics mainframes

    105/184

    105

    Syntax of DELETE

    EXEC CICS DELETE

    FILE(filename)

    RIDFLD(data-area) Optional

    END-EXEC.

    Condition: DISABLED, DUPKEY, IOERR, NOTFND,

    NOTOPEN.

  • 8/9/2019 cics mainframes

    106/184

  • 8/9/2019 cics mainframes

    107/184

    107

    General Exceptions

    The following exceptions usually will occur forALL CICS filehandling commands.

    FILENOTFOUND,

    NOTAUTH,

    SYSIDERR,

    INVREQ

  • 8/9/2019 cics mainframes

    108/184

    108

    CICS Error HandlingProcedures

  • 8/9/2019 cics mainframes

    109/184

    109

    Error Handling in CICS

    Possible Errors:

    Conditions that aren't normal from CICS's point of view but

    that are expected in the program.

    Conditions caused by user errors and input data errors.

    Conditions caused by omissions or errors in the application

    code.

    Errors caused by mismatches between applications and

    CICS tables, generation parameters and JCL

    Errors related to hardware or other system conditions beyond

    the control of an application program.

  • 8/9/2019 cics mainframes

    110/184

    110

    Error Handling methods

    When the error (exceptional conditions) occur, the program can

    do any of the following

    Take no action & let the program continue - Control returns to

    the next inst. following the command that has failed to execute.A return code is set in EIBRESP and EIBRCODE. This state

    occurs cause of NO HANDLE /RESP/IGNORE conditions

    Pass control to a specified label - Control goes to a label in the

    program defined earlier by a HANDLE CONDITION command.

    Rely on the system default action - System will terminate or

    suspend the task depends on the exceptional condition occurred

    Error Handling methods

  • 8/9/2019 cics mainframes

    111/184

    111

    Error Handling methods(Contd..)

    HANDLE CONDITION condition[(label)]... 'condition' specifiesthe name of the condition, and 'label' specifies the locationwithin the program to be branched

    Remains active while the program is executing or until itencounters IGNORE/another HANDLE condition.

    Syntax :EXEC CICS HANDLE CONDITION ERROR(ERRHANDL)

    LENGERR(LENGRTN)

    END-EXECThis example handles DUPREC condition separately, all theother Errors together. LENGERR will be handled by system

  • 8/9/2019 cics mainframes

    112/184

    112

    HANDLE Condition

    Example of Handle condition:

    EXEC CICS HANDLE CONDITION

    NOTFND(RECORD-NOT-FOUND)

    END-EXEC

    This condition catches the NOTFND condition and transfers control to the

    REC-NOT- FOUND paragraph in the program. The error handling logic can be

    coded in the REC-NOT-FND paragraph.

  • 8/9/2019 cics mainframes

    113/184

    113

    Alternative to Handle condition

    NOHANDLE to specify no action to be taken for any condition orattention identifier (AID)

    RESP(xxx) "xxx" is a user-defined full word binary data area. Onreturn from the command, it contains a return code. Later, it canbe tested by means of DFHRESP as follows,

    If xxx=DFHRESP(NOSPACE) ... or

    If xxx=DFHRESP(NORMAL) ...

  • 8/9/2019 cics mainframes

    114/184

    114

    IGNORE Condition

    IGNORE CONDITION condition ...

    condition specifies the name of the condition that is to beignored( no action will be taken)

    Syntax :

    EXECCICS IGNORE CONDITION

    ITEMERR

    LENGERR

    END-EXEC This command will not take any actions if the given two error

    occurs and will pass the control to the next instruction

    Sample program to use Handle

  • 8/9/2019 cics mainframes

    115/184

    115

    Sample program to use Handlecondition

    Here is an example of the CICS- COBOL code with properhandling of errors

    Procedure Division.EXEC CICS HANDLE CONDITION

    NOT-FND(REC-NOT-FOUND)END EXEC.

    :

    EXEC CICS READ

    DATASET(SAMPLE)

    RIDFLD(EMP-NO)

    INTO (EMP-REC)

    END-EXEC

    :

    GO TO LAST-PART

    Sample program to use Handle

  • 8/9/2019 cics mainframes

    116/184

    116

    Sample program to use Handlecondition (Contd..)

    REC-NOT-FOUND

    MOVE NOT-ON-FILE TO NAMEO ( SYMBOLIC MAP

    PARAMETER)

    LAST-PART.

    EXEC CICS SEND

    MAP (TC0BM31)

    MAPSET(TC0BM30)

    FROM (TC0BM310)

    DATA-ONLY

    END-EXEC

  • 8/9/2019 cics mainframes

    117/184

    117

    PUSH & POP

    To suspend all current HANDLE CONDITION, IGNORECONDITION, HANDLE AID and HANDLE ABEND commands.

    Used for eg. while calling sub-pgms (CALL).

    While receiving the control, a sub-program can suspend Handlecommands of the called program using PUSH HANDLE.

    While returning the control, it can restore the Handle commandusing POP HANDLE.

  • 8/9/2019 cics mainframes

    118/184

    118

    Syntax of Push & Pop

    Syntax of Push :

    EXEC CICS Push

    Handle

    END-EXEC.

    Syntax of Pop :

    EXEC CICS PopHandle

    END-EXEC.

  • 8/9/2019 cics mainframes

    119/184

    119

    EXEC Interface Block (EIB)

    CICS provides some system-related information to each task asEXEC Interface Block (EIB)

    Unique to the CICS command level

    EIBAID Attention- Id (1 Byte)

    EIBCALEN Length of DFHCOMMAREA (S9(4) comp)EIBDATE Date when this task started (S9(7) comp-3)

    EIBFN Function Code of the last command ( 2Bytes)

    EIBRCODE Response Code of the last command (6

    Bytes)EIBTASKN Task number of this task (S9(7) comp-3)

    EIBTIME Time when this task started (S9(7) comp-3)

    EIBTRMID Terminal-Id (1 to 4 chars)

    EIBTRNID Transaction-Id (1 to 4 chars)

  • 8/9/2019 cics mainframes

    120/184

    120

    Processing Program Table - PPT

    DFHPPT TYPE=ENTRY

    PROGRAM |MAPSET= name

    [PGMLANG= ASM|COBOL|PLI]

    [RES= NO|FIX|YES]

    :

    : other options

    :

    Eg.

    DFHPPT TYPE=ENTRY,PROGRAM=TEST,

    PGMLANG=COBOL

  • 8/9/2019 cics mainframes

    121/184

    121

    PCT Entry

    DFHPCT TYPE=ENTRY

    TRANSID= name

    PROGRAM=name

    TASKREQ=pf6

    RESTART=yes/no ( TRANSEC = 1 to 64)

    RSLKEY= 1 to 24 resource level key

    SCTYKEY= 1 to 64 security key

    :

    :other options

  • 8/9/2019 cics mainframes

    122/184

    122

    PROGRAM CONTROL

  • 8/9/2019 cics mainframes

    123/184

    123

    Program Control Commands

    LINK

    XCTL

    RETURN

    LOAD

    RELEASE

  • 8/9/2019 cics mainframes

    124/184

    124

    LINK

    Used to pass control from one application program to another

    The calling program expects control to be returned to it

    Data can be passed to the called program using COMMAREA

    If the called program is not already in main storage it is loaded

    INK S

  • 8/9/2019 cics mainframes

    125/184

    125

    LINK Syntax

    EXEC CICS LINK

    PROGRAM(name)

    [COMMAREA(data-area)

    [LENGTH(data-value)]]

    END-EXEC.

    Conditions : PGMIDERR, NOTAUTH, LENGERR

    XCTL

  • 8/9/2019 cics mainframes

    126/184

    126

    XCTL

    To transfer control from one application program to another in

    the same logical level

    The program from which control is transferred is released

    Data can be passed to the called program using COMMAREA If the called program is not already in main storage it is loaded

    XCTL S t

  • 8/9/2019 cics mainframes

    127/184

    127

    XCTL Syntax

    EXEC CICS XCTL

    PROGRAM(name)

    [COMMAREA(data-area)

    [LENGTH(data-value)]]

    END-EXEC.

    Conditions : PGMIDERR, NOTAUTH, LENGERR

    RETURN

  • 8/9/2019 cics mainframes

    128/184

    128

    RETURN

    To return control from one application program to another at a

    higher logical level or to CICS

    Data can be passed using COMMAREA when returning to CICS

    to the next task

    RETURN S t

  • 8/9/2019 cics mainframes

    129/184

    129

    RETURN Syntax

    EXEC CICS RETURN

    [TRANSID(name)

    [COMMAREA(data-area)

    [LENGTH(data-value)]]]

    END-EXEC.

    Conditions : INVREQ, LENGERR

    CICS Level 0

  • 8/9/2019 cics mainframes

    130/184

    130

    PROG A

    LINK

    RETURN

    PROG BXCTL

    PROG CLINK

    RETURN

    PROG D

    XCTLPROG E

    RETURN

    Level 1

    Level 2

    Level 3

    Application Program

    Logic Levels

    LOAD

  • 8/9/2019 cics mainframes

    131/184

    131

    LOAD

    To load program/table/map from the CICS DFHRPL concatenationlibrary into the main storage

    Using load reduces system overhead

    Syntax :

    EXEC CICS Load

    Program(name)

    [SET (pointer-ref)]

    [LENGTH (data-area)]END-EXEC.

    Condition : NOTAUTH, PGMIDER

    RELEASE

  • 8/9/2019 cics mainframes

    132/184

    132

    RELEASE

    To RELEASE a loaded program/table/map

    Syntax :

    EXEC CICS RELEASEPROGRAM(name)

    END-EXEC.

    Conditions : PGMIDERR, NOTAUTH, INVREQ

    COMMAREA

  • 8/9/2019 cics mainframes

    133/184

    133

    COMMAREA

    Data passed to called program using COMMAREA in LINK andXCTL

    Calling program - Working Storage definition

    Called program - Linkage section definition under

    DFHCOMMAREA Called program can alter data and this will automatically

    available in calling program after the RETURN command

    ( need not use COMMAREA option in the return for thispurpose )

    EIBCALEN is set when COMMAREA is passed

  • 8/9/2019 cics mainframes

    134/184

    134

    Communication WithDatabases

    CICS DB2

  • 8/9/2019 cics mainframes

    135/184

    135

    CICS - DB2

    CICS provides interface to DB2.

    DB2 requires CICS Attachment Facility to connect itself toCICS

    CICS programs can issue commands for SQL services in order

    to access the DB2 database.

    EXEC SQL function

    [options]

    END-EXEC

    Operating system

  • 8/9/2019 cics mainframes

    136/184

    136

    CICS REGION DB2 REGION

    App. Pgm. EXEC SQL.. CICS Attachment Facility

    DB2

    Database

    DB2 Database access by CICS

    RCT Entry

  • 8/9/2019 cics mainframes

    137/184

    137

    RCT Entry

    The CICS-to-DB2 connection is defined by creating andassembling the resource control table (RCT)

    The information in RCT is used to control the interactionsbetween CICS & DB2 resources

    DB2 attachment facility provides a macro (DSNCRCT) togenerate the RCT.

    The RCT must be link-edited into a library that is accessible toMVS

  • 8/9/2019 cics mainframes

    138/184

    138

    DB2 - Precompiler

    Source Program (EXEC SQL...| EXEC CICS...)

    DB2 Precompiler

    |

    CICS command translator

    |

    Compile By COBOL

    |

    Linkedit by Linkage editor

    |

    Load Module

  • 8/9/2019 cics mainframes

    139/184

    139

    QUEUES

    Transient data Control

  • 8/9/2019 cics mainframes

    140/184

    140

    Transient data Control

    Provides application programmer with a queuing facility

    Data can be stored/queued for subsequent internal or externalprocessing

    Stored data can be routed to symbolic destinations

    TDQs require a DCT entry Identified by Destination id - 1 to 4 bytes

    TDQs

  • 8/9/2019 cics mainframes

    141/184

    141

    TDQs

    Intra-partitioned - association within the same CICS subsystem

    Typical uses are

    - ATI (Automatic Task Initiation) associated with trigger level

    - Message switching

    - Broadcasting etc

    Extra-partitioned - association external to the CICS subsystem, Canassociate with any sequential device - Tape, DASD, Printer etc

    Typical uses are- Logging data, statistics, transaction error messages

    - Create files for subsequent processing by Non-CICS / Batch

    programs.

    TDQs

  • 8/9/2019 cics mainframes

    142/184

    142

    TDQs

    Operations

    Write data to a transient data queue (WRITEQ TD)

    Read data from a transient data queue (READQ TD)

    Delete an intra partition transient data queue (DELETEQ TD).

    WRITEQ TD

  • 8/9/2019 cics mainframes

    143/184

    143

    WRITEQ TD

    Syntax :

    EXEC CICS WRITEQ TD

    QUEUE(name)

    FROM(data-area)

    [LENGTH(data-value)]

    [SYSID(systemname)]

    END-EXEC.

    Conditions: DISABLED, INVREQ, IOERR, ISCINVREQ,LENGERR, NOSPACE, NOTAUTH, NOTOPEN, QIDERR,SYSIDERR

    READQ TD

  • 8/9/2019 cics mainframes

    144/184

    144

    READQ TD

    Reads the queue destructively - Data record not available in thequeue after the read.

    Syntax :

    EXEC CICS READQ TD

    QUEUE(name)

    {INTO(data-area) | SET(ptr-ref) }

    [LENGTH(data-value)]

    [NOSUSPEND]

    END-EXEC.Conditions : DISABLED, IOERR, INVREQ, ISCINVREQ,LENGERR, NOTAUTH, NOTOPEN, QBUSY, QIDERR, QZERO,SYSIDERR

    DELETEQ TD

  • 8/9/2019 cics mainframes

    145/184

    145

    DELETEQ TD

    Deletes all entries in the queue

    Syntax :

    EXEC CICS DELETEQ TD

    QUEUE(name)

    END-EXEC.

    Conditions: INVREQ, ISCINVREQ, NOTAUTH,QIDERR, SYSIDERR

    Destination Control Table

  • 8/9/2019 cics mainframes

    146/184

    146

    Destination Control Table

    DCT is to register the information of all TDQs

    Destination Control Program (DCP) uses DCT to identify allTDQs and perform all I/O operations.

    DFHDCT is a macro to define intra & extra partition TDQs

    TYPE=INTRA/EXTRA REUSE option specified along with intra partition TDQ tells

    whether the space used by TDQ record will be removed &reused after it has been read.

    Automatic Task Initiation

  • 8/9/2019 cics mainframes

    147/184

    147

    Automatic Task Initiation

    Facility through which a CICS transaction can be initiatedautomatically

    DFHDCT TYPE=INTRA

    DESTID=MSGS

    TRANSID=MSW1TRIGLEV=500

    When the number of TDQ records reaches 500, the

    transaction MSW1 will be initiated automatically

    ApplicationsMessage switching & Report printing

    Temporary Storage Control

  • 8/9/2019 cics mainframes

    148/184

    148

    Temporary Storage Control

    Provides application programmer the ability to store and retrievedata in a TSQ

    Application can use the TSQ like a scratch pad

    TSQs are

    - Created and deleted dynamically- No CICS table entry required if recovery not required

    - Identified by Queue id - 1 to 8 bytes

    - Typically a combination of termid/tranid/operid

    Each record in TSQ identified by relative position, called the itemnumber

  • 8/9/2019 cics mainframes

    149/184

    TSQs - Typical uses

  • 8/9/2019 cics mainframes

    150/184

    150

    TSQs Typical uses

    Data passing among transactions

    Terminal Paging

    Report printing

    WRITEQ TS

  • 8/9/2019 cics mainframes

    151/184

    151

    WRITEQ TS

    Syntax :

    EXEC CICS WRITEQ TS

    QUEUE(name)

    FROM(data-area)

    [LENGTH(data-value)]

    [NUMITEMS(data-area) |

    ITEM(data-area) [REWRITE] ]

    [MAIN|AUXILIARY]

    [NOSUSPEND]END-EXEC.

    Conditions : ITEMERR, LENGERR, QIDERR, NOSPACE, NOTAUTH,SYSIDERR, IOERR, INVREQ, ISCINVREQ

    READQ TS

  • 8/9/2019 cics mainframes

    152/184

    152

    READQ TS

    Syntax :

    EXEC CICS READQ TS

    QUEUE(name)

    {INTO(data-area) | SET(ptr-ref) }

    LENGTH(data-value)

    [NUMITEMS(data-area)]

    [ITEM(data-area) | NEXT ]

    END-EXEC.

    Conditions : ITEMERR, LENGERR, QIDERR, NOTAUTH,SYSIDERR, IOERR, INVREQ, ISCINVREQ

    DELETEQ TS

  • 8/9/2019 cics mainframes

    153/184

    153

    DELETEQ TS

    Deletes all entries in the queue

    Syntax :

    EXEC CICS DELETEQ TS

    QUEUE(name)

    END-EXEC.

    Conditions: INVREQ, ISCINVREQ, NOTAUTH, QIDERR,SYSIDERR

  • 8/9/2019 cics mainframes

    154/184

    154

    INTERVAL & TASKCONTROL

    ASKTIME

  • 8/9/2019 cics mainframes

    155/184

    155

    ASKTIME

    Used to obtain current date and time

    Syntax :

    EXEC CICS ASKTIME[ABSTIME(data-area)]

    END-EXEC.

    EIBDATE and EIBTIME updated with current date and time

    ABSTIME returns value of time in packed decimal format

    FORMATTIME

  • 8/9/2019 cics mainframes

    156/184

    156

    FORMATTIME

    Syntax :

    EXEC CICS FORMATTIME ABSTIME(data-ref)

    [YYDDD(data-area)]

    [YYMMDD(data-area)]... etc.

    [DATE(data-area) [DATEFORM[(data-area)]]]

    [DATESEP[(data-value)]]

    [DAYOFMONTH(data-area)]

    [MONTHOFYEAR(data-area)]

    [YEAR(data-area)].....[TIME(data-area) [TIMESEP[(data-value)]]]

    END-EXEC.

    Condition: INVREQ

    DELAY

  • 8/9/2019 cics mainframes

    157/184

    157

    DELAY

    Used to DELAY the processing of a task

    The issuing task is suspended for a specified interval or Until thespecified time

    Syntax :

    EXEC CICS DELAYINTERVAL(hhmmss) | TIME(hhmmss)

    END-EXEC

    Conditions: EXPIRED, INVREQ

    START

  • 8/9/2019 cics mainframes

    158/184

    158

    S

    Used to start a transaction at the specified terminal and at thespecified time or interval

    Data can be passed to the new transaction

    Syntax :

    EXEC CICS START TRANSID(transid)

    [TERMID(termid)

    TIME(hhmmss) | INTERVAL(hhmmss) ]

    END-EXEC

    Conditions : INVREQ, LENGERR,TERMIDERR, TRANSIDERR

    Other Interval ControlC d

  • 8/9/2019 cics mainframes

    159/184

    159

    Commands

    POST - to request notification when the specified time hasexpired.

    WAIT EVENT - to wait for an event to occur.

    RETRIEVE - Used to retrieve the data passed by the START

    CANCEL -Used to cancel the Interval Control requests. eg.DELAY,POST and START identified by REQID.

    SUSPEND - Used to suspend a task

    ENQ - to gain exclusive control over a resource

    DNQ - to free the exclusive control from the resource gained byENQ

  • 8/9/2019 cics mainframes

    160/184

    160

    Recovery & Restart

    The Need for Recovery/Restart

  • 8/9/2019 cics mainframes

    161/184

    161

    y

    The possible failures that can occur outside the CICS system are

    Communication failures (in online systems)

    Data set or database failures

    Application or system program failures

    Processor failures & Power supply failures.

    Recovery/Restart facilities are required to minimize or if possible,eliminate the damage done to the online system, in case of the

    above failures to maintain the system & data integrity.

    RECOVERY

  • 8/9/2019 cics mainframes

    162/184

    162

    An attempt to come back to where the CICS system or thetransaction was when the failure occurred

    Recoverable Resources

    VSAM filesIntrapartition TDQ

    TSQ in the auxiliary storage

    DATA tables

    Resource definitions & System definition files

    RESTART

  • 8/9/2019 cics mainframes

    163/184

    163

    To resume the operation of the CICS system or the transaction whenthe recovery is completed

    Facilities for Recovery/Restart

  • 8/9/2019 cics mainframes

    164/184

    164

    y

    Facilities for CICS Recovery/Restart

    Dynamic Transaction Backout

    Automatic Transaction Restart

    Resource Recovery Using System Log

    Resource Recovery Using Journal

    System Restart

    Extended Recovery Facility (XRF)

    Dynamic Transaction Backout(DTB)

  • 8/9/2019 cics mainframes

    165/184

    165

    (DTB)

    When the transaction fails, backing out the changes made bythe transaction while the rest of the CICS system continuesnormally is called DTB

    CICS automatically writes the before image information of therecord into the dynamic log for the duration of one LUW ,thework between the two consecutive SYNC points

    When an ABEND occurs, CICS automatically recovers all

    recoverable resources using the info. in dynamic log (SetDTB=YES in PCT)

    LUW & SYNC point

  • 8/9/2019 cics mainframes

    166/184

    166

    p

    The period between the start of a particular set of changes andthe point at which they are complete is called a logical unit ofwork - LUW

    The end of a logical unit of work is indicated to CICS by a

    synchronization point (sync pt). Intermediate SYNC pt. can be done by

    Syntax :

    EXEC CICS SYNCPOINT

    [ROLLBACK]

    END-EXEC

    LUWs & SYNC pts

  • 8/9/2019 cics mainframes

    167/184

    167

    p

    |- - - - - - - - - - - - LUW - - - - - - - - - |

    Task A|---------------------------------------------|

    SOT EOT-SP

    |- - - LUW- - |- - - LUW- - |- - -LUW- - |

    Task B|---------------->--------------->--------------|

    SOT SP SP EOT-SP

    When the failure occurs, changes made within the abendingLUW will be backed out.

    Automatic Transaction Restart

  • 8/9/2019 cics mainframes

    168/184

    168

    CICS capability to automatically restart a transaction after allresources are recovered through DTB

    If the transaction requires automatic restart facility, set

    RESTART=YES in PCT

    Care should be taken in order to restart the task at the pointwhere DTB completes in the case of intermediate SYNC point

  • 8/9/2019 cics mainframes

    169/184

    169

    Program Preparation

    Introduction

  • 8/9/2019 cics mainframes

    170/184

    170

    Preparing a Program to run in CICS Environment.

    Defining the Program in the CICS Region.

    Executing the Program.

    Program preparation

  • 8/9/2019 cics mainframes

    171/184

    171

    LOADMODULE

    LINKEDIT

    COBOL

    COMPILER

    CICS

    COMPILER

    DB2

    PRECOMPILER

    IF DB2 :

    SOURCE

    Program preparation

    Preparing a Program

  • 8/9/2019 cics mainframes

    172/184

    172

    CICS requires the following steps to prepare a program

    Translating the Program.

    Assemble or Compile the Translator Output. &

    Link the Program.

    Translation

  • 8/9/2019 cics mainframes

    173/184

    173

    Translates the EXEC CICS Statements into the Statementsyour Language (COBOL) Compiler can Understand.

    The Translator gives two outputs, a Program Listing asSYSPRINT and a Translated Source in SYSPUNCH.

    The SYSPUNCH is given as the input to the Program Compiler. If any Copy Books are used in the Program, there should not be

    any CICS Statements in the Copy Book.

    Compiling or Linking

  • 8/9/2019 cics mainframes

    174/184

    174

    As the CICS Commands have been translated, the compilationof the CICS program is the same as language program.

    Hence, the compiler options can be specified as required.

    Defining the Program

  • 8/9/2019 cics mainframes

    175/184

    175

    The Application should be defined and installed into the PPT.

    This can be done either by using CEDA trans or DFHPPT.

  • 8/9/2019 cics mainframes

    176/184

    176

    CICS Supplied Transactions

    CESN/CESF Transactions

  • 8/9/2019 cics mainframes

    177/184

    177

    To sign on to CICS system

    CESN [USERID=userid] [,PS=password][,NEWPS=newpassword][,LANGUAGE=l]

    Userid & password values can be from 1-8 chars.

    In RACF, the Userid given in CESN is verified. NEWPS to change the password and LANGUAGE to choose

    national language

    Sign off by CESF which breaks the connection between the userand CICS

    If the Sign on is done twice for the same userid at the terminal,the previous operator will be signed off

    CECI - Command LevelInterpreter

  • 8/9/2019 cics mainframes

    178/184

    178

    Interpreter

    To build and test the effect of EXEC CICS commands

    CECI ASSIGN is used to get the current userid,sysid, terminal id,application id etc..

    Before using the maps in programs, it can be tested using CECI

    to check how it appears on the screen. CECI gives the complete command syntax of the specified

    command.

    CECI READQ TD QUEUE(TESTL001) will read the currentrecord of the given TDQ

    CEMT-Master TerminalTransaction

  • 8/9/2019 cics mainframes

    179/184

    179

    Transaction

    CEMT provides the following services

    Displays the status of CICS & system resources

    Alter the status of CICS & system resources Remove the installed resource definitions

    Perform few functions that are not related to resources

    CEDF-Execution DiagnosticFacility

  • 8/9/2019 cics mainframes

    180/184

    180

    Facility

    To test command level application programs interactively

    CEDF [termid/sysid/sessionid] [,ON/,OFF]

    Termid - the identifier of the terminal on which the transaction tobe tested is being run

    Sessionid - To test/monitor a transaction attached across anMRO/ISC session

    Sysid - To test a transaction across an APPC session

    CEDF (Contd..)

  • 8/9/2019 cics mainframes

    181/184

    181

    The points at which EDF interrupts execution of the program andsends a display to the terminal

    At transaction initialization, after EIB has been initialized andbefore the app. pgm given control

    Start of execution of each CICS command (auguement

    values can be changed at this point) End of execution of each CICS command and before the

    Handle condition mechanism is invoked (response codevalues can be changed)

    At program termination & at normal task termination

    When an ABEND occurs & at abnormal task termination. EIB values can be changed..& CEBR can be invoked

    CEBR-Temporary StorageBrowse

  • 8/9/2019 cics mainframes

    182/184

    182

    Browse

    To browse the contents of CICS temporary storage queues(TSQ)

    CEBR by default will show the queue associated with the currentterminal CEBRL001 which can be overridden to view any otherqueue

    TERM to browse TSQ for another terminal

    QUEUE to make the named queue, current

    PUT to copy the current queue contents into TDQ

    GET to fetch TDQ for browsing

    PURGE erases the contents of the current queue

    Exercise - 2

  • 8/9/2019 cics mainframes

    183/184

    183

    Exercise 2

    Exercise - 2

  • 8/9/2019 cics mainframes

    184/184

    Th k Y