27
C I C S (Customer Information Control System) Table of Contents Introduction to CICS Basic Mapping Support Program Control File Control Queues Program preparation CICS Supplied Transactions

CICS reference

Embed Size (px)

Citation preview

Page 1: CICS reference

C I C S

(Customer Information Control System)

Table of Contents

Introduction to CICSBasic Mapping SupportProgram ControlFile ControlQueuesProgram preparationCICS Supplied Transactions

Page 2: CICS reference

Introduction to CICS

Introduction

Customer Information Control System -CICS developed in late 1960s 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 language version - commands to request CICS services - Single command can replace series of macros.

Batch & Online Environment

BATCH SYSTEM

1. Input data is prepared and given in a sequence (file)2. Processing sequence is predictable and hence restarting the process in case of

failure is easy.3. Programs and files can’t be shared4. Programs are scheduled through jobs

ONLINE SYSTEM

1. Data is entered as needed from the terminal2. Since processing seq. is unpredictable, special recovery/restart proc. is reqd. in case

of failure.3. Programs and files can be shared4. Transaction can be run any time

CICS & Operating System DB/DC System

CICS System Services

Data-Communication Functions Data-Handling Functions Application Program Services System Services Monitoring Functions

Page 3: CICS reference

Task &Transaction

Task:- A basic unit of work which is scheduled by the operating system or CICS

E.g.; -Read from and write to the terminal

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

Application Programming Concepts

Pseudo-Conversational Multitasking Multithreading Quasi-Reentrancy

Terminal Conversation

Conversational: A mode of dialogue between program and terminal based on a combination of sending message and receiving message within the same task.Since human response is slower than the CPU speed, a significant amount of resource will be wasted just waiting.

Conversational Transaction Example

PROCEDURE DIVISION.:FIRST-PROCESS.EXEC CICS RECEIVE ---- <= TSK1, 12345END-EXEC.: ProcessEXEC CICS SEND ----- <= EMP (12345) DetailsEND-EXEC.* - - - - - - Program Waits For Response - - - - -SECOND PROCESS.EXEC CICS RECEIVE ----- <= User Enters DataEND-EXEC.: Process

Page 4: CICS reference

Pseudo-Conversational: A mode of dialogue between program and terminal which appears to the operator as a continuous conversation but which is actually carried by a series of tasks.

Pseudo-Conversational Example

Transaction TSK1Program PROG1

PROCEDURE DIVISION.:EXEC CICS RECEIVE END-EXEC.:EXEC CICS SEND END-EXEC.EXEC CICS RETURNTRANSID (‘TSK2’)END-EXEC.

CICS Components

Control Programs (or Management Modules)Programs that interface between OS and application programHandles the general functions that are crucial to operation of CICS

Program Control PCPFile control FCPTerminal Control TCPTask Control KCPTemporary Storage TSPTransient Data TDPStorage Control SCPInterval Control ICPJournal Control JCP

Control Tables Define the CICS environmentFunctionally associated with the management module

Processing Program Table PPTFile Control Table FCTTerminal Control Table TCTProgram Control Table PCT

Page 5: CICS reference

Temp. Storage Table TST Destin. Control Table DCT

Control Blocks (or Areas)Contain system type information. E.g. Task Control Area contains information

about the task

CICS Program Considerations

Considerations

- Must eventually return control to CICS

- Can’t modify procedure division instructions ‘cause CICS programs may be shared by many tasks

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

CICS Program Restrictions

Restrictions

- No CONFIG. SECTION, I/O SECTION to be specified in the ENVIRONMENT DIVISION.

- FILE SECTION, OPEN, CLOSE, and non-CICS READ & WRITE statements are not permitted because file management is handled by CICS.

- COBOL commands such as ACCEPT, DISPLAY, EXHIBIT, TRACE, STOP RUN, GOBACK are avoided.

Page 6: CICS reference

Basic Mapping Support

Introduction to BMS

