Wednesday, 25 April 2018

CICS Tutorial

1.       CICS - Customer Information Control System, OLTP (Online Transaction Processing Software)       MVS and TSO ISPF Subsystem. CICS is DB/DC System (environment for online execution of application programs).
2.       Function of CICS - Concurrent Users, access to data files for reading/updating
3.       Features of CICS - Operating system in itself/own processor storage/own task manager/own file management. Two or more regions at same time as CICS runs as batch job in operating system at back-end.
4.       CICS Environment - View in spool (PREFIX CICS*)
System Services - Task control(Multitasking) / Program Control / Storage Control / Interval Control
Data Communication Services - BTAM, VTAM, TCAM / Application Program, terminal - BMS(Basic Mapping Support/ Multi Region Operation (MRO) - more than one region in the same system communicate.
Inter System Communication(ISC) - CICS region in system Communicate with CICS system in another region
Data Handling Services = BDAM,VSAM/ Set of Commands, data set,database access / IMS DB, DB2/Data integrity, control simultaneous update/data protection , task ABEND's, system                              failure.   
Application Program Services - Command Level Translation / CEDF (debug facility)/ CECI(Command Interpreter) 
Monitoring Services - provide statistical information, system tuning.

5.       CICS Basic Terms
a)       CICS Screen - Display 1920 Characters, 24 rows, 80 columns, characteristics, intensity, protected, unprotected can be set.
b)      Keyboard
NON-AID Keys - alphabets, numeric, punctuation, special characters.
AID Key (Attention Identifier Key) - Function keys (transfer of data from terminal to CICS) - COPY DFHAID. AID Keys include ENTER, PF1 to PF24, PA1 to PA3, and CLEAR.                                                                                  
PA Keys (Program Access keys) - PA1 to PA3, CLEAR - do not allow transfer of data.
c)       Transaction - Transaction Identifier - Invoke CICS Program - Several users can initiate Transaction.
d)      Task - Unit of work specific to user. Each user initiates his own task. LUW (Logical Unit of Work)
e)       Note – Several users can initiate a txn but each user initiate his own task.
f)       Application - Series of logically grouped program.

6.       CICS Nucleus    -
a)       Control Programs – TCP (Terminal Control Pgm), KCP (Task Control Pgm), PCP (Program Control Pgm), FCP (File Control Pgm), SCP (Storge Control Pgm).
b)      Control Tables – TCT (Terminal Control Table), PCT (Program Control Table) - Pgm name & corresponding Txn Id, PPT(Processing Pgm Table), Pgm Id, Load Library Address & Maps, FCT (File Control Table), RCT (Resource Control Table) – DB2 Plan Details
7.       CICS Transactions
a)       CESN (CICS Execute Sign ON)
b)      CEDA (CICS Execute Definition & Administration) – CEDA DEFINE PROGRAM(X) ß To define new pgm in PPT table.
c)       CEMT (CICS Execute Master Terminal) - Loading new pgm or existing pgm when pgm or Mapset is changed. Type CEMT & Enter - INQUIRE,PERFORM,SET
CEMT I TRAN(SHP1) / PROG(KSHP1000) / NEWC MAPNAME / NEWC Program Name
CEMT SET PROGRAM (name) NEWCOPY / CEMT SET FILE(name) {OPEN/ CLOSE}

d)      CECI (CICS Execute command Interpreter) CECI SEND MAP (map-name) MAPSET (mapset-name) ERASE
e)       CEDF (CICS Execute Debug Facility) – DTCN (Enter) – Enter Txn Id & then the pgm name & then enter.
f)       CMAC (CICS Message for Abend Codes)
g)      CESF (CICS Execute Sign Off)
h)      CEBR (CICS Execute Temporary Storage Browse) – CEBR Queue

8.       CICS Concept – Multitasking, Multithreading. For multithreading pgm should be re-entrant program under the operating system or a quasi-re-entrant under the CICS.

