Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 21

Program Preparation

CICS Training Class -03

www.mainframes-online-training.weebly.com

Polsani Anil Kumar

Required Steps

Preparing a COBOL-CICS Program.

Write a program
Compile

Define the program in PPT table with in CICS


Define the transaction to the program in PCT table.
Execute the program with the Defined Transaction.

Concepts to be Known

Before we start writing a program one should be clear with

TASK and Transaction


Multitasking & Multithreading
Quasi- Reentrancy
Conversational Modes

Task & Transaction

Task: a basic unit of work which is scheduled by the operation


system / CICS

Sending a map / Receiving a map

Transaction : Is an entity which initiates execution of a task.


In CICS transaction is identified by the transaction identifier
known as TRANS-ID.

Trans-ID is a 4 character length alpha-numeric name but


should not start with character C which are actually used by
the system related transaction.

Multi-Tasking

When CICS receives a request to run a the program, CICS


starts running instance of requested program for that user.

Simultaneously if CICS receives another request to run the


same program/another program, CICS starts running instance
of that request program for that user also.

Like this CICS can able to handle thousands of requests, can


able to run multiple tasks simultaneously.

This capability of executing multiple tasks by a single system


is called multitasking

Multi-threading

Multithreading is sub-concept of multi-tasking.


Multithreading is a technique that almost a single copy of a
program to be processed by several transaction concurrently

For example: one transaction may begin to execute an application


program, while these happening another transaction may then
execute the same copy of the application program

Quasi- Reentrancy

The feature of storing the program data in a separate storage


area, when there is a interruption and restoring the same state is
known as Reentrancy but in CICS its called QuasiReentrancy process.

When CICS receives 1st request to a program, CICS starts


executing that program, at the same time, another request(2nd)
received by CICS, which is more priority, then CICS halts
processing of 1st request & preserve its state to separate storage
area and initialize the program. Once second request is over. It
initializes the program again & restores 1st request state to this
program and start executing the program.

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.

Pseudo-Conversational: A mode of dialog between program


and terminal which appears to the operator as a continues
conversation but which is actually carried by a series of tasks.

We can achieve the pseudo-Conversational with a variable


EIBCALEN which is defined with in DFHEIBLK Copybook

CICS Consideration & Restrictions

1.

Must eventually return control to CICS

Achieved by using RETURN Command

2.

Should not code ENVIRONMENT DIVISION

So no CONFIG OR INPUT-OUTPUT SECTION

3.

No FILE SECTION so no OPEN CLOSE READ OR other


COBOL file related verb instead we use CICS read & write
command

4.

ACCEPT DISPLAY STOP RUN and even GOBACK are


avoided. Stop run & GOBACK are sometimes included in
order to eliminate compiler diagnostic but never executed at
all.

Required Copy Books

To write a COBOL-CICS program we may be required few


of the below mentioned COPY BOOKS

1. SYMBOLIC Map
2. DFHEIBLK
3. DFHAID
4. DFHBMSCA

Symbolic Map

Symbolic map can be generated at the time of BMS map compiler or


manually

This copybook contains group item named MAPNAMEI is redefined


by a group item named MAPNAMEO. The fields in the MAPNAMEI
group item are intended for use with input operations, and the fields in
the MAPNAMEO group item are intended for use with output
operations.

The symbolic map contains a data field, a length field, an


attribute field, and a field that indicates if the value of the field
has changed. The names for these fields are created by adding
a onecharacter suffix to the label that was coded on the
DFHMDF macro in the mapset.

DFHEIBLK Copybook

EIB EXEC INTERFACE BLOCK contains some system related


information to each task as exec interface block

LIKE:

EIBAID

Attention-id (1 BYTE)

EIBCALEN

Length Of DFHCOMMAREA/COMMAREA
(S9(4)comp)

EIBDATE/EIBTIME Date & Time When The Task Started


EIBFN

Function Code Of The Last Command

EIBRCODE

Response Code Of Last Command

EIBTRNID

Transaction Id 1-4 Chars

EIBTRMID

Terminal-id 1-4 Chars

DFHAID Copy Book

AID is used to initiate the task from the terminal


All the AID keys are defined under DFHAID copybook
AID keys:

PF Keys PA Keys . Enter and clear keys

HANDLE AID can be used to handle when any AID key is


invoked instead we can use EIBAID of EIB to work in
application program

DFHBMSCA

IBM also supplies a standard copy member, named


DFHBMSCA, that defines many attribute settings.

You can change the colour, and protection attributes by


changing the A field. To do this you should copy the
DFHBMSCA copybook into working storage. This contains
definitions for attributes

e.g. DFHBMASK to set a field to SKIP. Then move the


required attribute to the 'A' field.

SEND Command
EXEC CICS
SEND MAP(MAP')
MAPSET(MAPSET')
FROM(INQMAP1O) [DATAONLY/MAPONLY]
CURSOR(VALUE)
[ALARM | FREEKB | ERASE | FRSET ]
HANDLE/NOHANDLE
RESP(WS-DATA-ITEM)
ENDEXEC.
Conditions : LENERR, INVREQ

RECEIVE Command
EXEC CICS RECEIVE
MAP(MAPNAME)
MAPSET(MAPSET NAME)
INTO(DATANAME)
LENGTH(MSG-LEN)
HANDLE/NOHANDLE
RESP()
END-EXEC.
Conditions : MAPFAIL, INVREQ

RETURN Command
EXEC CICS RETURN
TRANSID(NAME)
COMMAREA(DATA-VALUE)
LENGTH(DATA-VALUE)
END-EXEC.
Conditions : LENERR, INVREQ

COBOL + CICS Compilation

The COBOL + CICS undergoes three levels of processing to


generates the Load Module.

1. Translation process DFHECP


2. Compilation IGYCRCTL
3. Link-edited IEWL / HEWL

Translation Process

Now we have a source code with COBOL + CICS then a


normal compilation process cannot be good enough

Here we use a process know as TRANSLATION process to


remove the CICS command and replace with COBOL
understandable code like COMMENT and CALL

In this process a COPYBOOK DFHEIBLK will be included


with-in the linkage section of the application program

The modified code then further get processed and generates the
LOAD MODULE

Entries Required in CICS Environment

The application program and the related map has to be defined in the PPT
table and a transaction id to initiate the task in pct table.

PPT ENTRY
CEDA DEF MAPSET(MAPSET NAME) G(GROUP NAME)
CEDA INS MAPSET(MAPSET NAME) G(GROUP NAME)
CEDA DEF PROGRAM(PROGRAM NAME) G(GROUP NAME)
CEDA INS PROGRAM(PROGRAM NAME) G(GROUP NAME)

PCT ENTRY
CEDA DEF TRANS(TRAN-ID) PROGRAM(PROGRAM NAME)
G(GROUP NAME)
CEDA INS TRANS(TRN1) G(GROUP NAME)

To know all entry with in a group


CEDA DI G(GROUP NAME)

Thank You

Polsani Anil Kumar


www.mainframes-online-training.weebly.com

Polsani Anil Kumar

You might also like