Primary functions of BMS:Removal of device dependent codes from Application ProgramRemoval of constant information from Application program (Headers, Titles...)Construct NMDS - Native Mode Data StreamText handlingTerminal Paging & Message routingContents of the screen defined thru’ BMS is called Map.Map is a program written in assembly language.BMS macros are available for Map coding.

Map and Mapset

Representation of one screen format is called Map (screen panel).One or more maps, linkedited together, makes up a Mapset (load module).Mapset must have a entry in PPT Mapset name has two parts.

Generic name 1- 7 chars. Used in App. pgm.Suffix 1 char. To identify the device type

Multimap PanelDynamically constructing a screen panel with multiple maps at the execution time.

Types of MAPS

There are 2 types of MAPS

Physical MapPhysical Map is a map used by CICS (CSECT)Ensure device independence in the application program

Symbolic MapEnsure device and format independence in the app pgm. Symbolic Map is a map used by Application Program (DSECT)

Example Of Symbolic Map01 EMPRECI.02 FILLER PIC X(12).02 EMPNAL PIC S9(4) COMP.02 EMPNAF PIC X.02 FILLER REDEFINES EMPNAF.03 EMPNAA PIC X.

Page 7: CICS reference

02 EMPNAI PIC X(21).

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

Physical & Symbolic Map - Logic Flow

Map definition MacrosGeneral Format1 16 72setname operation operands contd.

Example

EMPMAPDFHMSD TYPE=MAP, XMODE=INOUT, XLANG=COBOL, XSTORAGE=AUTO, XTIOAPFX=YES* ANY COMMENTS

Order of Macros

DFHMSD TYPE=DSECT Mapset DFHMDI MapDFHMDF A fieldDFHMDF A field:DFHMDI MapDFHMDF A fieldDFHMDF A field: DFHMSD TYPE=FINAL MapsetEND

DFHMSD Macro

Define a mapset and its characteristics or to end a mapset definition

ExampleEMPMSET DFHMSD TYPE=&SYSPARM , X

MODE=INOUT, XLANG=COBOL, XSTORAGE=AUTO, XTIOAPFX=YES, XCNTL=(FREEKB,FRSET,PRINT)

Page 8: CICS reference

DFHMDI Macro

Define a map and its characteristics ExampleEMPMAP DFHMDI SIZE=(ll,cc), X

LINE=nn, XCOLUMN=mm, XJUSTIFY=LEFT/RIGHT

Screen LayoutWhere

& Attribute charactern Unprotected numeric- Cursor

DFHMDF

Macro For The Above Layout

Define a field and its characteristicsExample

DFHMDFPOS(ll,cc), XINITIAL=‘Customer No. :’, XATTRB=ASKIP, XLENGTH=14 CUSTNO DFHMDF POS=(ll,cc), XATTRB=(UNPROT,NUM,FSET,IC), XJUSTIFY=RIGHT, XPICIN=‘9(8)’, XPICOUT=‘9(8)’, XLENGTH=8

Attribute character

Invisible one byte characterDefines the characteristics of a field

Thru’ ATTRB parameter of DFHMDF.There are different kinds of attributes

- Attributes to control the display intensity of the field- Keyboard Attributes- Attribute Related to the Field Modification- Cursor Control Attribute

Page 9: CICS reference

Modified Data Tag

Indicates the field has been modified or notEffective use of MDT reduces the amount of data traffic.MDT setting/resetting

- when the user modifies a field on the screen- CNTL=FRSET, defined in map/mapset- FSET in ATTRB parameter of DFHMDF

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 one unprotected field.Screen Layout :

&xxxxx&$ &xx where

$ Skipper field& Attribute byteX Unprotected field

Stopper Technique

Unlabelled 1-byte field with the protect attribute DFHMDF POS(ll,cc),ATTRB=PROT,LENGTH=1To stop the cursor in order to prevent erroneous field overflow by terminal user.Screen Layout:

&xxxxx&$#&$ where

# Stopper field

Cursor Positioning Techniques

Static positioning (map definition)

Dynamic/Symbolic Positioning (app. pgm)

Dynamic/Relative Positioning (app. pgm)

AID KEYS

