CICS

55
Page 1 of 55 CICS (CUSTOMER INFORMATION CONTROL SYSTEM) BATCH PROCESSING Transactions are accumulated into groups or batches before processing Has a system environment where jobs run consecutively ONLINE PROCESSING Transactions are entered one at a time through a terminal Has a system environment where jobs run concurrently Feature Batch Online Data Collection Off-line On –line Input Card, tape and disk From Terminal Job Schedule At Specific intervals Instantaneous Processing Single task Multi task Mode Single thread Multi thread Resource Not Sharable Sharable Security Simple Complex Response Time Not Critical Critical Example Monthly Salary report Railway Reservation system HISTORY OF CICS CICS CHRONOLOGY 1968 CICS Type II MACRO LEVEL Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Transcript of CICS

Page 1: CICS

Page 1 of 44

CICS

(CUSTOMER INFORMATION CONTROL SYSTEM)

BATCH PROCESSING

Transactions are accumulated into groups or batches before processing

Has a system environment where jobs run consecutively

ONLINE PROCESSING

Transactions are entered one at a time through a terminal

Has a system environment where jobs run concurrently

Feature Batch Online

Data Collection Off-line On –line

Input Card, tape and disk From Terminal

Job Schedule At Specific intervals Instantaneous

Processing Single task Multi task

Mode Single thread Multi thread

Resource Not Sharable Sharable

Security Simple Complex

Response Time Not Critical Critical

Example Monthly Salary report Railway

Reservation system

HISTORY OF CICS

CICS CHRONOLOGY

1968 CICS Type II MACRO LEVEL

CICS/OS Ver I Assembler Coding

1969 CICS/DOS Ver 1

1970 CICS/OS Ver 2

1973 CICS/OS/VS 1.0.0

CICS/DOS/VS 1.0.0

1978 CICS/OS/VS 1.4.0 COMMAND LEVEL

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Page 2: CICS

Page 2 of 44

CICS/DOS/VS 1.4.0 In 4 lost Languages

1985 CICS/OS/VS 1.7.0

1986 CICS/DOS/VS 1.7.0

1987 CICS/MVS 2.1.0

Which offers address ability up to 2 GB, for VS COBOL II?

CURRENT CICS FAMILY

Product Operating System

CICS/MVS Ver 2 Rel 1 MVS/XA, MVS ESA

CICS/OS /VS Ver 1 Rel 7 MVS, MVS/XA

CICS/DOS/VS Ver 1 Rel 7 VSE

CICS/VM Rel 2 VM/SP

CICS OS2 Ver 3 OS/2

Functionally the above products are compatible with each other, with certain exceptions

caused by the differences among their corresponding operating systems.

DEFINITION OF CICS

Acts as an interface between the OS and the application, Manages the data, terminals

and application program And Provides control services for online processing.

An IBM product that handles online applications in IBM

A system that comprises of many management modules/programs to perform

program, task & storage management in Virtual Storage Environment (VSE)

An OS within the OS

A CICS job is submitted to the OS as any other batch job but as a long –running and high

priority job submitted to the OS as any other batch job.

Features

Cuts down the total amount of programming needed

Provides an environment (control Services) for the execution of application

programs

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Page 3: CICS

Page 3 of 44

Supports a network of hundreds of terminals simultaneously

Includes interfaces to files and database products.

CICS SYSTEM CONCEPT

CICS/MVS

CICS SYSTEM CONCEPT –2

CICS SYSTEM CONCEPT

1. DATA-HANDLING FUNCTIONS

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

OPERATING SYSTEM(MVS/XA)

Database

Data Storage Terminals

Other Systems