9.       CICS COBOL Basics - EXEC CICS SEND TEXT - END-EXEC, EXEC CICS RETURN - END-EXEC / Compile JCL / CICS EXEC CICSCOB / Open CICS Session / Install Pgm - CEMT SET PROG(HELLO) NEW / Execute Pgm using TXN ID (provided by Administrator) / Pgm Compilation – TRANSLATOR (Check Syntax Error in CICS Commands / Equivalent COBOL statement / COMPILER (Expand COBOL COPYBOOKS / Compile source code after checking Syntax Errors / LINKAGE EDITOR (Link diff Object Modules to create single load module)


10.   Basic Mapping Support(BMS)
a)       Create Screen Design with proper positions & attributes.
b)      Unformatted Screen / Formatted Screen /BMS Macros - whole MAP defined - JCL assemble it
c)       BMS Basic Term – MAP (Single Screen) / MAPSET (Collection of MAPS linked together to form Load Module - PPT Entry - 1 to 7 Char) /
d)       BMS MACROS (Pgm written in Assembly Lang to manage Screens) - DFHMSD(MAPSET) / DFHMDI (MAP) / DFHMDF (FIRLD) / SDF (Screen definition Facility)           
MAPSET à MAP à FIELDS [DFHMSDDIDF]          

e)       DFHMSD - MAPSET name is load Module name & an entry in PPT table must be present / TYPE = MAP(Physical MAP) / DSECT(Symbolic MAP) / &&SYSPARM (both Physical & Symbolic) / FINAL (End of MAPSET Coding) / MODE = IN/OUT/INOUT / LANG= ASM/COBOL/PL1 / STORAGE = AUTO/BASE / CTRL = FREEKB(Unlock Keyboard) / FRSET - reset MDT to zero status / ALARM - Alarm at screen display time) / PRINT (MAPSET to be sent to Printer) / TERM (Device independence) / TIOAPEX = YES/NO.    
f)       DFHMDI (MAP) - MAPNAME is followed by the DFHMDI Macro SIZE= (LINE, COLUMN) / JUSTIFY=LEFT or RIGHT / CTRL= FREEKB/FRSET/ALARM/PRINT / TIOAPFX
g)      DFHMDF (define Field names) – Field name used inside program / No field name for CONSTANT FIELDS (not used in Pgm) / POS (Position on screen where field should appear / field starts with attribute byte - if POS(1,1) then actual data starts in col 2 / LENGTH - length of field not counting attribute byte / INITIAL='MENU' for Menu screen / JUSTIFY=left or right / ATTRB= ASKIP (Autoskip, data cannot be entered in this field), PROT(Protected field/Data cannot be entered), UNPROT(Data can be eneterd, input fields), NUM (Numeric field / numbers & Special characters '0' & '-'), BRT(Highlight field), NORM (Normal Display), DRK (DARK Display), IC(Insert Cursor), FSET(Field Set/MDT is set on) - field data to be sent from screen whether modified or not / PICIN 9(8) - data field used as input / PICOUT Z(08) - data field used as output.

h)      MAP - BMS MAPSET -> ASSEMBLE -> PHYSICAL MAP (LOAD MODULE in Load Library / used by CICS) / SYMBOLIC MAP (Copybook in Copy Library / Used by CICS app pgm)

PHYSICAL MAP = Inf how the MAP should displayed / attributes of field in MAP and positions/Coded using BMS Macros/assembled separately & link edited into CICS lib.                        SYMBOLIC MAP = COPYBOOK/Send & Receive Data from terminal/ has all named fields.
i)        SKIPPER FIELD/STOPPER FIELD = Unprotected named field, in MAP, having length of 10 - when enter value it can keep on taking after 10 also - to prevent this we use SKIPPER field(Unnamed field of length 1, specified after named field / cursor will automatically position to next unprotected field                    - LENGTH=1,X, ATTRB =(ASKIP)) / STOPPER field(Cursor will stop its positioning - LENGTH=1,X, ATTRB=(PROT))  
j)        Attribute Byte = Inf about physical properties of the field.
0 & 1(Determined by Content of 2 to 7)
2 & 3(00-Unprotected Alphanumeric, 01- Unprotected Numeric, 10 - Protected Stop, 11- Protected Skip)
4 & 5 (00- Normal,01-Normal,10- Bright,11-No Display(Dark))
6 - Zero Always)
7 - Modified Data Tag / 0 (Field has not been modified) - 1(Field modified))  
 