Indicates the method to initiate the transfer of information from terminal to CICS.PF keys, PA keys, ENTER & CLEAR keyEIBAID contains, recently used AID codeStandard AID list - DFHAIDHANDLE AID establish the routines that are to be invoked when the aid is detected

Page 10: CICS reference

by a RECEIVE MAP commandSyntax :

EXEC CICS HANDLE AIDOption (label)END-EXEC Conditions: INVREQ

Numeric Sign/Decimal Pt Handling

Numeric Sign : For input operations, Separate fields or CR/DR field approach can be used and for output operations, PICOUT parameter can be given in macro

Decimal Point : For input operations, Virtual decimal point or Separate fields approach can be used and for output operations, PICOUT parameter has to be given in the field definition macro.

SEND MAP

Writes formatted output to a terminal.Syntax :

EXEC CICS SEND MAP(mapname)[[ FROM(dataname) ] [DATAONLY] | MAPONLY] [ MAPSET(mapsetname) ][ CURSOR(VALUE) ][ FREEKB ][ ERASE ][ FRSET ][ HANDLE | NOHANDLE [ RESP (dataname) ] ]END-EXEC

Conditions : INVREQ,LENGERR

RECEIVE MAP

To receive input from a terminalSyntax :EXEC CICS RECEIVE MAP (mapname)[ SET(pointer) | INTO(dataname) ][LENGTH(msg-len)][ MAPSET(mapsetname) ][ HANDLE | NOHANDLE [ RESP() ] ]END-EXEC

Conditions: INVREQ, MAPFAIL

Page 11: CICS reference

Types of BMS Panel operations

Single Map panel Text Panel Multipage Message Multimap Panel Multimap/Multipage Message

Screen Design Considerations

Functional Screen Design

User-Friendly Screen Design

PROGRAM CONTROL

Commands LINK XCTL RETURN LOAD RELEASE

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.

Syntax: EXEC CICS LINKPROGRAM(name)[COMMAREA(data-area)[LENGTH(data-value)]] END-EXEC.

Conditions: PGMIDERR, NOTAUTH, LENGERR

Page 12: CICS reference

XCTL

To transfer control from one application program to another in the same logical levelThe program from which control is transferred is releasedData can be passed to the called program using COMMAREAIf the called program is not already in main storage it is loaded

Syntax:EXEC CICS XCTLPROGRAM(name)[COMMAREA(data-area)[LENGTH(data-value)]] END-EXEC.

Conditions: PGMIDERR, NOTAUTH, LENGERR

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

Syntax:EXEC CICS RETURN[TRANSID(name)[COMMAREA(data-area)[LENGTH(data-value)]]] END-EXEC.

Conditions: INVREQ, LENGERR

LOAD

To load program/table/map from the CICS DFHRPL concatenation library into the main storageUsing load reduces system overhead

Syntax:EXEC CICS Load Program(name)[SET (pointer-ref)][LENGTH (data-area)]END-EXEC.

Conditions: NOTAUTH, PGMIDERR

Page 13: CICS reference

RELEASE

To RELEASE a loaded program/table/map

Syntax:EXEC CICS RELEASEPROGRAM(name)END-EXEC.

Conditions: PGMIDERR, NOTAUTH, INVREQ

COMMAREA

Data passed to called program using COMMAREA in LINK and XCTLCalling program - Working Storage definitionCalled program - Linkage section definition under DFHCOMMAREACalled program can alter data and this will automatically be available in calling program after the RETURN command ( need not use COMMAREA option in the return for this purpose )EIBCALEN is set when COMMAREA is passed

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 depending on the exceptional condition occurred.

HANDLE CONDITION

HANDLE CONDITION condition[(label)]... 'condition' specifies the name of the condition, and 'label' specifies the location within the program to be branched .Remains active while the program is executing or until it encounters IGNORE/another HANDLE cond.

Syntax :EXEC CICS HANDLE CONDITION

Page 14: CICS reference

ERROR(ERRHANDL) LENGERR(LENGRTN)END-EXEC

LENGERR will be handled by system

Alternative to HANDLE Condition:

NOHANDLE to specify “no action to be taken for any condition or attention identifier (AID) “

RESP(xxx) "xxx" is a user-defined fullword binary data area. On return from the command, it contains a return code. Later, it can be tested by means of DFHRESP as follows,If xxx=DFHRESP(NOSPACE) ... orIf xxx=DFHRESP(NORMAL) ... IGNORE CONDITION

IGNORE CONDITION condition condition ...‘condition’ specifies the name of the condition that is to be ignored( no action will be taken)

Syntax :EXEC CICS IGNORE CONDITIONITEMERRLENGERR END-EXEC

This command will not take any actions if the given two error occurs and will pass the control to the next instruction.

PUSH & POP

To suspend all current HANDLE CONDITION, IGNORE CONDITION, HANDLE AID and HANDLE ABEND commands. Used for e.g. while calling sub-pgms (CALL)While receiving the control, a sub-program can suspend Handle commands of the called program using PUSH HANDLEWhile returning the control, it can restore the Handle command using POP HANDLE

Syntax of Push:EXEC CICS Push HandleEND-EXEC.

Syntax of Pop :EXEC CICS PopHandleEND-EXEC.

Page 15: CICS reference

EXEC Interface Block (EIB)

CICS provides some system-related information to each task as EXEC 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 ( 2 Bytes)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)

Processing Program Table – PPT

DFHPPT TYPE=ENTRYPROGRAM |MAPSET= name[PGMLANG= ASM|COBOL|PLI][RES= NO|FIX|YES]:: other options: Eg.DFHPPT TYPE=ENTRY,PROGRAM=TEST, PGMLANG=COBOL

PCT Entry

DFHPCT TYPE=ENTRYTRANSID= namePROGRAM=nameTASKREQ=pf6RESTART=yes/no ( TRANSEC = 1to 64)RSLKEY= 1 to 24 resource level keySCTYKEY= 1 to 64 security key::other options

File Handling

VSAMDifferent types of VSAM Datasets used in CICS are :

Page 16: CICS reference

ESDS Entry Sequenced DatasetKSDS Key Sequenced DatasetRRDS Relative Record Dataset

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.Journalling.Opening and closing Files.

Defining Files

In CICS, Files cannot be created, Files can be created using IDCAMS Utility.

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

Defining A File to CICS

Files should be defined in FCT (File Control Table).FCT will contain all the Information about a File. (like dataset name, access methods, permissible file service request, etc.) Defining Files can be done either by CEDA Transaction or DFHFCT Macro.

Syntax of DFHFCT Macro DFHFCT TYPE=FILE,ACCMETH=VSAM,

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

FILSTAT=(ENABLED,OPENED)

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.

Important Key-Words

Page 17: CICS reference

Dataset/File :- Name in the FCT.Into/From (WS-Rec) :- Working-Storage Area defined in the program 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.

Random READ

EXEC CICS READ File(filename) [SEt() | Into()] RIdfld(Rec-Key) END-EXEC.

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

Example for Random Read EXEC CICS READFile( 'INVMAS ') Into(WS-INVMAS-REC)Length(WS-INVMAS-LEN)RIdfld('7135950602') | RIdfld(WS- INVMAS-KEY)END-EXEC.

Sequential Read

Sequential Read is done by Browse OperationEstablish the pointer to the First Record to be Read Using StartBr.Next and Previous Records can be Read as required Using ReadNext and ReadPrev.End the Browse Operation at last.Browse can be re-positioned.During Browse Operation, Records cannot be Updated.

Syntax for STARTBREXEC CICS STARTBRFILE(filename) RIDFLD(data-area)END-EXEC.

Condition : DISABLED, IOERR, NOTFND, NOTOPEN.

Reading the Record after STARTBR

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

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

Page 18: CICS reference

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.

ENDBRowse

ENDBRowse terminates a Previously issued STARTBR.

SYNTAX:EXEC CICS ENDBRFILE(filename)END-EXEC.

Condition: INVREQ

RESETBR

Its effect is the same as ENDBR and then giving another STARTBR.