Database Access Method(DL/IDB2

Data Access Method (VSAM, BDAM)

Tele Commu nication Access Method (VTAM, TCAM, BTAM

System Services

Data Monitoring DataHandling Functions CommunicationFunctions Functions

ApplicationProgramServices

CICS Application programs(COBOL, PL/I Assembler)

Page 4: CICS

Page 4 of 44

2. APPLICATION PROGRAM SERVICES

3. SYSTEM SERVICES

4. MONITORING FUNCTIONS.

CICS FEATURES & COMPONENTS

Features

Transaction Driven

Multi-Tasking

Multi-threading

Quasi Re-entrant

Pseudo-Conversational

Priority Processing

Security Procedures

Recovery Procedures

Components

Management Modules

Control Tables

Control Blocks

Transaction

A single event or item of business between two parties

Can be either a single event or a class of similar events.

Various types of Transaction:

Identified by a transaction identification code called

TRANS ID.

TRANSACTION IDENTIFIER

One to four character codes, which is keyed to start a CICS session.

Every trans-id has a program associated with it

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Page 5: CICS

Page 5 of 44

Different terminals can invoke the same TRANS-ID and access the same program.

Invoking a trans-id will invoke a program.

TASK

Simply one iteration/instance of a transaction

CICS manages many tasks concurrently, the concept called as Multi-tasking.

CICS maintains a separate thread of control for each task.

Different tasks can concurrently access the same program, the concept called as

Multi-Threading.

MULTITASKING & MULTITHREADING

When one of the tasks requests service which involves a wait, such as file input/output, CICS

uses the wait time of the first to execute the second (a new task or an already initiated task)

Each task obtains main storage for its unique copy of the program’s working storage.

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

TASK A1WORKING-STORAGE

TASK A2WORKING-STORAGE

TASK A3WORKING-STORAGE

Page 6: CICS

Page 6 of 44

TRANSACTION

NON-CONVERSATIONAL TRANSACTION

Processes one input, responds and ends

Doesn’t pause to read a second input from the terminal

DISADVANTAGES

There is no real conversation.

CONVERSATION TRANSACTION

Processes one input, responds, waits for user to respond

The program being executed enters into a conversation with the user.

DISADVANTAGES

The time required for a response from a terminal is much longer than the time

required for the computer to process the input.

Program is loaded into main storage and remains therein until a user is finished

working with the program Unfortunately, it is not released from main storage when

not in use, locking the memory which other tasks can use

PSEDUO-CONVERSATION

A Series of nonconversational transactions gives the appearance of a single

conversational transaction

A coding technique which results in a program being loaded into main storage when

required and released when it is no longer active.

CICS loads and releases application programs from main storage automatically

RE-ENTRANT PROGRAM

Does not modify itself in any way during execution

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Page 7: CICS

Page 7 of 44

Is able to re-enter itself and continue processing, after an interruption by the

Operating System

Also, called as serially reusable program

Ensures the uniqueness of the data area and program logic to each task based on

certain programming convention

Used in online systems, thus making it possible for the OS to establish a

multithreading environment

QUSI-REENTRANT PROGRAM

Does not modify itself in any way during execution under the CICS environment

Able to re-enter itself and continue processing after an interruption by CICS

Does not alter the program itself between two CICS calls

MANAGEMENT MODULES

CICS / MVS system programs

Interface between OS and application programs

Handle the general functions that are crucial to the operation of CICS

Several in number with each one assigned a specific function

Collect user defined information from corresponding tables

Some management modules are:

TCP Terminal Control Program

KCP Task Control Program

PCP Program Control Program

FCP File Control Program

SCP Storage Control Program

ICP Interval Control Program

CONTROL BLOCKS

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Page 8: CICS

Page 8 of 44

Dynamically created by CICS whenever needed

Accessed by CICS modules during execution of tasks

Disposed of when no longer needed

Some control blocks are:

TCA Task Control Area

TWA Transaction Work Area

EIB Execute Interface Block

CWA Common Work Area

TIOA Terminal Input Output Area

CONTROL TABLES

Define the CICS/VS system environment

Each table is functionally associated with the corresponding management module

Not all modules are associated with tables

Some control tables are:

PCT Program Control Table

PPT Processing Program Table

FCT File Control Table

TCT Terminal Control Table

DCT Destination Control Table

RCT Resource Control Table

MANAGEMENT MODULES & TABLES

Management Module Control Table

Task Control(KCP) Program Control(PCT)

Terminal Control (TCP) Terminal Control (TCT)

File Control(FCP) File Control(FCT)

Basic Mapping Support (BMS) Terminal Control (TCT)

Program Control(PCP ) Processing Program (PPT)

Temporary Storage(TSP) Temporary Storage(TST)

Transient Data(TDP) Destination Control(DCT)

Trace Control(TRP) Trace Control(TRT)

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Page 9: CICS

Page 9 of 44

Journal Control (JCP) Journal Control (JCT)

System Recovery (SRP) System Recovery (SRT)

System Initialization (SIP) System Initialization (SIT)

Storage Control (SCP)

Dump Control (DCP)

Interval Control (ICP)

Network Control (NCP)

Execution Interface (EIP)

Dynamic Back-out (DBP)

Not all modules are associated with a table

Each table is associated with a module

To display a formatted screen, a terminal such as IBM 3278, must receive a series of data

stream called Native Mode Data Stream (NMDS) based on the hardware protocol

3270 FIELD STRUCTURE

The screen of the 3278 model 2 can display up to 1920 characters, in 24 rows and 80

columns

A fields is consecutive set of character positions, all having the same display

characteristics (protected, not protected and stopper field)

The first field - is protected – i.e. the terminal operator cannot type over that area of

the screen

The second field - is unprotected – i.e. the user can type data in that area

The third field - is known as the Stopper field (not visible)

In order to minimize the length of data transmission, the system

Doesn’t transmit the unused portions (protected fields)

Doesn’t transmit Null (empty portions on the screen)

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Page 10: CICS

Page 10 of 44

Nulls (hexadecimal 00) aren’t the same as Spaces (hexadecimal 40) though they look the same

on the screen

BASIC MAPPING SUPPORT

Collection of assembler language macros

Macro - An instruction which generates additional code when passed through an

Assembler program

An interface between the terminal control and application programs

Facilitates the development of device independence in application programs

Format independence

Device independence

CREATION OF MAPS

MAP Representation of on screen format

MAPSET one or a group of maps

With a name upto 7 characters, registered in the PPT

The BMS macro is run through an assembler program twice in order to get two maps

Physical Map & Symbolic Map

BASIC MAPPING SUPPORT

MAP GENERATION

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Design Screen

Code Map

Assemble

Symbolic MapPhysical Map

Page 11: CICS

Page 11 of 44

Load Library (contains literals) Copy Library (Contains Data Fields)

PHYSICAL MAP

Assembly language program created & placed in the load library

Helps in formatting a display for a given device by embedding control characters in

the data stream

SYMBOLIC MAP

Source language data structure used to resolve reference to fields in the map

Used to store variable data referenced in a COBOL program

Placed by BMS into a copy library and included in the COBOL program at compile

time

SKELETON BMS MAP DEFINITION

1……………10……………16……………………………………………. 72

PRINT NOGEN

Mapset DFHMSD TYPE = MAP, X

CTRL = (FREEKB, FRSET), X

LANG = COBOL, X

MODE = INOUT, X

TERM = 3270 X

TIOAPEX =YES

*************************************************************

mapnam1 DFHMDI LINE = 01 X

COLUMN = 01 X

SIZE = (24,80) X

*************************************************************

field1 DFHMDF POS=(,), X

ATTRB = (attr1, attr2….), X

LENGTH=99, X

INITIAL = ‘Map Constants’

Field2 DFHMDF POS=(,), X

ATTRB = (attr1, attr2….), X

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Page 12: CICS

Page 12 of 44

LENGTH=99, X

fieldN DFHMDF POS=(,), X

ATTRB = (attr1, attr2….), X

LENGTH=99, X

*************************************************************

mapnam2 DFHMDF

*************************************************************

field1 DFHMDF

fieldN DFHMDF

*************************************************************

DFHMSD TYPE = FINAL

END

BMS FORMAT RULES

PRINT NOGEN starts in the same column as the mapset definition (DFHMSD) MACRO,

USUALLY COLUMN 10

Mapset, mapname(s), and field name(s) start in column1, begin with an alphabetic character, and

are seven or fewer characters, in length

Macros such as DFHMSD, DFHMDI and DFHMDF begin in column 10 and are followed by

operands and parameters

DFHMSD – Data Fetch Hierarchy Mapset Definition

DFHMDI – Data Fetch Hierarchy Map Definition Interface

DFHMDF – Data Fetch Hierarchy Map Definition Field

Macros should be followed by one space and then an operand plus parameters such as

TYPE=MAP

Additional continuation operands must start in column 16, as does CTRL=(FREEKB, FRSET)

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Page 13: CICS

Page 13 of 44

It must have a continuation character (usually an X) in column 72

Parameters with a comma must end at or before column71

END usually starts in the same column as the preceding DFHMSD TYPE = FINAL MACRO,

which signals the end of a map

Format of a symbolic map

BMS

MAPSET DFHMSD TYPE=&SYSPARM,MODE=INOUT,LANG=COBOL

MAPNAME DFHMDI SIZE=(24,80),LINE=1,COLUMN=1

FIELD1 DFHMDF POS=(10,10),LENGTH=20,ATTRB=UNPROT

FIELD2 DFHMDF POS=(10,10),LENGTH=20,ATTRB=UNPROT

MAPSET DFHMSD TYPE=FINAL

END

SYMBOLIC MAP

01 MAPNAMEI. 02 FIELD1L PIC S9(4) COMP. 02 FIELD1F PIC X. 02 FILLER REDEFINES FIELD1F. 03 FIELD1A PICTURE X. 02 FIELD1I PIC X(20). 02 FIELD2L PIC S9(4). 02 FIELD2F PIC X. 02 FILLER REDEFINES FIELD2F. 03 FIELD2A PIC X.

02 FIELD2I PIC X(20). 01 MAPNAMEO REDEFINES MAPNAMEI. 02 FILLER PIC X(3). 02 FIELD1O PIC X(20). 02 FILLER PIC X(3).

02 FIELD2O PIC X(20).

The Symbolic map contains:

Field + L Half word binary field

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Page 14: CICS

Page 14 of 44

Field + F Flag byte

Field + A Attribute byte for both input and output field

Field + I Input data field

Field + O Output data field

The map name suffixed with I & O (both present if MODE = INOUT is coded);

A 12-byte TIOA prefix

L - A half-word binary field that contains the length of data entered by the terminal

operator

F - A one-byte flag field

Contains an X”80” if a field is modified and no data is sent (existing value is cleared /

erased)

I - Data entered by the terminal operator and received into the program

A – A one-byte that contains field that contains the attribute byte used during

output procedures to override the attribute field defined in the BMS map

MODIFIED DATA TAG

One bit of an attribute character (one for each field), that indicates whether the screen field has

been modified or not

MDT If the field has

= 0 (Off) not modified by the terminal operator

=1 (On) been modified by the terminal operator

only fields with MDTs turned on, get transmitted to the program

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Page 15: CICS

Page 15 of 44

Setting / Resetting MDT

CNTL = FRSET in DFHMSD or DFHMDF

ATTRB = (FSET,…) in DFHMDF macros

Moving the MDT attribute to the attribute byte of field in the application program sets the MDT

of the field to a value of 1

FRSET is very useful when the same map is sent repeatedly to the terminal for data entry

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Page 16: CICS

Page 16 of 44

COMMAND LEVEL PROGRAMMING

CICS commands in a COBOL-CICS program are delimited by

EXEC CICS …..

:

:

END-EXEC

EXEC CICS: Coded in Margin-B of a COBOL-CICS program

CICS COMMAND FORMAT

EXEC CICS FUNCTION

[ OPTION (argument)

OPTION (argument)

:

:

END-EXEC

FUNCTION Operation requested for

OPTION Facilities available with each function, Coded in any order and followed

by argument in parentheses.

ARGUMENT Literal (in quotes) or Data Value in program, Can be data-value, data-area,

pointer-reference Name, Label, Time in hhmmss

COMMAND LEVEL PROGRAMMING

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

CICS COMMAND LEVEL APPLICATION PROGRAM

COMMAND TRANSLATOR

TRANSLATED SOURCE CODE / TRANSLATOR LISTING

COMPILER

OBJECT MODULE / COMPILE LISTING

LINKAGE EDITOR

LOAD MODULE / LINK-EDIT LISTING

Page 17: CICS

Page 17 of 44

A COBOL command level translator replaces the delimited CICS statements with COBOL

MOVE statements followed by COBOL CALL statement

The translator also includes copybooks into the program

USING ASSEMBLED BMS MAPS

COBOL CICS command-level programs should have the BMS-generated symbolic-map copied

into either of their Working-Storage or Linkage sections

Maps are either sent from or received into the Working-Storage section or Linkage section with

the help of the basic CICS commands:

SEND MAP, RECEIVE MAP & SEND TEXT

SEND MAP COMMAND

Issued to send the physical and / or symbolic map in order to format a terminal screen

EXEC CICS SEND MAP(‘mapname’)

MAPSET(‘mapset name’)

FROM data-name)

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Page 18: CICS

Page 18 of 44

[MAPONLY / DATAONLY]

[ERASE / ERASEUP]

[CURSOR [(NUMERIC-DATA-VALUE)]]

[FREEKB]

[FRSET]

[ALARM]

END-EXEC.

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Page 19: CICS

Page 19 of 44

RECEIVE MAP COMMAND

Facilitates the receive of the symbolic map into the working-storage

EXEC CICS RECEIVE MAP(‘mapname’)

MAPSET(‘mapset name’)

[INTO (data-name) /

SET (address of a record)]

END=EXEC

SEND TEXT COMMAND

Sends a stream of text to a terminal

EXEC CICS SEND TEXT

FROM (data-value)

LENGTH (data-value)

[HEADER (data-value)]

[TRAILER (data-value)]

[ERASE]

END-EXEC

EXECUTE INTERFACE BLOCK

EIBTIME

Contains the time of the day the task was started. Seven digit packed decimal of the form

0HHMMSS

Little use in time-critical packages since NOT the current time

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Page 20: CICS

Page 20 of 44

EIBDATE

Contains the date the task was started

Format is 0YYDDD (Julian date where DDD is number of days since January 1)

Not practical for display purposes

EIBTRNID Transaction Identifier

Contains the TRANSID that started the task

Commonly used to determine how a program was started

(Forces a program to be involved only from another)

(e.g. from a menu)

EIBCPOSN Cursor Position

Supplies screen position of cursor before the RECEIVE MAP command is executed

Value from 0 to 1919-cursor displacement on screen

EIBCALEN Communication Area Length

Contains the length of the communication area being passed to the program

Value is ZERO if no communication area is passed

Used to detect the first-time condition of a Pseudo-Conversational program

EIBTRMID Terminal Identifier

Contains the name of the terminal running the task

Symbolic Name

Used for security purposes

EIBAID

Stores an indicator, when a terminal operator presses an AID (Attention Identifier) key

[like ENTER, CLEAR,

Program Function keys (PF1..PF2) AND

Program Attention keys (PA1..PA3)

On an IBM keyboard]

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Page 21: CICS

Page 21 of 44

Enables to compare the AID key pressed with the AID field in DFHAID to determine the flow of

program logic

FIELDS COMMONLY USED FOR DEBUGGING

EIBFN Function Code

Contains the last CICS command executed

EIBRCODE Response Code

Indicates the CICS commands completion status

EIBDS Data Set

Indicates the name of the data set processed by the last file-control command

NON-SUPPORTED COBOL STATEMENTS / FEATURES

Operator Communication statements

ACCEPT, DISPLAY

File I/O statements

OPEN, CLOSE, READ, WRITE, REWRITE, DELETE, START

Program Termination statements

STOP RUN, GO BACK

Sort statements

SORT, RELEASE & RETURN

Debugging statements

EXHIBIT, TRACE

String Manipulation statements

INSPECT, UNSTRING

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Page 22: CICS

Page 22 of 44

HANDLE CONDITION

Handles various anticipated or unexpected CICS conditions

EXEC CICS HANDLE CONDITION

ERROR(ERROR-MESSAGE)

END-EXEC

Up to 12 conditions can be handled by one command

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Condition

Name

Related CICS

Command

Caused by

DUPREC WRITE Record already exists

MAPFAIL RECEIVE MAP No data was sent by

operator

NOSPACE WRITE The dataset does not have

enough allocated space to

add the record

NOTOPEN READ WRITE Dataset not open

NOTFND READ Record not in file

PGMIDERR LINK XCTL Program not in Processing

Program Table

Page 23: CICS

Page 23 of 44

HANDLE AID

Invoked upon the receive of a map

Tests the Attention Identifier (AID key) received from the terminal and branches to a specified

routine in the program

One way of substituting the EIBAID checking approach

Similar in format and transfer of control to the HANDLE CONDITION command

EXEC CICS HANDLE AID

AID KEY (program-paragraph)

:

:

END-EXEC.

EXAMPLE

EXEC CICS HANDLE AID

PF3(END-ROUTINE)

PAI(CANCEL-ROUTINE)

ENTER(NORMAL-ROUTINE)

ANYKEY(WRONG-KEY-ROUTINE)

END EXEC.

EXEC CICS RECEIVE

MAP(‘FORM001’)

MAPSET(‘FORM001’)

END-EXEC.

At the end of the RECEIVE map command the control will be transferred to the appropriate

routine based on the key pressed, for which the routine is actually specified before the RECEIVE

MAP command

EVALUATE EIBAID

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Page 24: CICS

Page 24 of 44

WHEN DFHPF3 PERFORM END-ROUTINE

WHEN DFHPA1 PERFORM CANCEL-ROUTINE

WHEN DFHENTER PERFORM NORMAL-ROUTINE

WHEN OTHER PERFORM WRONG-KEY-ROUTINE

END EVALUATE.

Unlike in the EVALUATE EIBAID command (where the AID Key is checked for, usually after

the RECEIVE map command), in the HANDLE AID command, the action to be taken for the

AID key pressed, is specified beforehand

In the EVALUATE EIBAID command, the AID key can be checked for before the RECEIVE

map command also

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Page 25: CICS

Page 25 of 44

PROGRAM CONTROL COMMANDS

Manage the flow of control between application programs within the CICSSYSTEM. All

application programs must have their names specified in the PPT

Program module is invoked.

1 By Task Initiation Process

2 As a result of Link Operation

3 As result of Transfer Operation

These commands include

RETURN Return control to CICS or to an invoking program

XCTL Transfer control to another program without returning.

LINK Pass control to another program which returns control to another program

which returns control to the invoking program, after performing its logic;

Similar to a PERFORM statement in a COBOL program

LOAD Access and load a table, program or map into main storage

RELEASE Release a table, map or program from the main storage, when no longer

required

XCTL COMMAND

Does not create a lower logical level

Transfers control to another program at the same logical level

The program which issues the XCTL command will be removed from the main storage

since only one program van be active at a given logical level at a given instance

EXEC CICS XCTL

PROGRAM(alphanumeric-data-value)

[COMMAREA (data-name)

LENGTH (numeric-data-value)]

END EXEC.

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Page 26: CICS

Page 26 of 44

LINK COMMAND

Creates a lower logical level

Transfers control to another program at the lower logical level

When a RETURN is issued in the called program, control returns to the next executable

instruction of the program which issued the LINK, not to CICS

EXEC CICS LINK

PROGRAM(alphanumeric-data-value)

[COMMAREA (data-name)

LENGTH (numeric-data-value)]

END EXEC.

RETURN COMMAND

Returns control to program at next higher logical level or CICS when a task terminates

EXEC CICS RETURN

END-EXEC.

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Page 27: CICS

Page 27 of 44

COMMUNICATION AREA

(COMMAREA)

A working storage field used for passing data from one program execution to another

Passed between programs by using the RETURN, XCTL and LINK commands

Used as an area for passing data, both

1. Between programs within a transaction in the case of LINKed and XCTLed programs

and

2. Between transactions at a given terminal in the case of Pseduo-Conversational programs

Contents are transferred to the receiving program, i.e., the program to which control is passed,

and retrieved in its linkage section field called DFHCOMMAREA

EXEC CICS…..

[PROGRAM (program-name)]

[TRANSID (trans-id)]

COMMAREA (WS-COMMAREA)

LENGTH (WS-CA-LENGTH)

END EXEC

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Page 28: CICS

Page 28 of 44

CICS-DATA ACCESS

CICS-File Handling

Supports VSAM

BDAM supported in earlier versions of CICS

Files to be defined to CICS as resources

File Opening, Closing done by CICS

Provides interface for

- Random access

- Sequential access

Read, Write, Update, Delete

The files to be accessed in CICS application programs are to be defined to CICS in

the File Control Table (FCT).

File Access Methods

SAM is the primary data access method for CICS

VSAM file types supported

- Key sequenced Data Set (KSDS)

- Entry Sequenced Data Set (ESDS)

- Relative Record Data Set (RRDS)

RECORD Identification (RIDFLD)

RECORD KEYPARTIAL KEYRELATIVE BYTE ADDRESS (RBA)RELATIVE RECORD NUMBER (RRN)

VSAM File AccessRandom AccessReadUpdate

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Page 29: CICS

Page 29 of 44

DeleteWrite

Sequential Read (Browsing) Start Browsing Read Next Read Previous End Browsing Reset Browsing conditions

VSAM – READ CommandEXEC CICS

READ DATASET(filename)

INTO(rec-area)

[ LENGTH(record_length) ]

RIDFLD(key-value)

[ RBA | RRN ]

[ GENERIC ]

[ KEYLENGTH(key-length) ]

[ UPDATE ]

[ GTEQ | EQUAL ]

END-EXEC.

VSAM-File write

EXEC CICS WRITE

DATASET(file-name)

FROM(file-rec)

LENGTH(rec-length)

RIDFLD(rec-key)

[ RBA|RRN]

END-EXEC.

RIDFLD Specifies the key of the record to be written. If RBA or RRN is specified, this field is interpreted as a Relative Byte Address or Relative Record NUMBER respectively.

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Page 30: CICS

Page 30 of 44

RBA Specifies that the file is ESDS and the RIDFLD option should be interpreted as

the Relative Byte Address.

RRN Specifies that the file is RRDS and the RIDFLD option should be interpreted as

the Relative Record Number.

VSAM-File Update

EXEC CICS REWRITE

DATASET (file-name)

FROM(data-area)

[LENGTH(rec-len)

END-EXEC.

REWRITE Command is used to update a record already read. Before issuing a REWRITE command, READ command must have been issued with the UPDATE option .The key field in the record cannot be changed

DATASET Specifies the name of the file, which has to be updated.FROM Specifies the data-area from which the data is to be writtenLENGTH It’s a binary half word that indicates the length of the record to be

rewritten. Not required for VS-COBOL II.

VSAM-DELTE from file

EXEC CICS DELETE

DATASET (file-name)

RIDFLD (rec-key)

[KEY-LENGTH (key-length)]

[GENERIC[NUMREC(rec-number)]]

[RBA | RRN]

END-EXEC.

The DELETE command may be issued to delete record(s) from a data set into two ways.

Issued after a READ command with UPDATE option to delete a record that is read

Issued with RIDFLD option when there is no prior READ with UPDATE option. This

will delete the record whose key matches with the RIDFLD.

Records from VSAM KSDS and RRDS files can be deleted, but not from VSAM ESDS files.

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Page 31: CICS

Page 31 of 44

The NUMREC option will return the number of records deleted on a GENERIC delete.

KEYLENGTH must be specified for GENERIC delete.

BROWSE Operation

Establish the position from where to begin the sequential retrieval.

Retrieve record sequentially and process them as required.

Terminate the browse when no further sequential retrieval is required

BROWSE commands

STARTBR - Establish Position

READNEXT - Retrieve Records In The Ascending

READPREV - Retrieve Records In The Descending

RESETBR - Change Position

ENDBR - Terminate Browse

STARTBR The STARTBR command establishes the position within the file but does

not retrieve a record.

READNEXT The READNEXT command retrieves the record sequentially in the order

set by STARTBR command. The RIDFLD is automatically updated by

CICS from the next READ; application program NEED NOT update this.

RIDFLD can be set to a value greater than the present RIDFLD that is

fetched. If a READNEXT is performed on this manner, it is called ‘skip

sequential processing’.

ENDBR Terminates the brows operation. Normally not required but recommended

for efficiency make, as the ENDBR will release the VSAM resource

allocated for the browsing.

RESETBR To restart browsing from a different file location. This is similar to an

ENDBR followed by a STARTBR, but is more efficient because the

VSAM resource will be re-allocated rather than de-allocated and fresh

allocation.

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Page 32: CICS

Page 32 of 44

BROWSE –EXAMPLE

MOVE VALUE TO KEY-REC

EXEC CICS

STARTBR

FILE(‘FILEA’)

RIDFLD(RECKEY)

RESP(ERR-CODE)

END-EXEC

IF ERR-CODE = DFHRESP(NORMAL)

PERFORM UNTIL ERR-CODE = DFHRST(ENDFILE)

UNTIL 2000-REC-FROM-FIL-EXIT

EXCE CICS READNEXT FILE (‘FILE A’)

INTO (FILEREC)

RIDFLD(RECKEY)

RESP(ERR-CODE)

END-EXEC.

END-PERFORM

EXEC CICS ENDBR FILE (‘FILEA’)

ELSE

PERFORM 9000-HANDLE-ERROR

END-IF.

FILE HANDLING-EXCEPTIONAL CONDITIONS

Following exceptional conditions to be handled NOTFND LENGERR FILENOTFOUND DISABLED NOTOPEN NOSPACE INVREQ ILLOGIC

NOTFND Record with specified key is not in the use.LENGERR The length of the record to be rewritten is either too long or not specified

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Page 33: CICS

Page 33 of 44

DISABLED File has status of disableNOTOPEN File is closedNOSPACE There is no space on the file for write or rewrite INBREQ There are several reasons for this exception condition.No previous READ UPDATE REWRITE. Second REWRITE used before relishing the exclusive control of the REWRITE.

NOTE

All the VSAM file in a CICS application program should be registered in the File Control

Table (FCT).

The FCT entry contains all the required information for that file.

The application programmer does not need to define the physical organization and other

attitude of the file in the program.

The files are opened immediately after system initialisation, if it is specified as such in

the FCT definition.

They can also be opened using the master terminal transaction (CEMT). So, opening a

file is not the responsibility of the application program.

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Page 34: CICS

Page 34 of 44

TEMPORARY STORAGE

PURPOSE

Stores input data until fully edited and added to file

Stores screen images during multi-screen operation

Browse

Multi-screen data entry

Multi-screen display of output

Any need for seconds/minutes/hours

HOW CREATED?

Created on the fly by CICS application programs

And managed by CICS (not a true access method)

WHERE STORED?

MAIN storage (fast but expensive)

Disk auxiliary storage (slower but cheaper)

TEMPORARY STORAGE QUEUE (TSQ)

An area that will exist beyond task termination

Stores information as consecutive variable length records in queues

Is given a 1 to 8 character name

Not needed to be predefined in any particular table

If it has to be recovered in the event of an abend, its name must be entered in the

Temporary Storage Table

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Page 35: CICS

Page 35 of 44

WRITING TEMPORARY STORAGE

EXEC CICS WRITEQ TS

QUEUE (name)

FROM (data-area)

Length (data-value)

[MAIN OR AUXILIARY]

[ITEM (data-are)]

END EXEC.

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Page 36: CICS

Page 36 of 44

Example

WORKING-STORAGE SECTION.

01 WS-WORKAREA.

02 RECLEN PIC S 9(4) VALUE +100.

02 RECOUNT PIC 9 VALUE 1.

O1 WORKAREA.

02 TSQNAME.

03 TSTRMID PIC X(4).

03 FILLER PIC X(4) VALUE ‘DE01’

01 TSRECD.

02 CUSTNO PIC X(8).02 CUSTNAME PIC X(20).02 CUSTADDR PIC X(30).02 CUSTINFO PIC X(42).

PROCEDURE DIVISION.

0001-START-PARA.

EXEC CICS HANDLE CONDITION

ERROR(0003-FATALERR)

END EXEC.

MOVE EIBTRMID TO TSTERMID.

0002-BUILD-RECORD.

< build the record to add >

EXEC CICS WRITEQ TS QUEUE(TSQNAME)

FROM(TSRECD)

LENGTH(RECLEN)

END-EXEC.

0003-FATALERR.

READING TEMPORARY STORAGE

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Page 37: CICS

Page 37 of 44

Sequential or random by item number

EXEC CICS READQ TS

QUEUE(name)

INTO(data-area)

LENGTH(data-area)

[NEXT or ITEM(data-area)]

END-EXEC.

Example WORKING-STORAGE SECTION.

03 WS-WORKAREA.04 RECLEN PIC S 9(4) VALUE +100.02 RECOUNT PIC 9 VALUE 1.O1 WORKAREA.

03 TSQNAME.03 TSTERMID PIC X(4).03 FILLER PIC X(4) VALUE ‘DE01’

01 TSRECD.02 CUSTNO PIC X(8).02 CUSTNAME PIC X(20).02 CUSTADDR PIC X(30).02 CUSTINFO PIC X(42).

PROCEDURE DIVISION.0001-START-PARA.

EXEC CICS HANDLE CONDITIONERROR(0003-FATALERR)

END EXEC.0002-READ-RECORD.EXEC CICS READQ TS QUEUE(TSQNAME)

FROM(TSRECD)LENGTH(RECLEN)

END-EXEC.0003-FATALERR.

REWRITING TEMPORARY STORAGE

EXEC CICS WRITEQ TS

QUEUE(name)

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Page 38: CICS

Page 38 of 44

INTO(data-area)

LENGTH(data-value)

REWRITE

ITEM(data-Value)]

END-EXEC.

REWRITE Indicates that the already existing record needs to be updated

DELETING TEMPORARY STORAGE

Deletes an entire queue

EXEC CICS DELETEQ TS

QUEUE(name)

END-EXEC.

Note: Not possible to delete a single record

TRANSIENT DATA

Routes data to printer

Transfers messages

Routes sequential data to batch jobs

HOW CREATED?

Defined in the Destination Control Table

Cannot be on the fly by CICS application programs

Is recoverable after CICS restart

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Page 39: CICS

Page 39 of 44

HOW STORED?

Intrapartition(managed by CICS; file or terminal)

Extrapartition(stored as a data set)

TRANSIENT DATA CONTROL

Allows a CICS transaction to deal with sequential data called Transient Data Files

The two types of transient data files are:

- Intrapartition Transient Data File

- Extrapartition Transient Data File

A Transient Data File can be used as an input file or as an out file, but not as both

Also known as Transient Data Queue(TDQ) or Transient Data Destination

Each TDQ is identified by a 1 to 4 identifier called destination-id

TDQ COMMANDS

WRITE TD : To sequentially write a record

READQ TD : To sequentially read a record

DELETEQ TD : To DELETE AB Intrapartition TDQ

INTRAPARTITION TDQ

A group of sequential records which are produced and processed by the same and / or

different transactions within a CICS region

All intrapartion TDQS are stored in only one physical file (VSAM) in a CICS region,

which is prepared by the system programmer

Records for each queue are written and retrieved sequentially

Once a record has been read from a queue, it cannot be accessed again by any task i.e.

read is destructive

Used for various applications such as:

Interface among CICS transactions

Automatic Task Intitation (ATI)

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Page 40: CICS

Page 40 of 44

Facility that enables the automatic intiation of CICS transaction, by referring to

the TRIGGER LEVEL reached while accumulating data, which is preset by the

user

Message Routing

Message Broadcast

EXTRAPARTITION TDQ

A group of sequential records which interfaces between the transactions of the CICS

region and the system outside the CICS region

In input extrapartition TDQ, records are produced by the programs outside the CICS

region to be processed by the CICS transaction as input

In output intrapartition TDQ, records are produced by the transactions as output to be

processed outside of CICS

Each extrapartition TDQ is a separate physical sequential dataset

Each destination can be defined as either as input or as an output

WRITEQ TD

Adds a record to the TDQ

EXEC CICS WRITEQ TD

QUEUE(name)

FROM(data-area)

LENGTH(data-value)

END-EXEC.

Example

WORKING-STORAGE SECTION.

01 MSG-AREA.

05 MSG-TO-LOC PIC X(2) VALUE ‘GE’.

05 FILLER PIC X VALUE SPACE’.

05 MS-OP-FROM PIC X(5) VALUE ‘JIM’.

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Page 41: CICS

Page 41 of 44

05 FILLER PIC X VALUE SPACE’.

05 MS-OP-TO PIC X(5)

05 FILLER PIC X VALUE SPACE’.

05 MSG-MESSAGE PIC X(40).

77 MSG-LENGTH PIC S9(4) COMP.

PROCEDURE DIVISION.

001-SATRT-PARA.

MOVE ‘MARY’ TO MSG-OP-TO.

MOVE ‘HELLO, THIS IS TEST FOR MESSAGE

SWITCHING’ TO MSG-MESSAGE.

MOVE 55 TO MSG-LENGTH.

EXEC CICS WRITEQ TD

QUEUE (‘MSGS’)

FROM(MSG-AREA)

LENGTH(MSG-LENGTH)

END-EXEC.

READQ TD

Reads a record from a TDQ

EXEC CICS READ TD

QUEUE(name)

INTO(data-area)

LENGTH(data-area)

END-EXEC.

EXAMPLE

WORKING-STORAGE SECTION.

01 WS-WORKAREA.

02 RECLEN PIC S 9(4) VALUE +100.

01 TDRECD.

02 CUSTNO PIC X(8).02 CUSTNAME PIC X(20).02 CUSTADDR PIC X(30).

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Page 42: CICS

Page 42 of 44

02 CUSTINFO PIC X(42).PROCEDURE DIVISION.

0001-START-PARA.

EXEC CICS HANDLE CONDITION

ERROR(0004-FATALERR)

QZERO(0003-ENDPGM)

END EXEC.

0002-READ-RECORD.

EXEC CICS READQ TS QUEUE(‘E444’)

INTO(TDRECD)

LENGTH(RECLEN)

END-EXEC.

< PROCESS TRANSIENT DATA RECORD >

GO TO 0002-READ-RECORD.

0003-ENDPGM.

DELETEQ TD

Reclaim unused space and deletes all remaining records in a queue.

EXEC CICS DELETEQ TD

QUEUE(name)

END-EXEC.

Example

WORKING-STORAGE SECTION.

01 WS-WORKAREA.

02 RECLEN PIC S 9(4) COMPVALUE +100.

01 TDRECD.

02 CUSTNO PIC X(8).02 CUSTNAME PIC X(20).02 CUSTADDR PIC X(30).02 CUSTINFO PIC X(42).

PROCEDURE DIVISION.

0001-START-PARA.

EXEC CICS HANDLE CONDITION

ERROR(0005-FATALERR)

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Page 43: CICS

Page 43 of 44

QZERO(0003-DELTQ)

END EXEC.

0002-READ-RECORD.

EXEC CICS READQ TS QUEUE(‘E444’)

INTO(TDRECD)

LENGTH(RECLEN)

END-EXEC.

< PROCESS TRANSIENT DATA RECORD >

GO TO 0002-READ-RECORD.

0003-ENDDELTQ.

EXEC CICS DELETEQ TD QUEUE(‘E444’)

END-EXEC

0004-ENDPGM

TDQ vs. TSQ-1

FEATURE

QUEUE

SPECIFICATION

Name

Registration

Location

Storage

TDQ

4Character Destination-id

Predefined in the DCT

Associated with datasets

All intrapartition TDQs exist

in only one physical (VSAM)

file in a CICS region;

Each extrapartition TDQ

exists in a separate physical

file, on the disk, tape or

associated with a printer /

plotter

TSQ

8 Character Queue-id

Optional

Associated with either Main

/ Auxiliary storage

A scratch pad memory

facility;

An external VSAM file

when present in auxiliary

storage

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.

Page 44: CICS

Page 44 of 44

DATA MANAGEMENT

Updation

Deletion

Operations Possible

Not possible

Intrapartition is read

destructive

READ

WRITE

DELETE

Possible

Record /item delete not

possible

READ

WRITE

DELETE

REWRITE

Copyright 2003, Samjass Technologies Pvt. Ltd., All rights reserved.