k)      Modified Data Tag (MDT (Last bit in attribute byte - default value '1')

l)        SEND MAP (EXEC CICS SEND MAP('map-name') MAPSET('mapset-name') [FROM(data-area)] [LENGTH (data value)] [DATAONLY] [MAPONLY] [CURSOR (Cursor can be set by moving -1 to L Part of the field and then sending the MAP)] [ERASE (entire screen) / ERASEAUP (only unprotected fields)] [FREEKB] [FRSET] [ALARM] [PRINT] [FORMFEED(causes printer to restore to the top of the next page] END-EXEC  
m)    RECEIVE MAP EXEC CICS RECEIVE MAP('map-name') MAPSET('mapset-name') [INTO(data-area)] [FROM(data-area)] [LENGTH(data value)] END-EXEC

MAPSET Execution - OPEN TSO SESSION - Create a new PDS - CODE a MAPSET in a new member - Assemble the MAPSET using the JCL provided by CICS – Administrator - Open a CICS session - Install Pgm using Command - CEMT SET PROG(mapset-name) NEW - Type the following command to send the Map to the terminal - CECI SEND MAP(map-name) MAPSET(mapset-name) ERASE FREEKB

11.   Interface Block - Executive Interface Block(EIB) act as interface to allow application program to interact CICS. EIB contain Information required during execution.
a)       EIB loaded automatically for every CICS program.
b)      EIB Variables in copybook DFHEIBLK. Unique to Task & Exists for duration of task.
c)       Every program executing as part of task have access to same EIB - data in EIB at runtime can be viewed by executing the program in CEDF mode.
EIBAID X(1) - Aid key Pressed / EIBCALEN S9(4) COMP -  length of DFHCOMMAREA / EIBRESP or EIBRESP2 – Handling Error / EIBDATE S9(7) COMP-3 - Current System Date / EIBFN – CICS Command executed last / EIBRCODE X(6) - Return code of last transaction / EIBTASK - Task number / EIBTIME S9(7) COMP-3 - System Time / EIBTRMID X(4) - Terminal Identifier) / EIBTRNID X(4) - Transaction Identifier.

12.   CICS Pgm Classification
a)       Non-Conversation – Rarely, only for displaying seq of screens at regular interval of time. 
b)      Conversational Pgm - SEND RECEIVE THINK Time, App Pgm remain loaded in main area till task ends.
c)       Pseudo Conversational Pgms - System send a msg to screen & terminate Txn         specifying txn to be started when user enter input. Application program is loaded into main storage when needed & released when not in use.
Imp Point - Passing data between each task.
COMMAREA - EXEC CICS RETURN - TRANSID ('transaction-id') - COMMAREA WS-COMMAREA LENGTH  WS-COMMAREA-LENGTH END-EXEC. WSCOMMAREA & WS-COMMAREA-LENGTH declared in Working Storage Section.
DFHCOMMAREA – Special memory area provide to every task, Pass data from program to another program, Program can exists in same or another txn, declared in Linkage Section at 01 level, same pic clause as WS-COMMAREA. Data can be move back - MOVE DFHCOMMAREA TO WS-COMMAREA.