Syntax:EXEC CICS RESETBRFILE(filename) RIDFLD(data-area)END-EXEC.

Condition: IOERR, NOTFND.

WRITE Command

Adds a new record into the File.For ESDS, RIDFLD is not used but after write execution, RBA value is returned and Record will be written at the end of the File. For KSDS, RIDFLD should be the Record Key. The record will be written depending

on the Key. MASSINSERTion must be done in ascending order of the Key.

Syntax :EXEC CICS WRITE FILE(filename)FROM(data-area)RIDFLD(data-area)END-EXEC.

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

Page 19: CICS reference

REWRITE Command

Updates a Record which is Previously Read with UPDATE Option.

REWRITE automatically UNLOCKs the Record after execution.

Syntax:EXEC CICS REWRITEFILE(filename)FROM(data-area)END-EXEC.

Condition: DUPREC, IOERR, LENGERR, NOSPACE.

DELETE Command

Deletes a Record from a dataset.Record can be deleted in two ways,

RIDFLD with the full key in it. andthe record read with READ with UPDATE will be deleted.

Multiple Records Delete is possible using Generic Option.

Syntax:EXEC CICS DELETE FILE(filename)RIDFLD(data-area) OptionalEND-EXEC.

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

UNLOCK

To Release the Record which has been locked by READ with UPDATE Command.

Syntax:EXEC CICS UNLOCKFILE(filename): [other options]END-EXEC.

Condition: DISABLED, IOERR, NOTOPEN.

General Exceptions

The following Exceptions usually will occur for ALL CICS File Handling Commands.

Page 20: CICS reference

FILENOTFOUND, NOTAUTH, SYSIDERR, INVREQ

Communication With Databases

CICS - DB2

CICS provides interface to DB2.CICS programs can issue commands for SQL services in order to access the DB2 database.

EXEC SQL function[options]END-EXEC

RCT Entry

The CICS-to-DB2 connection is defined by creating and assembling the resource control table (RCT)The information in RCT is used to control the interactions between CICS & DB2 resourcesDB2 attachment facility provides a macro (DSNCRCT) to generate the RCT.The RCT must be link-edited into a library that is accessible to MVS

DB2 – Precompiler

Source Program (EXEC SQL...| EXEC CICS...) DB2 Precompiler|CICS command translator |Compile By COBOL|Linkedit by Linkage editor| Load Module

Program Preparation

Introduction

Preparing a Program to run in CICS Environment.Defining the Program in the CICS Region.Executing the Program.

Page 21: CICS reference

Preparing a Program

CICS requires the following steps to prepare a Program.Translating the Program.Assemble or Compile the Translator Output. &Link the Program.

Translation

Translates the ‘EXEC CICS’ Statements into the Statements your Language (COBOL) Compiler can Understand.

The Translator gives two outputs, a Program Listing as SYSPRINT 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

As the CICS Commands have been translated, The Compilation of the CICS Program is the same as Language Program.

Hence, the Compiler Options can be specified as required.

Defining the Program

The Application should be defined and Installed into the PPT.This can be done either by using CEDA Trans. or DFHPPT.

CICS Supplied Transactions

CESN/CESF Transactions

To sign on to CICS systemCESN [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 languageSign off by CESF which breaks the connection between the user and CICSIf the Sign on is done twice for the same userid at the terminal, the previous operator

will be signed offCECI - Command Level Interpreter

To build and test the effect of EXEC CICS commandsCECI 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.

Page 22: CICS reference

CEMT-Master Terminal Transaction

CEMT provides the following servicesDisplays the status of CICS & system resourcesAlter the status of CICS & system resourcesRemove the installed resource definitionsPerform few functions that are not related to resources

CEBR-Temporary Storage Browse

To browse the contents of CICS temporary storage queues (TSQ)CEBR by default will show the queue associated with the current terminal ‘CEBRL001’ which can be overridden to view any other queueTERM to browse TSQ for another terminalQUEUE to make the named queue, currentPUT to copy the current queue contents into TDQGET to fetch TDQ for browsingPURGE erases the contents of the current queue