Complete Tutorial On CICS.: Presents
Complete Tutorial On CICS.: Presents
com
Presents
INTRODUCTION TO CICS
Copyright: IBMMAINFRAMES.c 2
om
OBJECTIVES
Batch & Online systems
Why CICS?
CICS System components
CICS control program & tables
CICS startup and shutdown
Copyright: IBMMAINFRAMES.c 3
om
BATCH & ONLINE SYSTEM
Batch System Online System
Terminals
Batch System
DATABASE
REPORTS
MASTER FILE
ONLINE SYSTEM
DEFINITION :
ONLINE processing allows a user to interact with a computer and access its
resources via a terminal
Example : Railway Reservation system
Copyright: IBMMAINFRAMES.c 4
om
BATCH & ONLINE SYSTEM
BATCH ONLINE
Input Data from card tape, disk Data from terminal
Batched, sequential, random, concurrent
scheduled
Start of Operator (or operating Once CICS is initialized,
A job system) initiates the job. Other entering transaction id
jobs in the same region must triggers the transaction
wait. to start.
Processing Single task single thread. Multi task multi thread.
Mode Priority in job scheduling Priority processing.
Copyright: IBMMAINFRAMES.c 6
om
WHAT IS CICS?
Copyright: IBMMAINFRAMES.c 7
om
BATCH & ONLINE SYSTEM
Application Program
Other
Database Database Telecommunication
Access Method Access method Systems
Method (VSAM/ (VTAM,TCAM,
(DL/I, DB@) BDAM) BTAM)
Data
Storage
Terminals
CICS / MVS
Copyright: IBMMAINFRAMES.c 8
om
CICS SERVICES & THE
OPERATING SYSTEM
Copyright: IBMMAINFRAMES.c 9
om
CICS / VS CONTROL
TASK CONTROL
T
E
F
R
I
M TERMINAL
CICS TABLES
FILE
CONTROL CONTROL L
I
E
N
S
A
L PROGRAM CONTROL
PROGRAM LIBRARY
Copyright: IBMMAINFRAMES.c 10
om
CICS CONTROL PROGRAM
AND TABLES
CICS CONTROL PROGRAM
(IBM SUPPLIED)
FCP (FILE CONTROL PROGRAM)
JCP (JOURNAL CONTROL PROGRAM)
KCP (TASK CONTROL PROGRAM)
PCP (PROGRAM CONTROL PROGRAM)
SCP (STORAGE CONTROL PROGRAM)
TCP (TERMINAL CONTROL PROGRAM)
TDP (TRANSIENT DATA PROGRAM)
TSP (TEMPORARY STORAGE PROGRAM)
OTHERS
Copyright: IBMMAINFRAMES.c 11
om
CICS CONTROL PROGRAM
AND TABLES - Contd…
CICS CONTROL TABLES
(USER SPECIFIED)
FCT (FILE CONTROL TABLE)
JCT (JOURNAL CONTROL TABLE)
PCT (PROGRAM CONTROL TABLE)
PPT (PROCESSING PROGRAM TABLE)
TCT (TERMINAL CONTROL TABLE)
DCT (DESTINATION CONTROL TABLE)
TST (TEMPORARY STORAGE TABLE)
Copyright: IBMMAINFRAMES.c 12
om
CICS START UP
CICS is submitted as a batch job.
Copyright: IBMMAINFRAMES.c
om
14
ROLE OF CICS
MULTI TASKING
- More than one task can be executed concurrently.
MULTI THREADING
- Tasks share the same program under the multi tasking
environment.
RE-ENTRANT PROGRAM
- Program when does not modify itself in any way during
execution.
QUASI RE-ENTRANT
- Is a reentrant program under the CICS environment.
Copyright: IBMMAINFRAMES.c 15
om
Chapter - 2
Copyright: IBMMAINFRAMES.c 16
om
INTRODUCTION TO BMS
Copyright: IBMMAINFRAMES.c 17
om
PHYSICAL AND SYMBOLIC MAP
Physical Map
- Primarily used by CICS
- Ensures device independence in the application program
- For input operations, it defines the maximal data length and starting position
of each field to be read and allows BMS to interpret an input data stream
- For output operations it defines starting position, length, field characteristics
- (Attribute Bytes) and default data for each field, and allows BMS to construct
an output data stream.
Copyright: IBMMAINFRAMES.c 18
om
PHYSICAL MAP GENERATION
BMS MACRO
ASSEMBLY LINK EDIT
CODING
LOAD TO BE USED
LOAD LIB
MODULE BY CICS
Copyright: IBMMAINFRAMES.c 19
om
SYMBOLIC MAP
Ensures the device and format independence
to the application programs
A layout change in the formatted screen can
be done independent of the application program
coding as long as field name and length remain the
same
Symbolic map is included in the program by issuing
a COBOL COPY statement
Copyright: IBMMAINFRAMES.c 20
om
USING MAPS IN A PROGRAM
PROGRAM
SOURCE
TRANSLATOR
SYMBOLIC
COMPILER
MAP
LINK EDIT
Program
load module
Physical
map
Copyright: IBMMAINFRAMES.c 21
om
SYMBOLIC MAP GENERATION
BMS
SYMBOLIC MAP
ASSEMBLY
DEFINITION
MACRO CODING
Copyright: IBMMAINFRAMES.c 22
om
SYMBOLIC MAP SUFFIXES
“L”
Halfward binary
Contain the length of data entered by the terminal
operator
“F”
One byte flag field
“I”
Contains the data entered by the operator
“A”
One byte field that contains Attribute byte
“O”
Contains data to be sent to terminal
Copyright: IBMMAINFRAMES.c 23
om
SYMBOLIC MAP FORMAT -
Contd…
A 12 byte TIOA prefix is automatically provided.
Copyright: IBMMAINFRAMES.c 24
om
OUTPUT MAPPING
“MAP ONLY”
EXEC CICS SEND
MAP (“mapname1’)
MAPSET (‘mapset1’)
MAPONLY
END-EXEC
“DATA ONLY”
EXEC CICS SEND
MAP (‘mapname1’)
MAPSET (‘mapset1’)
DATA ONLY.
END-EXEC.
Copyright: IBMMAINFRAMES.c 25
om
OUTPUT MAPPING
MAP ONLY option.
- Use the physical map only.
- Field headings, attribute bytes, and the location of
where all information is to be placed is sent.
DATA ONLY
- Use the symbolic map only
- only the data in the symbolic map is sent to the
screen.
Copyright: IBMMAINFRAMES.c 26
om
OUTPUT MAPPING -
Contd…
Neither “ MAPONLY NOR DATAONLY
EXEC CICS SEND
MAP (‘map-name1’)
MAPSET (‘mapset1’)
END-EXEC
- The physical map and the data from symbolic
map is sent to the terminal.
Copyright: IBMMAINFRAMES.c 27
om
OUTPUT MAPPING -
Contd…
Other options of SEND command.
ERASE: Current screen is erased before the map
specified appears on the screen
ERASEAUP: erase all the unprotected fields.
FREEKB: to free the keyboard
ALARM: to make an alarms sound.
FRSET: to reset MDT to zero
CURSOR: to place the cursor in a specified field.
Copyright: IBMMAINFRAMES.c 28
om
CURSOR POSITIONING
Static positioning
If IC option is specified in the ATTRB field of DFHMDF
Copyright: IBMMAINFRAMES.c 29
om
CURSOR POSITIONING
Contd…
E.g.. EXEC CICS SEND
MAP (…..)
MAPSET (…..)
CURSOR (100)
ERASE
END-EXEC.
MAPFAIL condition will caused in RECEIVE MAP command.
- If the data to be mapped has a length of zero.
- If the operator presses any key (clear, PA, PF, ENTER,
Keys) without entering any data.
Copyright: IBMMAINFRAMES.c 30
om
ACCESSING AND
DISPLAYING MAP
FIELDS
Copyright: IBMMAINFRAMES.c 31
om
MAP STORAGE AREAS
Placing maps in the Program
Any of the three plans for redefinition of maps may be
used with either of the 2 alternatives for placing maps
in your program.
WORKING - STORAGE SECTION
Copying a symbolic description map structure here
makes the area automatically available whenever the
program is invoked.
LINKAGE SECTION
Copying a symbolic description map structure here
does NOT mean the storage will be available. Some
methods for providing storage are passing a
COMMAREA, acquiring temporary storage with the
SET option, or using a GET MAIN command.
Copyright: IBMMAINFRAMES.c 32
om
SEND / RECEIVE
Sending from the Symbolic description map
SEND MAP (`MAP1')
MAPSET(`SET1')
MOVE `MAP1' TO MAPVAR
MOVE `SET1' TO SETVAR
SEND MAP (MAPVAR)
MAPSET(SETVAR)
FROM (MAP1O)
SEND MAP Coding Alternatives
You can code the SEND MAP command to locate the
symbolic description map in several ways:
Using constants in the name field for MAP and
MAPSET(FROM is not required)
Copyright: IBMMAINFRAMES.c 33
om
SYMBOLIC MAPNAME IS
SEND / RECEIVE - Contd…
Using variables in the name field for MAP and MAPSET
(This makes FROM a required parameter)
Using only the MAP parameter. In this case the name in
the MAP option must be the MAPSET name.
Copyright: IBMMAINFRAMES.c 34
om
SEND / RECEIVE - Contd…
RECEIVING into the symbolic description map
RECEIVE MAP(`MAP1')
MAPSET(`SET1') ... MAP1 I
Move `MAP1' to MAPVAR
Move `SET1' to SETVAR ..... MAP1 I
RECEIVE MAP (MAPVAR)
MAPSET(SETVAR)
INTO (MAP1 I)
Receive MAP (`SET1') ... SET1 I
RECEIVE MAP coding alternatives
You can code the RECEIVE MAP command to locate the symbolic description map in several ways:
Copyright: IBMMAINFRAMES.c 35
om
SYMBOLIC MAPNAME IS
SEND / RECEIVE - Contd…
Using constants in the name field for map and mapset
(INTO/SET is not required) This is the most commonly
used format.
Using variables in the name field for MAP and MAPSET.
This makes INTO (database) or SET a required
parameter.
Using only the MAP parameter. In this case the name in
the MAP option must be the MAPSET name.
Copyright: IBMMAINFRAMES.c 36
om
SEND / RECEIVE - Contd…
Linkage Section.
01 DFHCOMMAREA
01 LST
02 PTR-2-LIST PIC S 9(8) COMP.
02 PTR-2-BMS PIC S 9(8) COMP.
RECEIVE MAP (`MAP1') MAPSET
(`SET1')
SET (PTR-2-BMS) ..... MAP1 I
Using the SET option requests CICS to get the storage and return a
pointer to it. The symbolic description map must be in the LINKAGE
SECTION.
Copyright: IBMMAINFRAMES.c 37
om
OUTBOUND FUNCTIONS
SEND MAP (`MAPA') MAPSET (`SETA')
[ERASE/ ERASEAUP] [FREEKB]
[ALARM] [FRSET] [PRINT]
ERASE-Erase Buffer, place cursor in upper left corner then write
or
ERASEAUP-Erase all the unprotected fields before the Write
FREEKB-Unlock Keyboard after the write
ALARM-Active alarm with the write
FRSET-Set all MDT currently on to off
PRINT-Start the 3270 print operation.
Copyright: IBMMAINFRAMES.c 38
om
OUTBOUND FUNCTIONS
Control Functions:
Typically the first type of command in the program is a SEND MAP. Certain
control functions may be included in that command.
ERASEAUP will clear out each field whose attribute is unprotected. It will
NOT alter any attribute settings.
If you do not free the keyboard using FREEKB, the operator will have to
press the RESET key before entering data.
If you code FRSET, all attribute bytes currently having Modified Data Tags
(MDT) set on will be set off. Selective resetting of the MDT's must be done
another way.
When sending data to a 3270 screen the actual printing from the buffer will
occur when the PRINT function is requested.
Copyright: IBMMAINFRAMES.c 39
om
OUTBOUND FUNCTIONS -
Contd…
Attributes :
The `A' suffixed field is an attribute field which controls the
following :
- PROTECTED/UNPROTECTED
- ASKIP
- NUM
- MDT
- Non Display (dark)DISPLAY (normal/bright)
If the color or highlighting of a field has to be changed,
additional symbolic fields are needed which are called the
EXTENDED ATTRIBUTES.
Copyright: IBMMAINFRAMES.c 40
om
EXTENDED ATTRIBUTES
DSATTS (for symbolic map) and MAPATTS (for
physical map) support the extended attribute
characteristics
The MAPATTS allows you to set up the physical
map with any of the characteristic(s) coded.
The DSATTS will create appropriate suffixed labels for the
attribute characteristic(s) coded.
To illustrate the result of coding these parameters,
the generated symbolic map follows.
Copyright: IBMMAINFRAMES.c 41
om
OUTBOUND FUNCTIONS
The generated symbolic map:
- COPY MAPSETA, PART I
WORKING-STORAGE SECTION.
COPY MAPSETTA.
01 MAP1I.
02 FILLER PIC x(12).
02 NAMEL COMP PIC 39(4).
02 NAME F PICTURE x.
02 FILLER REDEFINES NAMEF.
02 NAMEA PICTURE x.
02 FILLER PIC X(5)
02 NAMEI PIC X(20).
Copyright: IBMMAINFRAMES.c 42
om
OUTBOUND FUNCTIONS -
Contd…
COPY MAPSETA, PART2
01 MAP10 REDEFINES MAP1I.
02 FILLER PIC x(12).
02 FILLER PICTURE x(3).
02 NAMEC PICTURE x.
02 NAMEP PICTURE x.
02 NAMEH PICTURE x.
02 NAMEU PICTURE x.
02 NAMET PICTURE x.
02 NAMEO PIC x(20).
Copyright: IBMMAINFRAMES.c 43
om
INBOUND FUNCTIONS - AID
/ CURSOR CONTROL
Attention Identifier (ID) and Cursor:
On a RECEIVE, CICS updates the EIB with
the following information :
-The screen cursor position relative to
zero is placed is EIBCPOSN.
-The name of the input key the terminal
operator pressed is placed in the field
EIBAID.
Copyright: IBMMAINFRAMES.c 44
om
EIBAID/CURSOR
WORKING-STORAGE SECTION.
COPY DFHAID.
......
PROCEDURE DIVISION.
IF EIBAID = DFHPF12 THEN
......
IF EIBAID = DFHENTER THEN
......
IF EIBCPOSN LESS THAN 80 THEN
......
When you first enter your program as a result of a transaction id, you can test
EIBAID and/or EIBCPOSN. This may be done prior to issuing a RECEIVE
command, if so chosen.
Copyright: IBMMAINFRAMES.c 45
om
AID/CURSOR - SAMPLE
CODING (CONTROL)
If the operator uses any PA key or presses the CLEAR
key, no data is transmitted
EIBAID is useful when function keys are defined for
the user. for eg.
PF12 may be the exit function
PF3 may be an update function etc.
Thus testing for the type of AID will alter the logic flow.
EIBCPOSN can be used to determine where the cursor
was positioned on the screen. This information is
especially useful with screens containing an action bar.
Copyright: IBMMAINFRAMES.c 46
om
CURSLOC
Sample Map
MAPSETA DFHMSD TYPE=&SYSPARM,MODE=INOUT,
TERM=ALL,LANG=COBOL, TIOAPFX=YES,
STORAGE=AUTO
MAP1 DFHMDI SIZE=(24,80),LINE=1,COLUMN=1,
CURSLOC=YES
DFHMDF POS(2,1), LENGTH=4, INITIAL=`NAME',
ATTRIB=ASKIP
NAME DFHMDF POS(2,6),LENGTH=20,
ATTRB=(UNPROT, IC)
DFHMDF POS(2,27), LENGTH=1,
ATTRB=PROT
Copyright: IBMMAINFRAMES.c 47
om
CURSLOC - Contd…
Copyright: IBMMAINFRAMES.c 48
om
CURSLOC - Contd…
To be used to indicate the operator pressed the
erase to end of fixed (EOF) key by being set to
X'80'.
Therefore, if CURSLOC=YES it is possible to have
both these conditions occur for the same field, in
which case the `F' suffix field will contain a X'82'.
Copyright: IBMMAINFRAMES.c 49
om
EDITING
Map field Definition
PICIN/PICOUT
Built in function
De-edit command
- When data is sent out via the `O' suffix fields or
received into the `I' suffix fields you may want a
definition other than PIC x. PICIN AND PICOUT allows
the user to use other COBOL PICS such as $,Z etc.
- If the date contains special characters, you may want
to remove them using the BIF DEEDIT command.
Copyright: IBMMAINFRAMES.c 50
om
PIC IN/PIC OUT
- If PICIN/PICOUT is not coded in the macro, the pic
generated is always PIC X (length of field)
- By using PICIN/PICOUT BMS can be forced to
generate the appropriate PIC.
- PICIN tells BMS how to move data into the `I' suffix
field.
- PICOUT tells COBOL how to edit your data move to the
`O' suffix field.
Copyright: IBMMAINFRAMES.c 51
om
FIELD EDIT BUILT-IN
FUNCTION
Copyright: IBMMAINFRAMES.c 52
om
FIELD EDIT
- BIF DEEDIT is used to remove the special characters from the
input field.
The Amount field displayed has a dollar sign and a decimal
point
By using BIF DEEDIT dollar sign and decimal point is
removed. Thus the number can be used for arithmetic
operations.
COBOL compiler requires LENGTH specification:
VS COBOL-II uses the implied length of the data-area
used in the field parameter.
Copyright: IBMMAINFRAMES.c 53
om
CICS
PROGRAM
COMPONENTS
Copyright: IBMMAINFRAMES.c 54
om
OBJECTIVES
Structure of CICS Application Program
CICS Management Functions
Starting a Task
Conversational& Pseudoconversational
transactions
CICS Program preparation
CICS Program testing & Debugging
CICS commands
Passing Data across tasks
Copyright: IBMMAINFRAMES.c 55
om
STRUCTURE OF CICS
APPLICATION PROGRAM
Identification Division
Program - ID required
Other comments as below, are optional but recommended
- Author
- Date-Written
- Date-compiled
- Remarks
Environment Division
- Only header is required
Copyright: IBMMAINFRAMES.c 56
om
STRUCTURE OF CICS APPLICATION
PROGRAM - Contd…
COBOL statements and CICS commands should be
coded
The following COBOL statements are prohibited.
- ACCEPT, CURRENT-DATE, DATE, DAY,
DISPLAY, EXHIBIT, STOP RUN, TRACE
- Any I/O Statements
(OPEN, CLOSE, READ, WRITE, REWRITE,
DELETE, START)
- REPORT WRITER feature
- SORT feature
Copyright: IBMMAINFRAMES.c 57
om
STRUCTURE OF CICS
APPLICATION PROGRAM -
Contd…
CALL statement is allowed if the called
program does not issue any CICS commands
or inhibited COBOL statements mentioned
above.
Copyright: IBMMAINFRAMES.c 58
om
TERMINATION STATEMENTS
CALLER
CALL CALLED
CICS
GOBACK
SYSTEM
STOPRUN
GOBACK
EXIT
PROGRAM
STOPRUN
Notes :This is not the way to terminate a CICS program. CICS has a
command for that purpose. Nevertheless, COBOL and VS COBOL II
have three statements to conclude programs.
Control must not be allowed to pass beyond the last statement of a
CICS Program.
Copyright: IBMMAINFRAMES.c 59
om
TERMINATION
STATEMENTS Contd…
STOP RUN in COBOL uses operating system
facilities, and therefore, is discouraged.
EXIT program is ignored if the program has
not been called.
CICS RETURN COMMAND and/or GOBACK
statement is recommended.
Copyright: IBMMAINFRAMES.c 60
om
CICS MANAGEMENT FUNCTIONS
Task File
Program
Security
CICS
System
Recovery Services
Terminal Queue
. Copyright: IBMMAINFRAMES.c 61
om
DEFINITIONS
Transactions
An exchange between a terminal and a data
base representing an application process. For
example, an inquiry or a deposit and balance
update
Task
A specific instance of a transaction i.e. a unique
unit of work.
Program
Prepared statements compiled or assembled into
an executable module of machine instructions.
Copyright: IBMMAINFRAMES.c 62
om
CONVERSATIONAL
TRANSACTION
Program uses a pair of SEND and RECEIVE
commands.
Program waits until the user responds.
Resources are held until the user responds.
Very inefficient way of conversing with the user.
Copyright: IBMMAINFRAMES.c 63
om
PSEUDO CONVERSATIONAL
TRANSACTION
The task is terminated after a message is sent with
a linkage for the next task. CICS provides a facility
(COMMAREA) to made it easier to accomplish
this.
When the user completes response (by pressing
enter) reset task is automatically initiated by
CICS.
The task receives the message from the terminal
& processes it.
This is a multitask operation from system's point
of view.
Copyright: IBMMAINFRAMES.c 64
om
CONCURRENT EXECUTION
Copyright: IBMMAINFRAMES.c 65
om
PROGRAM PREPARATION
Source
DB2
Precompiler
CICS
Translator
COBOL
Compiler
Link
Edit
Load
Module
. Copyright: IBMMAINFRAMES.c 66
om
PROGRAM PREPARATION Contd…
Running the DB2 precompiler first is the preferred
method. DB2 precompiler precedes another process,
binding, not mentioned here.
Output of the DB2 precompiler can serve as input to the
translator.
Output of the translator will be input to the compiler.
Copyright: IBMMAINFRAMES.c 67
om
PROGRAM PREPARATION Contd…
TRANSLATOR
- The translator recognizes EXEC CICS and EXEC DLI
statements. They are commented out and replaced with
statements in the appropriate language. Here, COBOL
MOVE instructions and a CALL are inserted and passed on
to the COBOL compiler.
DB2 Precompiler
- The DB2 precompiler is supplied by the relational
data base managers, DB2 and SQL/DS. It recognizes EXEC
SQL statements which it will comment out and replace with
in our case. COBOL PERFORM and CALL statements.
Copyright: IBMMAINFRAMES.c 68
om
PROGRAM PREPARATION Contd…
Output of the transaction is i/p to the compiler
The o/p of the linkage editor is executable. The load
module is placed in the CICS online program library.
Messages or warnings are provided on all the listings. The
compiler listing is or limited use if the translator listing would
not process all commands.
Copyright: IBMMAINFRAMES.c 69
om
TESTING
New
Load Module
Old
Load Module
. Copyright: IBMMAINFRAMES.c 70
om
TESTING Contd…
CEMT set program (prg1) New comp
Or
CEMT S PR (prg1) N
After making changes to a program the new version replaces old
version, but CICS which is currently executing has no way of knowing this
automatically. The CICS processing program table PPT still points to the
old-version.
To avoid testing with the old version, you must use the CICS-
provided CEMT transaction to update the pointer to the program.
Copyright: IBMMAINFRAMES.c 71
om
COMMON FORMAT
END-
EXEC CICS SEND FROM (FLDA) LENGTH (5)
EXEC
Copyright: IBMMAINFRAMES.c 73
om
RECEIVE COMMAND
EXEC CICS RECEIVE
INTO (data area)
LENGTH(ml)
END-EXEC
- RECEIVE command is used to receive incoming data
from the terminal to which this CICS transaction is
associated.
- A receiving area must be defined in working storage
section and has to be specified in the INTO parameter.
- Length field must be defined in working storage section
as a S9(4) comp. It has to be specified in length option.
Copyright: IBMMAINFRAMES.c 74
om
SEND COMMAND
EXEC CICS SEND
FROM (data area)
LENGTH(ln)
END-EXEC
- The data to be sent must be stored in working storage
section, and this field name has to be specified in the
FROM parameter.
- Length must be specified the same as that of the
Receive command.
Copyright: IBMMAINFRAMES.c 75
om
EXCEPTIONAL CONDITIONS
RESP option
- Define a full word binary field S9(8) comp in the
working storage section as the response field.
- Place RESP option with the response field in any
CICS command.
- After command execution, check the response code in
the response field with DFHRESP (xxxx) where xxxx is
- NORMAL for normal completion
Or
- Any exceptional condition
Copyright: IBMMAINFRAMES.c 76
om
HANDLE CONDITION
Handle condition command is used to transfer
control to the procedure label specified if the
exceptional condition, specified occurs.
Remains active until the end of program or
another handle condition request overrides it.
Copyright: IBMMAINFRAMES.c 77
om
IGNORE CONDITION
Ignore condition command causes no action to
be taken if the condition specified occurs in the
programs.
Request by the IGNORE CONDITION
command is valid until the subsequent HANDLE
CONDITION command for the same condition.
Copyright: IBMMAINFRAMES.c 78
om
NO HANDLE OPTION
If NOHANDLE option is specified in any CICS
command, no action will be taken for any
exceptional condition occurring during
execution of this command.
Eg : EXEC CICS SEND
From (...)
Length (...)
NOHANDLE
END-EXEC
Copyright: IBMMAINFRAMES.c 79
om
FORMATTING TIME AND DATE
ASKTIME Command
- used to request the current date and time
- EIBDATE and EIBTIME fields have the values at the
task initiation time.
FORMAT
EXEC CICS ASKTIME END-EXEC
Copyright: IBMMAINFRAMES.c 80
om
FORMAT TIME COMMAND
- used to receive the information of data and time in various
formats.
- Format
[YYDDD (data - area)]
[YYMMDD (data - area)]
[YYDDMM (data - area)]
[MMDDYY (data - area)]
[DDMMYY (data - area)]
[DATESEP(data - value)]
[DAY OF WEEK (data - area)]
[DAY OF MONTH (data - area)]
[MONTH OF YEAR (data - area)]
[YEAR (data - area)]
[TIME (data - area)]
[TIMESEP (data - value)]
Copyright: IBMMAINFRAMES.c
om
81
FORMAT TIME COMMAND Contd…
Copyright: IBMMAINFRAMES.c 82
om
DELAY COMMAND
DELAY command
- used to delay the processing of a task for the specified
time interval or until the specified time.
FORMAT
EXEC CICS DELAY
INTERVAL (002000)
TIME (152000)
End - EXEC
- Task will be suspended for 20 minutes if INTERVAL is specified
or until 15:20:00 if TIME is specified.
Copyright: IBMMAINFRAMES.c 83
om
COMMAREA
Copyright: IBMMAINFRAMES.c 84
om
PSEUDO CONVERSATIONAL
PCT ENTRIES Program 1
TRN 1 Program 1 Send
Return
TRN2 Program 2 Transid TRN 2
Program 2
Receive
Send
Return
RETURN TRANSID will terminate the task and specify the next
transaction ID as TRN2
When the operator enters data, TRN2 will automatically start (a task will
be created) and the program program 2 will be invoked.
Copyright: IBMMAINFRAMES.c 85
om
PASSING DATA TO NEXT TASK
TRN1
Working Storage Copy
comstart comstart
TRN2
Program 1 Program 2
Procedure
Return Linkage
Transid ('TRN2') DFHcommarea
Commarea (Constant)
Copyright: IBMMAINFRAMES.c 87
om
PSEUDO CONVERSATIONAL
PCT ENTRIES Payroll
PAYR PAYROLL Send
Return
Transid (Payr)
Payroll
Receive
Send
Return
Notes :
This pseudo conversational design will invoke the same program for each
part of the conversation.
- The Return transid will terminate the task and specify the next transaction.
- When the operator enters data PAYR will automatically start (task will be
created) and the program PAYROLL will be invoked.
Copyright: IBMMAINFRAMES.c 88
om
PASSING DATA TO NEXT TASK
PAYR
Working Storage
comstart commarea
PAYR
Pay Roll PAYROLL
Procedure
Return Linkage
Transid ('PAYR') DFHcommarea
Commarea (Constant)
Notes :
The first time commarea is passed, it must begin as an area of storage in the
working storage section of the program passing it.
A commarea parameter in the RETURN will pass the area to the program
associated with the subsequent transaction. In this case, itself.
The subsequent program (in this case the same program) must define access to all
the commarea that was passed to it.
Copyright: IBMMAINFRAMES.c 89
om
PASS DATA TO NEXT TASK
- Contd…
PAYROLL as both the sender and the receiver of the
COMMAREA needs the working storage definition to
send and the linkage section DFHCOMMAREA to
receive.
PAYROLL must therefore be able to distinguish
between FIRST TIME into the program. When there is
no COMMAREA and subsequent times in. Where one
exists in the Linkage section. The EIB field, EIBCALEN
indicates the length of the commarea.
Copyright: IBMMAINFRAMES.c 90
om
EIBCALEN
First time into the program no commarea exists,
therefore EIBCALEN = 0
- While returning the control to CICS the working storage
is loaded and this is sent via the commarea
parameter
in the RETURN Transid.
- On subsequent entry, commarea exists and is
automatically made addressable by CICS in the linkage
section of DFHCOMMAREA
Copyright: IBMMAINFRAMES.c 91
om
PASSING DATA USING
LINK
To pass control from one program to another and
then return to the original like executing a
subroutine.
Copyright: IBMMAINFRAMES.c 92
om
PASSING DATA USING
LINK - Contd…
Data may be passed using the commarea.
The commarea is shared between the two program
regains control may changes made to the commarea by
the linked program are accessible.
The two programs executive under the same task.
The working storage section for the linking program is
retained. Working storage for the linked program is
automatically released after its RETURN command is
executed.
Copyright: IBMMAINFRAMES.c 93
om
PASSING DATA USING LINK
Working Storage
comstart
Program 1 Program 2
Linkage
Procedure
DFHCOMMAREA
Link
procedure
Commarea (Constant)
Return
Copyright: IBMMAINFRAMES.c 94
om
Copyright: IBMMAINFRAMES.c 95
om
OBJECTIVE
Functional overview
DIRECT RETRIEVAL
- VSAM DATA STRUCTURES
DIRECT RETRIEVAL
- RELATIONAL TABLE ROW
BROWSE
- VSAM DATA STRUCTURE
BROWSE
- RELATIONAL TABLE ROWS
Copyright: IBMMAINFRAMES.c 96
om
FUNCTIONAL OVERVIEW
RDB
CICS
FCT
CICS
Attachment
Facility
Data
FILEA
base
FCP PROGRAM
EXEC CICS
READ
EIP FILE C ('FILE')
EXEC SQL
Copyright: IBMMAINFRAMES.c 97
om
FUNCTIONAL OVERVIEW
contd…
Entry for VSAM file has to be there in FCT (File Control Table)
Each entry contains all descriptive information for the file it represents.
So, programmer need not define the physical organization and other
attributes of the files.
- The File parameter coded in the program must be the same as the file
name in the FCT.
- Interface between CICS and Relational Database is called CICS
attachment Facility. Statement are coded in SQL language in the
application program to Communicate data requests to the database.
Copyright: IBMMAINFRAMES.c 98
om
TOPICS
DIRECT RETRIEVAL
- VSAM FILE RECORD
- RELATIONAL TABLE ROW
BROWSE
- VSAM FILE RECORDS
- SET OF RELATIONAL TABLE WORKS
Copyright: IBMMAINFRAMES.c 99
om
VSAM DATA STRUCTURES
Key = 5
3 5 9
Sequential Keyed
Record 4
R1 R2 R3
Relative record
Linkage section
EIB
Procedure Division
File attributes are defined in the FCT for each file
Files are opened by CICS
- Immediately after system initialization if specified in the FCT.
- In response to a file access request from an application if the file is closed
- In response to a master terminal CEMT request from an operation.
Application program is not responsible for open / close of files
Copyright: IBMMAINFRAMES.c 101
om
RECORD IDENTIFICATION
RECORD KEY
RELATIVE BYTE ADDRESS
RELATIVE RECORD NUMBER
PARTIAL KEY
- key of the record to be read is specified in the RIDFLD.
for KSDS
- Key specified can be a full key or partial key
- If partial key, key length has to be provided
- RBA (Relative Byte Address)
- Can also be used instead of actual key value
For ESDS
- RIDFLD contain a 4 byte RBA
For RRDS
- RIDFLD contains 4 Byte binary relative record number.
- The data content of the record is moved into the specified data-
area defined in the working storage section.
F FORMAT
EXEC CICS READ
DATASET (name) | FILE (name)
INTO (data-area) | SET(ptr-ref)
RIDFLD (data-area)
[ LENGTH (data-values) ]
END - EXEC.
- DATASET / FILE names the file.
- It must be defined in FCT.
INTO names the field in the working storage section where the
data has to be placed.
- RIDFLD is the key field.
LENGTH is half word binary. It indicates maximum length of the
record to be read. It is optional.
Copyright: IBMMAINFRAMES.c 104
om
EXCEPTIONAL CONDITIONS
DUPKEY : If duplicate record is found for the specified key.
NOTFND : If the record is not found for the key
specified.
LENGER R LENGERR : The specified length (in LENGTH
OPTION) is shorter than the actual record length.
NOTOPEN NOTOPEN : When file specified is not open.
The exceptional condition can be trapped using RESP option in the
READ command.
RETRIEVE RECORD
READPREV READNEXT
CHANGE POSITION
RESETBR
END BROWSE ENDBR
Copyright: IBMMAINFRAMES.c 109
om
BROWSE
BROWSE
- VSAM FILE RECORDS
- Establish position
- Retrieve and process records
- Terminate browse
Link
Return
Notes :
To quit the repeated execution simply RETURN without
the TRANSID option.
Any linked program could use the same COMMAREA of
the parameters so indicated.
The transid & commarea option easy enough to use to
make this method practical.
CICS LINK
CICS XCTL
COBOL CALL
Alternative to XCTL or LINK COBOL CALL
COBOL CALL passes control to other programs.
Copyright: IBMMAINFRAMES.c
om
118
PASSING DATA USING INPUT MSG
MENU
WORKING STORAGE WORKING STORAGE
Move Move
.
.
MENU - IN IN-AREA
.
. INPUT MSG & INPUT LEN PARAMETERS USED WITH XCTL OR LINK.
Receiver uses EXEC CICS RECEIVE command
.
.
PROCEDURE
PROCEDURE
..
.
RECEIVE INTO (INAREA)
. XCTL (PROG BWS)
..
INPUT MSG (MENU-IN)
RETURN
INPUT LEN (11)
INPUT MSG & INPUT LEN PARAMETERS USED WITH XCTL OR LINK.
INPUT MSG & INPUT LEN PARAMETERS USED WITH XCTL OR LINK.
Receiver uses EXEC CICS RECEIVE command
COMMAREA(AREA1) EIBCALEN=100
LENGTH(100)
.
CONSTANT .
.
LINKAGE SECTION
PROCEDURE DFHCOMMAREA
PROCEDURE
. If data is to XCTL
be passed to the XCTLed program, a COMMAREA can be
used. DataCOMMAREA
area is to be located in the RETURN
Linkage Section of the receiving
program. (COMSTART)
COMMAREA used with RETURN, LINK & XCTL
.
They are
Transient data Queue (TDQ)
Temporary storage Queue (TSQ).
Copyright: IBMMAINFRAMES.c 124
om
TRANSIENT DATA QUEUE
They are identified by a 4 character ID called destination
ID
Destination ID and other characteristics of TDQ are
defined in the destination control table (DCT) by the
system programmer.
2 types of TDQ’s
- Intra Partition TDQ
- Extra Partition TDQ
Copyright: IBMMAINFRAMES.c
om
125
TRANSIENT DATA QUEUE -
Contd…
Intra Partition TDQ - Processed
only within the same CICS region
Extra Partition TDQ - Individual
Sequential Files processed between the
transaction of the CICS region and the
system outside of the cics region
Batch prog
(2) Interface from Batch
Batch Prog File TDQ
CICS Appl PROG.
Copyright: IBMMAINFRAMES.c 130
om
TRANSIENT DATA OUTPUT
EXEC CICS
WRITEQ TD
QUEUE (NAME)
FROM (DATA-AREA)
[LENGTH (DATA-VALUE)]
END-EXEC.
Common for both TDQ's
Transient data input
EXEC CICS
READQ TD QUEUE (NAME)
INTO (DATA-VALUE)
[LENGTH (DATA-VALUE)]
END-EXEC.
Common for both TDQ's.
Deletion of TD's
EXEC CICS DELETEQ TD
QUEUE (NAME)
END-EXEC.
Copyright: IBMMAINFRAMES.c 131
om
TRANSIENT DATA OUTPUT
TSP
AUXILIARY
TEMPORARY
STORAGE
EXEC CICS
READQ / WRITE Q TS RECORDS
TEPRSTOR VSAM (ESDS)
Copyright: IBMMAINFRAMES.c
om
135
WRITEQ TS
To write or re-write a record in TSQ
EXEC CICS WRITEQ TS
QUEUE (NAME)
LENGTH (DATA-VALUE)
[ITEM (DATA-AREA).
[REWRITE]
[MAIN | AUXILIARY]
END-EXEC.
ITEM - If this option is coded CICS write return the item number
assigned to the record just written.
REWRITE - is used to rewrite the record identified by ITEM.
Main / Auxiliary - To specify the storage medium. Will be stored in
main if auxiliary storage not supported.
Copyright: IBMMAINFRAMES.c 136
om
READQ TS
Can be used to read records either sequentially or directly.
Syntax
EXEC CICS READQ TS
QUEUE (NAME)
INTO (DATA - AREA)
LENGTH (DATA-VALUE)
[ITEM (DATA-VALUE) | NEXT]
[NUMREC (DATA-AREA)]
END-EXEC.
NEXT - to retrieve the next - logical record in the TSQ.
mutually exclusive to the item option
NUMREC - the data area is defined as PIC 9(4) comp. to
find the Total no. of records in the TSQ.
Item - for direct access specify the item no of the record.
Copyright: IBMMAINFRAMES.c 137
om
DELETEQ TS of TSQ
EXEC CICS
DELETEQ TS
QUEUE (NAME)
END-EXEC.
All records is TSQ are deleted.
All associated storage is released.
Copyright: IBMMAINFRAMES.c 138
om
EXCEPTIONAL CONDITIONS
HANDLE ABEND
Copyright: IBMMAINFRAMES.c
om
142
COMMAND LEVEL
INTERPRETER
For invoking CECI, type CECI with the CICS command to
be interpreted.
The first screen lists all the possible CICS commands.
Giving question mark (?) before the command requests a
syntax check only. No execution.
Ex. CECI SEND MAP (`SPOOMPO')
MAPSET (`SPOOMSO')
ERASE
Copyright: IBMMAINFRAMES.c
om
143
BROWSING CICS QUEUES
CEBR can be invoked while you are
already in the CEDF mode.
Press the PF5 key to display the working
storage section.
Then, press PF12 key to invoke CEBR.
CEBR allows to browse information in
Temporary Storage (TS) queues.
Help (PF1) give you a list of CEBR
commands on the screen.
TS queues are retained until purged.
Copyright: IBMMAINFRAMES.c 144
om
EXCEPTION HANDLING
CICS to respond to exceptional conditions in one of
three ways:
RESP option: -
The RESP option can be specified in any CICS
command. Its function is similar to the return code in
the batch program.
- Define a fullword binary field (S9(8)COMP) in the
working storage section as a response field.
- Place the RESP option with the response filed in a
command.
- After command execution, check the response
code in the response field with DFHRESP (xxxx), where
xxxx is the - NORMAL
- Any exceptional condition
Copyright: IBMMAINFRAMES.c 145
om
EXCEPTION HANDLING
Ex.: Working - Storage Section
77 WS-RESP PIC S9 (8) COMP
PROCEDURE DIVISION
EXEC CICS SEND
From (- - -)
Erase
Resp (WS-Resp)
End-Exec.
If WS-RESP = DFHRESP (NORMAL)
GO TO NORMAL - PARA
If WS-RESP = DFHRESP (LENGERR)
GO TO LENGERR - PARA
GOTO GENERAL - PARA
Copyright: IBMMAINFRAMES.c 146
om
EXCEPTION HANDLING
HANDLE CONDITION
This command is used to transfer control to the procedure label
specified if the exceptional condition specified occurs.
IGNORE CONDITION
This command causes no action to be taken if the condition specified
occurs in the program.
EXEC CICS HANDLE CONDITION
Condition (Label)
[Condition (Label)]
[Error (Label)]
END-EXEC.
or
EXEC CICS IGNORE CONDITION
Condition
[Condition]
END-EXEC.
Copyright: IBMMAINFRAMES.c 147
om
EXCEPTION HANDLING
INTRODUCTION - Contd…
ABEND CODE
If an exceptional condition occurs during
execution of a CICS application program
and if the program does not check the
exceptional condition, CICS may continue
executing the program or terminate
abnormally the execution of the program,
depending on the exceptional condition
and the command involved.
Copyright: IBMMAINFRAMES.c
om
148
LOGICAL LEVELS - Contd…
CICS-Maintained
Application Program
condition Table