d)      Pseudo Code - MOVE DFHCOMMAREA TO WS-COMMAREA IF EIBCALEN = 0  STEP1: SEND MAP STEP2: MOVE <internal-transaction-id1> to WS-COMMAREA ELSE IF WS-COMMAREA = <internal-transaction-id1>  STEP4: RECEIVE MAP STEP5: PROCESS DATA STEP6: SEND OUTPUT MAP STEP7: MOVE <internal-transaction-ID2> to WS-COMMAREA  END-IF END-IF  

13.   TASK ENDS – RETURN Statements.
EXEC CICS RETURN TRANSID ('trans-id') [COMMAREA(WS-COMMAREA)] END-EXEC.  Control returns to CICS with the next Txnid to be executed when user press AID Key.

14.   Cursor Positioning - Two ways to override the position specified in the map definition).
a)       specify the screen position relative to line and column number in the CURSOR option on the send map command.
b)      Move -1 to the symbolic map variable suffixed with L - MOVE -1 TO NAMEL - EXEC CICS SEND MAP ('map-name').

15.   Dynamically Modifying Attributes - While sending a map, if we want to have different attributes for a field other than specified in the MAP then override that by setting field in the program, we must include DFHATTR, attribute required can be chosen from the list and moved to the symbolic field variable suffixed with 'A'.  01  CICS-ATTRIBUTES.  05  ATTR-UXN            PIC X(01) VALUE SPACE.


16.   CICS - File Handling
Access Methods - VSAM & DAM (Direct Access Method)
Random Access - READ /WRITE / REWRITE / DELETE –
SEQUENTIAL Access -  STARTBR / READNEXT /READPREV / RESETBR / ENDBR
Note – Most file accesses are random in online system as txn’s to be processed are not batched & sorted in any kind of order. 

EXEC CICS READ
FILE (‘name’) ß CICS symbolic file name (FCT Entry)
INTO(data-area) ß Structure in working storage
RIDFLD(data-area) ß Name of data area which contain key
LENGTH(data-value) ßPIC S9(4) COMP
KEYLENGTH(data-value) ßGENERIC / UPDATE / EQUAL / GTEQ
END-EXEC

17.   CICS - Error Handling Commands

a)       Handle condition - Transfer control of pgm to a paragraph or procedure level.
b)      Handle Abend - pgm abends due to input-output error etc.
c)       Abend - terminate task intentionally
d)      Ignore Condition - when we want no action to be taken 
e)       Nohandle - Specified for any CICS command.

18.   CICS - Control Operations - CICS Program Control Program (PCP) manages the flow of application programs.
a)       XCTL - Control from one Pgm to another at same level not expect control back i.e Pseudo-Conversational - EXEC CICS XCTL PROGRAM ('PROG2') END-EXEC.
b)      LINK - Control to another pgm at lower level & expects control back - EXEC CICS LINK PROGRAM ('PROG2') END-EXEC.
c)       LOAD - To load a program or a table - EXEC CICS LOAD PROGRAM ('name') END-EXEC.
d)      RELEASE - To release a program or a table - EXEC CICS RELEASE PROGRAM ('name') END-EXEC.
e)       RETURN - return the control to the next higher logical level - EXEC CICS RETURN / CALL – Passing data and getting control back.

19.   Interval Control Operations
a)       ASKTIME - to request for current time and date or timestamp / EXEC CICS ASKTIME [ABSTIME(WS-TIMESTAMP)])
b)      FORMATTIME - to formats the timestamp into the required format based on the options, which can be YYDDD etc. EXEC CICS FORMATTIME ABSTIME (WS-TIMESTAMP) [YYDDD(WS-DATE)]


