Sei sulla pagina 1di 9

CICS

1. CICS Overview:

Batch Vs On-line systems:


Batch system
Data is batched together before processing
Data is sequential from cards , tape or disk
Master file can be used by one program at a time
Output consists of printed reports or updated master files
Online system
Data is entered individually, in any order
Transactions are initiated from terminal
Information is always current
Output is displayed on the terminal
Turnaround time is measured in seconds

What is CICS
CICS is an OLTP (Online Transaction Processing) environment.
CICS appears to be a separate environment but is actually a JOB that runs under the main OS
(OS/390, Z/OS).
Customer Information Control System Features:
Transaction management
Data management for DBs and files
Terminal and Screen handling
Abnormal and Exception condition handling
Logging / journaling

History of CICS

Developed in late 1960s by IBM

Operational in over 90 countries

Runs on approx. 75 percent of all MVS installations

Before 1960s, Online systems were developed on a custom made basis involving OS,
Tele communication access methods, data access methods, and application programs

Initially CICS was developed as database/data communication (DB/DC) control system

Initially used to simplify tedious task of integrating applications with telecommunications


facilities

Macro level CICS : Application programs used the assembler-macro type CICS macros
for requesting CICS services

Command level CICS: CICS commands developed as high-level language version of


CICS macros.

Characteristics of CICS
Multitasking:
Multitasking means the O/S allows more than one task to be executed concurrently, regardless
of whether the tasks use the same program or different programs.
CICS manages multitasking of CICS tasks within its own region. i.e. CICS provides multitasking
environment where more than one CICS task run concurrently.
Multithreading:
A program is shared by several tasks concurrently under Multitasking environment.
It is subset of Multitasking.
CICS manages multithreading of CICS tasks within its own region.
CICS provides the Multithreading Environment where more than one CICS task which uses the
same program, run concurrently.

Reentrant:
A Program which does not modify itself so that it can re-enter to itself and continue processing
after and interruption by the O/S. These are also known as Re-enterable Programs or Serially
reusable Programs.
It ensures the uniqueness of the data area and Programming logic to each task based on a
certain programming convention.
A program which modify itself so that it cant re-enter to itself is called a Non-reentrant
Program so it cant be used in Multithreading Environment.
Example: Batch Programs.
Conventions used by Reentrant programs:
Constants in Working-storage :
A Reentrant Program defines only Constants in its Working-Storage Section.
These constants will never be modified and shared by the Tasks.
Variables in Dynamic Working-Storage (DWS).
A Reentrant program acquires a unique storage area (DWS) dynamically for each task
by issuing GETMAIN.
All variables will be placed in DWS for a task.
Restriction on Program Alteration
A program must not alter the program itself.
If it alters itself after a Supervisor Call (SVC), it must restore the alteration to the original
before the next SVC.
Quasi Reentrant:

A CICS Program which doesnt modify itself is called QRP.

A QUASI is a term under the CICS-Multithreading Environment in order to distinguish


this from the Reentrant program, which is the term under the O/S Multithreading
environment.

The Conventions used by the QRP is same as Reentrant program except for the
following one difference.
To acquire a DWS in Reentrant, O/S will issue a GETMAIN whereas in QRP,
CICS issues its own commands equivalent to GETMAIN.

Transaction Concepts:
A transaction can be thought of as a unit of work, it can be as simple as a single program that
performs an update or returns the result of an enquiry or involves complex multi-program
structure to complete the unit of work.
Transaction Types
1) Non-Conversation Transaction: The Non-conversational mode does not involve any
conversation with terminal user. There are two ways of initiating non conversational
transaction
Example: Report printing, Message switching.
2) Conversational Transaction: In this mode, when a program attempts a conversation with
the terminal user, it sits idle while it waits until the user responds, holding resources
unnecessarily. While a conversational program waits for user input, the task associated with
that program must remain in storage. Only after the completion of user response does the
program proceed to the next processing
3) Pseudo Conversational Transaction: The programming technique in which the task will not
wait for the end-user replies on the terminal. Terminating the task every time the application
needs a response from the user and specifying the next transaction to be started when the
end user press any attention key (Enter, PF1 through PF24, PA1,PA2 and Clear) is pseudoconversational processing. A pseudo-conversational program ends after it sends data to a
terminal, and some of the resources used by the program are released. CICS restarts the

program when the user completes an entry and presses one of the terminals attention
identifier (AID) keys.
CICS System programs and Tables:
PCT:

All CICS transactions and associated programs are defined here


Only those programs need be defined in PCT that :
1) Are directly invoked by a terminal user OR
2) Are invoked by CICS thru the RETURN TRANSID command
PPT:
ALL programs that are known to CICS.
All Map sets.
FCT:

All files known to CICS must be defined in FCT.

Individual programs MUST NOT open/close files.