20.   CICS - Temporary Storage - Scratch Pad to transfer data between Txns.
a)       COMMAREA - pass data from one pgm to another either within same txn or from diff txn / Definition in LINKAGE Section using DFHCOMMAREA name.
b)      Common Work Area - Any txn in the CICS region can access it / only one in entire CICS region.
c)       Transaction Work Area - Transfer data between pgms executed within same txn / exist duration of txn / size Pgm Control Table.
d)      Temporary Storage Queue(TSQ) - Temporary Storage Control Program (TSP) /  TSQ is a queue of records that can be created, read and deleted by different tasks or programs in the same CICS region / queue identifier / record is identified by the relative position known as the item number / records remains accessible until the entire TSQ is explicitly deleted / records can be read sequentially or directly / may be written in the main storage  or the auxiliary storage in the DASD / WRITEQ TS, READQ TS & DELETEQ TS.
e)       Transient Data Queue(TDQ) – Stores records in order in which they are written created and deleted quickly / allows only sequential access / contents of the queue can be read only once as it gets destroyed once a read is performed and hence the name Transient / cannot be updated - requires an entry in DCT / INTRAPARTITION TDQ (Read purely internally within CICS, update not possible) / EXTRAPARTITION TDQ (Read by CICS & non-CICS programs, destination can be input or output(not both) / WRITEQ TD, READQ TD and DELETEQ TD.

21.   CICS - Intercommunication  - Communication between two or more systems - Local System , Local Resource, Remote System ,Remote Resource.
MVS SYSPLEX - Configuration of multiple MVS operating systems, work as a single system by sharing functions and programs.
CICSPlex - Set of interconnected CICS regions that own Terminals, Applications, Resources, etc. and process customer workload.
Two ways in which CICS Communicate with other system.
a)      Intercommunication Methods - MRO(Multi Region Operation) - when two CICS regions within the same MVSPLEX needs to communicate.
b)      ISC(Inter System Communication) – when a CICS region in a LOCAL server has to communicate with a CICS region in the REMOTE server.   


22.   CICS - Status Codes

ASRA - Program Check Exception / AEI0 - Program ID Error
AEI9 - Map Fail condition / AEIO - Duplicate Key
AEIN - Duplicate Record / AEID - End of file reached
AEIS - File is not open / AEIP - Invalid request condition
AEY7 - Not authorized to use the resource / APCT - Program not found
AFCA - Dataset not found / AKCT - Time out error
ABM0 - Specified map not found / AICA- Program in infinite loop
AAOW - Internal logic error / AEY9 – DB2 / IMS not up

23.   Dynamic Storage Allocation & De-allocation – GETMAIN / FREEMAIN

24.   Ways we can initiate CICS Txn
a)       Keying in txn at terminal
b)      Coding EXEC CICS Start in Pgm
c)       Coding Txn id & trigger level in DCT (Automatic Task initiation)
d)      Coding Txn Id in EXEC CICS return command.
e)       Associating attention key with PCT.
f)       Embedding Txn Id in first four position of a screen sent to terminal.
g)      Using Pgm list table.

25.  Questions
a)      In CICS not use DISPLAY , MERGE, STOP RUN & GOBACK.
b)      In CICS File Section & Environment Division not required.
c)      Restricted COBOL Verbs - File I/O statements like Open , Read. File Section and Environment Division not required. COBOL statements that invoke operating system  function like Accept, Date, Time cannot be used.  
d)      We can call each CICS instance as CICS region. CICS is high priority batch job running on mainframe operating system along with other batch jobs.
OS à CICS Interface à Online Application Program
e)      BMS
ACCUM option of SEND MAP – Build a single screen with a series of SEND MAP Commands, using more than one Map in the process.
PAGING option of SEND MAP – Build output message of more than one screen.
ROUTING option - Send output to terminal other than one associated with the transaction.
Write formatted data to terminal without using MAPS – SEND TEXT Command.
ERASE – Instructing to erase data on the screen, before printing that is being send.
f)       Register Save Area (RSA)
g)      1 MAP, enter, how can we get  Second MAP? ß ACCUM
h)      If CICS is also using IMS then if entry in RCT?
i)       ENQ & DEQ
j)       TSQ & TDQ
k)      Parameter (Attributes) used in MACRO (BMS Map).




No comments:

Post a Comment