Basic CICS Application Programming:
Structure of CICS Application Program:
IDENTIFICATION DIVISION: Same as that of Batch programs
ENVIRONMENT DIVISION: Only the Header required. CONFIGURATION SECTION,
INPUT-OUTPUT SECTION, FILE CONTROL and SELECT are not required.
DATA DIVISION: FILE SECTION is not required.
PROCEDURE DIVISION: Same as that of Batch programs. COBOL statements and
CICS commands should be coded here.
Some of the commands used in the Batch programs cannot be used in the CICS
programs because these basically trigger OS supervisor calls (SVCs) which cannot be
issued in a CICS application programs.
Command Format:
The general syntax of a CICS command
EXEC CICS
command option (value)...
END-EXEC.
Example:
A CICS command that receives data from the terminal
EXEC CICS
RECEIVE MAP('INQMAP1')
MAPSET('INQSET1')
INTO(INQMAP1I)
END-EXEC.

CICS Command Language Translator and Compiler:


The translator first translates CICS commands of the source codes into legal statements
of the language on subject (e.g., COBOL). The translator also inserts code into your
program that it needs to operate under CICS.
Using the output from the translator, the compiler compiles the program. The object from
the compiler is then link edited, creating a load module of the program.
Translated code for a CICS READ command

*
*
*
*
*

EXEC CICS
RECEIVE MAP('INQMAP1')
MAPSET('INQSET1')
INTO(INQMAP1I)
END-EXEC.
MOVE '..}............00109 ' TO DFHEIV0
MOVE 'INQMAP1' TO DFHC0070
MOVE 'INQSET1' TO DFHC0071

CALL 'DFHEI1' USING DFHEIV0 DFHC0070 INQMAP1I DFHDUMMY


DFHC0071.

Sign-on and Sign-off to CICS :

For signing on to CICS region, the CICS-Supplied Transaction CESN or CSSN can be
used, which prompts the sign-on screen

CSSN: is a conventional sign-on transaction. The password for CSSN is constant unless
is manually changed.

CESN: Is the new sign-on transaction with External Security Manager (ESM). The
password for CESN will expires automatically in the specified period through ESM.

For Sign-off from the CICS region, the CICS Supplied Transaction CSSF or CESF.

Initiation of a Transaction in CICS :

A transaction is started in CICS by entering a 4 character transaction id. When you enter
the transaction id, this starts the program associated with that transaction id.

This is a complex process involving CICS control programs and control tables.

When a transaction identifier and data are entered in a terminal, TCP with TCT
recognizes incoming data from the terminal.

TCP places the data from the terminal into TIOA and sets the pointer into TCT entry of
the terminal.

TCP passes control to KCP, which realizes the transaction identifier in the data in TIOA.

SCP acquires the storage for the Task Control Area.

KCP through PCT finds the application program associated with the transaction.

KCP passes control to PCP, which fetches the application program from the load library
and places it into the main storage.

Various ways of Initiating a Transaction in CICS:

By a transaction identifier entered in a terminal with ENTER Key

By a transaction identifier associated with a terminal for pseudo-conversation

By the START command, which initiates a transaction specified in the parameter

By Automatic Task Initiation (ATI).

By a 3270 attention identifier. For the IBM 3270 type terminals, any of the PF
keys and PA keys could be defined in PCT to initiate a CICS transaction.

2. CICS Supplied Transactions

CESN (logon) / CESF (logoff):

For signing on to CICS region, the CICS-Supplied Transaction CESN or CSSN can be
used, which prompts the sign-on screen

CSSN: is a conventional sign-on transaction. The password for CSSN is constant unless
is manually changed.

CESN: Is the new sign-on transaction with External Security Manager (ESM). The
password for CESN will expires automatically in the specified period through ESM.

For Sign-off from the CICS region, the CICS Supplied Transaction CSSF or CESF.
CEMT (Master Terminal Transaction):

This is used to manipulate the CICS environment, Such as transactions, Programs, Files,
TSQs, and tasks.

Some of the Tasks those can be performed:


Inquire Files, Transactions and Programs
File Open/Close
New copy the program / Map
Purge Transactions
Shutdown the CICS system.
CEDA / CEDB / CEDC
Used by System programmers to administer the CICS environment

3. Exception handling in CICS:

EXECUTE INTERFACE BLOCK (EIB):


CICS automatically provides some system related information to each task in a form of
EIB, which is unique to the CICS command level.
The definition of this area (DFHEIBLK) is inserted into the Linkage Section of the
program
Commonly used EIB information:
EIBAID
: Attention-id.
EIBCALEN
: Length of DFHCOMMAREA.
EIBDATE
: Date when this task started
EIBFN
: Function code of the last command
EIBRCODE
: Response code of the last command.
EIBTASKN
: Task number of this task.
EIBTIME
: Time when this task started.
EIBTRMID
: Terminal - id.
EIBTRNID
: Transaction -id.

EIB Example:
The following is an example of using EIB information in an application program.
PROCEDURE DIVISION.
:
IF EIBTRMID = CRT1
GO TO ROUTINE-CRT1.
IF EIBTRNID = INQ1
GO TO ROUTINE-INQ1.
Execution results:
If the terminal identifier is CRT1 control will be passed to the paragraph
ROUTINE-CRT1.
If the transaction identifier is INQ1 control will be passed to the paragraph
ROUTINE-INQ1.

Handle condition:
It is used to transfer control to the procedure label specified if the exceptional condition specified
occurs.
EXEC CICS HANDLE CONDITION
condition (label)
END-EXEC.
The general error condition (ERROR) can be specified within the same list to specify that all other
conditions cause control to be passed to the label specified.
Example:
EXEC CICS HANDLE CONDITION
QIDERR(QIDERR-RTN)
MAPFAIL (MAPFAIL-RTN)
ERROR (COMMON-ERR-RTN)
END-EXEC
Maximum of 12 Conditions can be specified in one HANDLE CONDITION.
Ignore Condition:
It causes no action to be taken if the condition specified occurs in the program. i.e. the control will
be returned to the next instruction following the command which encountered the exceptional
condition.
EXEC CICS IGNORE CONDITION
condition
END-EXEC.

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

PUSH & POP COMMANDS:


The PUSH and POP commands are used to suspend and reactivate, respectively, all HANDLE
CONDITION requests currently in effect. These are useful while performing a subroutine
embedded in a main program. A called routine can use the PUSH command to suspend the
existing HANDLE CONDITION requests, whereas, before returning control to the caller, the
called routine can restore the original requests using the POP command.
EXEC CICS PUSH HANDLE
END-EXEC.
EXEC CICS POPHANDLE
END-EXEC.
NOHANDLE option:
The NOHANDLE option can be specified, it will cause no action to be taken for any exceptional
condition occurring during execution of this command.
Example:
EXEC CICS SEND
FROM(-----)
:
NOHANDLE
END-EXEC.
RESP Option:
Its function is similar to the return code in the batch program. If the RESP option is specified in a
command, CICS places a response code at a completion of the command. The application
program can check this code, then proceed to the next processing.
EXEC CICS SEND
FROM(---)
:
RESP(WS-RCODE)
END-EXEC.
IF WS-RCODE = DFHRESP(NORMAL)
GO TO NORMAL-RTN.
IF WS-RCODE = DFHRESP(LENGERR)
GO TO LENGERR-RTN.

4. Program Control:

FORMAT OF LINK and XCTL COMMANDS:


EXEC CICS LINK
PROGRAM (name)
COMMAREA (data-name)
LENGTH (data-value)
END-EXEC.
EXEC CICS XCTL
PROGRAM (name)
COMMAREA (data-name)
LENGTH (data-value)
END-EXEC.

EXAMPLE:
WORKING-STORAGE SECTION.
01 WS-COMMAREA.
05 WS-COM-FIELD1 PIC X(50).
05 WS-COM-FIELD1 PIC X(50).
.
.
EXEC CICS XCTL
PROGRAM (TESTPGM)
COMMAREA(WS-COMMAREA)
LENGTH(WS-CALEN)
END-EXEC.
At the completion of the XCTL command, control will be passed to the program TESTPGM with 100 bytes of data in
WS-COMMAAREA.

COMMAREA:
Data can be passed to a called program using the COMMAREA option of the LINK or
XCTL command in a calling program.
The called program may alter the data content of COMMAREA and the changes will be
available to the calling program after the RETURN command is issued in the called
program .
COMMAREA must be defined in the Working storage of the calling program and in
LINKAGE SECTION in called program.
Length must be specified in LENGTH parameter . EIBCALEN determines whether
COMMAREA was sent by the calling program. If is greater than 0, COMMAREA was
sent. This should always be checked.
EXAMPLE
WORKING-STORAGE SECTION.
:
LINKAGE SECTION
01 DFHCOMMAREA.
05 LK-FIELD1
PIC X(50).
05 LK-FIELD2
PIC X(50).
.

RETURN:
The RETURN command is used to return control to the next higher logical level, or CICS itself if
this is the highest logical level. The format of this command is as follows:
EXEC CICS RETURN
[TRANSID(name)]
[COMMAREA(data-area)]
[LENGTH(data-area) ]
END-EXEC.
Base Locator for Linkage (BLL):

Base Locator for Linkage is an addressing convention used to address storage outside
the working storage section of an application program.
o Advantages are
- Saves the size of the application program
- Improves the performance
The parameter list must be defined by means of 01 level data in the linkage section. This
is the first definition if DFHCOMMAREA doesnt exists.
The parameter list consists of a group of address pointers, each of which is defined as
full word binary filed ( S9(8) COMP ). The parameter list is followed by a group of 01
level data definitions.
The first address pointer of the parameter list is setup by CICS for addressing the
parameter itself.
Service Reload :
This is used to ensure the addressability to a particular area defined in the linkage section.
Applications of BLL:
1. CICS command with SET option
2. Accessing CICS system areas
ADDRESS register:
This is the improvement in VS COBOL II where in addressability can be achieved through
a special ADDRESS register. This doesnt need the construction of BLL cells.

Potrebbero piacerti anche