Cics Refresher
Cics Refresher
Cics Refresher
CICS
Mainframe Refresher Part-1 Page:2
History
IBM launched the initial version of CICS in 1968.
It is a Database/Data Communication Control System where an application program
can concentrate on the application processing without worrying about OS, hardware
and others. Initially CICS was on macro level and later upgraded to command level.
Reentrant program is defined as a program that does not modify itself so that
it can reenter to itself and continue processing after an interruption by the SVC call
of OS. Batch programs are non-reentrant. Reentrancy under CICS environment is
called quasi entrant as the interruption in CICS may involve more than one SVC calls
or no SVC at all.
Control Function
Table
PCT The transactions and the main program associates with the
transaction should be registered in Program table. Task control
Program (KCP) refers PCT.
PPT All the CICS programs and Maps have to be registered in Processing
Program Table. Program Control Program (PCP) refers PPT.
FCT All the VSAM files used in the CICS programs has to be registered in
File Control Table. File Control Program (FCP) refers FCT.
DCT Transient data queues should be predefined in Destination Control
Table. Transient Data Program refers DCT.
TST If you want to recover Temporary storage queues during system
crash, then they should be registered in Temporary Storage Table.
RCT If any DB2 commands are used in the program, then the PLAN should
be registered here.
SNT User ID and Password should be registered in Sign-On-Table.
TCT All the terminals should be registered in Terminal Control Table.
PLT All the programs that need to be automatically started during CICS
start up and Shut down should be listed in Program List Table.
JCT Control information of system logs and journal files is stored in Journal
Control Table. Journal Control Program refers to JCT.
If your Program has DB2 commands then the sequence of preparing load
module would be DB2 Pre-compiler, CICS Translator, COBOL Compiler and Link
editor. Logically speaking the order of DB2 precompiler and CICS translator can be
reversed also. But as a convention we are first doing precompilation.
VS COBOL 2 allows STOP RUN and that returns control back to CICS.
MAP DESIGN
Before get into program design, let us see how maps (screens) are designed
in CICS. Most of the installations use tools like SDF for screen designing. The tools
generate BMS macros for the designed screen. We brief the BMS macros involved in
the map design. BMS is acronym for Basic Mapping Support.
Symbolic maps define the map fields used to store the VARIABLE data
referenced in COBOL program. They are also coded used BMS Macros. But after
assembling, they are placed in a COPY library and then copied into CICS programs
using COPY statement. They ensure device and format independence to the
application programs.
Since BMS map definitions are purely assembler macros, the following coding
convention must me maintained.
1 10 16 72
(1-8) Label (10-15) Macro name (16-71) Operands 72-Continuation.
DFHMSD
It is used to define a mapset with its characteristic and to end a mapset. So
you will find two DFHMSD in any BMS coding. The important operands are below:
TYPE.
It should be DSECT for Symbolic map generation, MAP for physical map
generation and FINAL to indicate the end of mapset. Alternatively symbolic
parameter &SYSPARM can be coded in the TYPE of defining DFHMSD and the value
can be overridden in the PARM parameter of assembly procedure. This avoids the
change in the BMS coding.
MODE.
IN for input maps like order entry screens and OUT for output maps like
display screens and INOUT for input-output maps like update screens.
LANG.
It specifies the language in which the symbolic map is to be generated. It can
be COBOL, PLI, ASM or RPG.
STORAGE.
AUTO is used to acquire separate symbolic map area for each mapset.
BASE=MAP-IOAREA allows multiple maps from more than one mapset to share
same storage area. MAP-IOAREA will be redefined multiple times to achieve it.
TIOAPFX.
It should be ‘YES’ to reserve the prefix space of 12 bytes for BMS commands
to access TIOA properly. This is required for command level CICS.
CTRL.
Device control requests are placed here. Multiple parameters are separated
by comma. FREEKB is used to unlock the keyboard. FRSET is used to reset the MDT
of all the fields in all the maps to zero. ALARM is used to set an alarm at screen
display time. PRINT is used to send the mapset to printer.
TERM.
If anything other than 3270 terminal is used for display of screens, then it
should be coded here. This ensures device independence by means of providing the
suffix. SUFFIX is used to specify suffix for the terminal and it should correspond to
TCT entry of the terminal.
DFHMDI
It is used to define a map with its characteristic in a mapset. There can be
any number of DFHMDI. Some of the important operands of DFHMDI are below:
SIZE. It has two arguments namely length and breadth and as a whole the
size of the map is specified here.
LINE. The map starting line is mentioned here.
Mainframe Refresher Part-1 Page:6
DFHMDF
It is used to define a field with its characteristic in a map. There can be any
number of DFHMDF within DFHMDI. Some of the important operands of DFHMDF are
below:
POS.
It has two arguments that decided the position of the field. The two
arguments are line and column. It is the position where the attribute byte of the field
starts.
LENGTH.
The length of the field is coded here. It excludes the attribute character.
ATTRIB.
All the input and output fields are prefixed by one byte attribute field that defines
the attributes of the field. Some of the attributes are:
1. ASKIP/PROT/UNPROT Mutually exclusive parameters that define the
type of the field. UNPROT is coded for input and input-output fields. PROT is
coded for output and stopper fields. ASKIP is coded for screen literals and
skipper fields. The cursor automatically skipped to next field and so you
cannot enter data into skipper field.
2. NUM. 0-9,Period and – are the only allowed characters.
3. BRT/NORM/DRK Mutually exclusive parameters that define the
intensity of the field.
4. IC Insert Cursor. Cursor will be positioned on
display of map. If IC is specified in more than one field of a map, the cursor
will be placed in the last field.
5. FSET Independent of whether the field is modified or
not, it will be passed to the program. MDT is set for the field.
JUSTIFY.
RIGHT is the default value. Code LEFT for numeric fields.
INITIAL.
The default value of the field is coded here. When the MAP is sent, this value
will appear in the field. The constant information like TITLE is coded using INITIAL
keyword of field definition. To avoid data traffic, these constant information fields
should not be coded without LABEL parameter. If there is no LABEL parameter, then
symbolic map will not generated for those fields as they are unnamed fields.
Mainframe Refresher Part-1 Page:7
01 EMPDETI.
02 FILLER PIC X(12) TIOAPFX = YES creates this 12 byte filler.
02 EMPNAMEL PIC S9(04) COMP. Length Field
02 EMPNAMEF PIC X. Flag byte
02 FILLER REDEFINES EMPNAMEF.
03 EMPNAMEA PIC X. Attribute byte
02 EMPNAMEI PIC X(20). Actual field (Input)
Other fields….
01 EMPDETOO REDEFINES EMPDETI.
02 FILLER PIC X(12) TIOAPFX = YES creates this 12 byte filler.
02 FILLER PIC X(03)
02 EMPNAMEO PIC X(20). Actual field (Output)
Other fields…
So four fields are generated for every named field in the BMS.
Fieldname+L
It has length of the field entered by the user during the input operation.
Fieldname+I
It is the actual input field that carries the entered information. The value of
this field is X’00’ if no data is entered. The space corresponds to X’40’.
Fieldname+A
It is attribute byte. It defines the attributes of the field.
Fieldname+F
It is a flag byte. It has X’00’ by default. It will be set to X’80’ if the user
modifies the field but no data is sent. That is when the user pressed clear key over
the field.
Fieldname+O
This field should be populated in the program before sending the screen to
display.
Please note that the words INPUT (RECEIVE) and OUTPUT (SEND) are with respect to
program.
1. When the user modifies the field, the MDT of the field is automatically set
to ON.
2. CTRL=FRSET of DFHMSD or DFHMDI will RESET the MDT to ‘OFF’ for all
the fields in the mapset or map. FSET keyword of the attribute operand
definition of DFHMDF will set the MDT to ‘ON ‘. It overrides the FRSET
definition for the specific field.
3. Before sending the screen, by overriding the MDT bit of attribute byte of
field the MDT can be set to ‘ON’.
If you are specific on the values of some fields independent of whether the
user has modified or not, code them with FSET. One good example is default values
for the input fields (like Order received date). If the user finds default value (current
date) in the screen and it is fine with his requirement, then he won’t touch the field
and MDT will not be set. The program cannot receive the field as MDT is OFF.
But actually the program needs this field. So this field should have been defined with
FSET.
CURSOR Positioning
Positioning of cursor is an important area in screen design. By default, the
cursor will be placed in the first unprotected field.
Static Positioning.
If IC is coded in the attribute operand of DFHMDF macro, then the cursor will
be placed in that field. If IC is coded in more than one field, then last field with IC
will get the cursor.
Symbolic Positioning.
Move –1 to length of the field where you want place the cursor and send the
map with CURSOR option. This is device independent method and recommended to
control the cursor position dynamically.
Relative Positioning.
Send the map with CURSOR(value) option. This will set the cursor at the
position coded by ‘value’, relative to the first column of the screen. This is device
dependant method of dynamic cursor positioning and not recommended. When there
is change in screen layout, the program needs to be modified.
CURSOR(30) will place the cursor in the 30 th column. (First line first column is
ZERO).
Mainframe Refresher Part-1 Page:9
Cursor Position.
EIBPOSN of DFHEIBLK contains the offset of cursor position in the screen
when the data was transferred to program from the terminal.(relative to zero). It is
half word binary field.
RECEIVE MAP.
It is used to receive the information entered by the user into program. If
INTO is not coded, then CICS automatically finds the symbolic map area
(mapname+I) and places the mapped data. The values of the field can be read in the
program by referring to fieldname+I.
EXEC CICS RECEIVE MAP(map-name) MAPSET(mapset-name) END-EXEC.
The option TERMINAL ASIS overrides the upper-case translation specified in
the TCT. As we already discussed, if the user didn’t modify any of the fields then
MDT will be ‘OFF’ for all the fields. Zero bytes transmission results MAPFAIL
exception error.
SEND MAP.
This is used to send a map to a terminal. Before issuing this command, the
application program should prepare the data in the symbolic map area. If FROM is
not coded, then CICS automatically finds the symbolic map area (mapname+O) and
takes the data to the terminal.
EXEC CICS SEND MAP(map-name) MAPSET(mapset-name) END-EXEC.
Other Options in SEND MAP are:
Mainframe Refresher Part-1 Page:10
ERASE. Erases the screen before displaying the MAP. When you first time
throw the screen, it should be specified with ERASE. It will not be coded when you
just want to display the error messages over the current screen. ERASEUP erases
only the unprotected fields of the screen before displaying the MAP.
DATAONLY. Only symbolic map data is sent to the terminal.
MAPONLY. Only physical map data is sent to the terminal. FROM cannot be
coded.
FREEKB, ALRAM and FRSET can be also coded and the meaning is already discussed.
TEXT Building- SEND-TEXT, ACCUM and PAGING
Text streams can be sent to the terminal without any pre-defined BMS maps.
This is called text building. Text streams can optionally have header and trailer.
01 TEXT-HEADER.
05 FILLER PIC S9(4) COMP VALUE 27. => Length of the text.
05 FILLER PIC X VALUE ‘&’. => Character identifying automatic
page number in the text.
SEND-CONTROL
When the MAP is sent, we can specify device control options like FREEKB
ALARM ERASE, along with SEND-MAP. If one wants to issue the device control
options before sending the map, SEND CONTROL will be useful. It is used to
establish the device control options dynamically.
Syntax:
EXEC CICS SEND CONTROL
[CURSOR(data-value)] [ERASE | ERASEUP] [FREEKB] [ALARM] [FRSET]
END-EXEC
Message Routing
A message can be routed to one or more terminals other than the direct
terminal with which the program has been communicating. The message eligible for
message routing is, a message constructed by the SEND MAP command with the
ACCUM option.
ROUTE command establishes the message routing environment and the SEND
PAGE command issued after ROUTE command sends the message to the destination.
Syntax:
EXEC CICS ROUTE [LIST(data-area)], [OPCLASS(data-area)],
[INTERVAL(hhmmss)|TIME(hhmmss)],
[TITLE(data-area)], [ERRTERM(name)]
END-EXEC.
LIST and OPCLASS name the route list and operator class codes respectively.
INTERVAL / TIME determines the actual timing of message delivery in the time
interval or the time respectively.
TITLE names the title field defined in the working storage section and
ERRTERM specify the terminal ID where the error message (if any) to be sent.
Route list is prepared in working storage using the following convention.
Mainframe Refresher Part-1 Page:12
TTTTrrOOOsrrrrrr – 8 bytes named ‘r’ are declared as spaces. TTTT names the
terminal identifier as in TCT and OOO specify the operator id as in SNT. s is status
flag. Code as many 16 bytes fields as the destinations and indicate end of route list
is with the declaration of half word binary field with –1 value.
The message can be routed to every terminal at which users of the specified
operator class is signed on. This is done using OPCLASS.
Program Design
5.If there is no task is associated with the terminal, then TCP gives the
control to task Control Program, which realizes the transaction identifier in the data
in TIOA. (KCP)
6.SCP acquires the storage area for task control area (TCA) in which KCP
prepares the control data for this task.
7.KCP refer PCT to identify the program associated with the transaction.
8.Program Control Program (PCP) loads the program into main memory from
the load library and gives the control back to KCP.
9.KCP gives the control to application program loaded into main memory.
10.Program started processing – Task is initiated.
Ways of Data Passing between transactions.
1. By COMMAREA.
In the example below, Working Storage item WS-ITEM of length WS-LENGTH
is passed to the transaction EMPC. The program for the transaction ‘EMPC’ should
have DFHCOMMAREA of size WS-LENGTH in the linkage section to receive the
information passed by RETURN of this program.
EXEC CICS
RETURN TRANSID(‘EMPC’) COMMAREA(WS-ITEM) LENGTH(WS-LENGTH)
END-EXEC
WS-LENGTH is full word binary and the maximum length that can be specified
is 64K. So we can pass data of maximum size 64K. But it is recommended not to
pass more than 24K.
LINK and XCTL can also have use COMMAREA to pass the information to the
program being called and the concept is same.
2. Queues.
There are two types of queues TSQ and TDQ. TSQ can be used as scratch pad
in main memory. You can write as much as you want in TSQ and they will be
available to all the transactions that are aware of the queue name. TSQ is primarily
used to share huge amount of information across the transactions. Refer Queues
section for more details.
01 PARM-LIST.
05 FILLER PIC S9(08) COMP.
05 TCTUA-PTR PIC S9(08) COMP.
05 TWA-PTR PIC S9(08) COMP.
01 TCTUA-AREA.
05 TCTUA-INFORMATION PIC X(m).
01 TWA-AREA.
05 TWA-INFORMATION PIC X(n).
The mapping between the pointers and data area is done in linkage section as
follows.
First filler is points the current 01 level, which is PARM-LIST itself.
TCTUA-PTR points to next 01 level, which is TCTCA-PTR
TWS-PTR points to next 01 level, which is TWA-PTR.
This will store the pointer of TWA in TWA-PTR and TCTUA in TCTUA-PTR.
As the mapping between BLL cells and areas is already done in linkage section,
TCTUA-AREA can access m bytes of TCTUA, which exist outside your working storage
and similarly TWA-AREA to access n bytes of TWA, which exist outside your working
storage area.
Enhancement by VS COBOL2
ADDRESS OF operator of VS COBOL2 easies the access of external items.
The above requirement can be met in VS COBOL2 as follows. There is no need for
PARM-LIST or SERVICE RELOAD.
LINKAGE SECTION.
01 TCTUA-AREA.
05 TCTUA-INFORMATION PIC X(m).
01 TWA-AREA.
05 TWA-INFORMATION PIC X(n).
PROCEDURE DIVISION.
EXEC CICS ADDRESS TCTUA (ADDRESS OF TCTUA-AREA)
TWA(ADDRESS OF TWA-AREA)
END-EXEC.
ADDRESS OF maps the TCTUA-AREA with TCTUA exists outside your working
storage.
ASSIGN statement
It is used to access the system value outside of application program.
Some of them are length of common areas, user-id.
CWALENG, TCTUALENG, TWALENG – assign to full word binary working storage item.
Mainframe Refresher Part-1 Page:15
These commands are highly useful in macro level coding where the quasi-
reentrancy is the responsibility of the application programmer. Quasi-reentrancy is
Mainframe Refresher Part-1 Page:16
guaranteed in the CICS command level COBOL programs and so the need and usage
of these commands are almost obsolete.
CICS programs are usually run at various levels. The first program, which
gets the control from CICS, that is the program registered against the transaction in
PCT, runs at first level. Linked and Called programs are running one level lower than
linking or calling program and so the RETURN or GO BACK in these programs will
give the control back to Linking or calling program. XCTL programs run at the same
level and so the RETURN gives control to next upper level.
Ws-length is length of ws-area and ws-area has the information that needs to
be passed to LINK/XCTL program. VS COBOL 2 allows reentrant program and so
whatever is achieved using LINK or XCTL can be also achieved by COBOL CALL
statement. The called programs should be attached to the main program during link
edit and so the size of the load module will be large in this case.
If the program is expecting more changes, then calling program also need to
be compiled for every change in sub program. In case of LINK, the compilation of
linked programs is enough. Called CICS programs need not be registered in PPT
whereas LINK and XCTL programs should be.
Program PGM1 is loaded and the address of the program or table is mapped
to LK-ITEM and so the table can be accessed using the linkage are LK-ITEM. The size
Mainframe Refresher Part-1 Page:17
If you want to reset the diversion done by previous HANDLE condition, code
the condition name but don’t mention the paragraph name. Maximum 12 conditions
can be coded in one HANDLE CONDITION statement.
If you want to deactivate all the conditions for a particular CICS command,
code NOHANDLE. There are possibilities for infinite loop when the CICS command in
the exception routine of the HANDLE CONDITION ends with same exception. In the
above example, if the there is LENGERR in PARA-3 for any of the CICS command
coded there, then the control again come to PARA-3 and forms infinite loop. In such
cases, NOHANDLE will be useful (in the ABEND routine CICS commands).
IGNORE CONDITION.
The syntax is same as HANDLE CONDITION but it causes no action to be
taken if the specified condition occurs in the program. The control will be returned to
the next instruction following the command, which encountered the exceptional
condition. It will be effective from the place where it appears to the end of the
program or until any HANDLE condition overrides it.
Maximum 12 conditions can be coded in one IGNORE CONDITION statement.
RESP
Like the file status verification of batch COBOL program, SQLCODE
verification of DB2 program, the success or failure of CICS command can be done
using COBOL statements and this give more structured look for the program.
To achieve this, code RESP along with CICS command. CICS will place the
result into the variable coded in RESP. It can be checked against DFHRESP(NORMAL)
or DFHRESP(condition) and appropriately control the flow following the command.
HANDLE ABEND
HANDLE CONDITION command intercepts only abnormal conditions of the
CICS command execution whereas HANDLE ABEND takes care of any abnormal
termination within the program.
USER-ABEND
In batch COBOL, the user ABENDS can be thrown by calling the assembler
routine ILBOABN0 using AB-CODE whereas AB-CODE is working storage field of half
word binary.
The following command is used to throw user ABENDS in CICS.
EXEC CICS ABEND ABCODE(‘9999’)
END-EXEC is used to throw user ABEND 9999.
FILE-HANDLING.
CICS supports only VSAM and BDAM files. All the files, that you want to use in
your CICS application, should be registered in FCT with their complete attributes.
CICS commands refer the FCT entry name for doing operation on the file.
As all the files are already declared and defined in tables, coding File-Control
Paragraph of ENVIRONMENT division or FILE SECTION of DATA DIVISION is
meaningless and not required. Thus CICS frees the application program from any
data dependant coding.
The unit of IO during READ is one control interval. So even you read one
record into your program, the complete control interval is read into main memory
buffer. The size of control interval is preferred to be large for sequential processing
and small for random processing.
The file should be OPEN to issue an I-O command. The status of the file can
be queried using the master transaction CEMT. It can be OPENED, CLOSED,
ENABLED or DISABLED. This explicit opening or closing can be done using CEMT.
But this needs human intervention.
CICS Version 1.7 introduces automatic opening of the file if it is not in open
status during the access. It is always better to close it the when you no longer need
it. DFOC (Dynamic File Open Close) can be done in program using the SET command
or linking to DFHEMTP.
The file open command is written into WS-COMMAREA and its length is
populated in WS-LENGTH.
File Open Command: SET DATASET(FCT-NAME) OPENED
S1. Reads the file and if update is intended then code UPDATE clause. This will
get exclusive access over the complete control interval where the specific record
exists, during the READ. Thus CICS ensures data integrity.
S2. Read the file into working storage variable WS-ITEM. Alternatively, the
address of the record in the input-output area can be mapped to linkage section
variable by using SET command. Performance-wise SET is better than READ INTO.
VS COBOL2 supports ADDRESS of keyword and makes the code easier. In the prior
version COBOL, PARM list and SERVICE RELOAD should be used to achieve the same.
S3. After the READ, the LENGTH of the record READ is updated into WS-LENGTH.
WS-LENGTH is the working storage half word binary item.
S4. Key of the record to be read is moved into WS-KEY, a working storage item
and a part of record structure (WS-ITEM).
S5. If partial key is used, then the length of the partial key should be moved to
WS-KEY-LENGTH and the keyword GENERIC should be coded. This is optional for
full-key read.
S6. Remote system name where the request to be directed, is coded here. (1-4
character name)
S7. EQUAL is default. GTEQ can be coded when you know the full key, but you
are not sure the record with that key exists in the file.
REWRITE
LENGTH(WS-LENGTH)
SYSID(SYSTEM-NAME)
END-EXEC.
To release the exclusive access acquired during the READ with UPDATE, the
record should be REWRITTEN using the above syntax. The parameters are self-
explanatory.
After you read record, if you feel that you don’t want to update it, then inform
the same to CICS by issuing UNLOCK command so that CICS release the lock
acquired by you on the record.
EXEC CICS UNLOCK FILE(FCT-NAME) END-EXEC.
WRITE
DELETE
1.The record read using READ with UPDATE can be deleted using
EXEC CICS DELETE DATASET(FCT-NAME) END-EXEC.
2.The record in the file can directly be deleted by providing complete key.
EXEC CICS DELETE DATASET(FCT-NAME) RIDFLD(WS-KEY) END-EXEC.
3.Group of records can be deleted using partial key. After the deletion, the number
of records deleted is updated in the variable coded in NUMREC parameter. (WS-DEL-
COUNT)
EXEC CICS DELETE DATASET(FCT-NAME)
RIDFLD(WS-KEY)
KEYLEGNTH(WS-KEY-LENGTH) GENERIC
NUMREC(WS-DEL-COUNT)
END-EXEC
SEQUENTIAL READ:
Sequential access of VSAM file under CICS is called Browsing. It has FIVE
Commands associated with it.
STARTBR.
It establishes a position to start browsing.
first STARTBR can be coded with REQID(1) and the second STARTBR can be coded
with REQID(2).
One browse operation occupies one string of VSAM. If all VSAM strings are
exhausted for one VSAM file, then the other transactions will have to wait for one of
the strings to become free. So it is not recommended to use multiple browsing.
Instead, once the browsing is completed, using RESETBR set the position to another
place and start browsing. The syntax of RESETBR is same as STARTBR.
READNEXT is used to read the records in the forward direction from the
position established by STARTBR. READPREV is used to read the records in the
reverse direction. READPREV followed by READNEXT retrieves the same record once
again.
During the browse, if you want to skip set of records, then move the key of
the next record you intended to read to RIDFLD and then issue READNEXT. This is
called skip sequential read. Thus RIDFLD can be used as both input as well as output
field.
As VSAM files are variable length in most of the cases, WS-LENGTH should be
populated with maximum record length before issuing READ command.
KEYLENGTH(0) will position the cursor at the beginning of the file.
If you specify READPREV immediately after STARTBR, then you should code
key of a record that exists on the dataset. Otherwise NOTFND condition occurs on
READPREV.
ENDBR
It is used to terminate the current browse function.
EXEC CICS ENDBR FILE(FCT-NAME) REQID(INTEGER-VALUE) SYSID(SYSTEM-NAME)
END-EXEC.
ESDS-BROWSING
Define a full-word binary item in working storage for the RBA of ESDS file.
Move LOW-VALUES or HIGH-VALUES to the field for the forward or reverse read
respectively. Issue STARTBR with RBA and EQUAL option. RIDFLD should point to
Mainframe Refresher Part-1 Page:23
defined RBA field. Now issue READNEXT or READPREV for forward or REVERSE read
respectively.
GTEQ is invalid for ESDS.
ESDS-WRITE
The syntax is same as KSDS WRITE command. Qualify the WRITE with RBA
option. The record will be appended to the file and the RBA of the record is placed
into RBA field mentioned in the WRITE command. (ESDS-RBA)
ESDS-RANDOM ACCESS
If you know the RBA value of the record you want to access, then you can
randomly access the ESDS file. The syntax is same as READ of KSDS file but qualify
it with RBA option. RIDFLD should point to full-word binary item pre-filled with RBA
of the record to be accessed.
RRDS ACCESS
RRDS file can be accessed using RRN in place of RBA and populating the
RIDFLD with RRN number. The field should be full word binary.
ASKTIME
EIBDATE and EIBTIME have the values at task initiation time. Upon the
completion of ASKTIME, these two fields are populated with current date and time.
EXEC CICS ASKTIME END-EXEC.
FORMATTIME
FORMATTIME is used to receive the information of date and time in various formats.
EXEC CICS FORMATTIME FORMAT-TYPE(data-area) END-EXEC
Format-type: YYDDD, YYMMDD, YYDDMM, MMDDYY, DDMMYY, DAYOFWEEK,
DAYOFMONTH, MONTHOFYEAR, YEAR, TIME, TIMESEP, and
DATESEP.
Example:
EXEC CICS
FORMATTIME MMDDYY(WS-DATE) DATESEP TIME(WS-TIME) TIMESEP
END-EXEC
CANCEL
It is used to cancel the interval control commands such as DELAY, POST and
START which have been issued. The interval commands to be cancelled are identified
using REQID.
The data passed by START command is received by the new transaction using
RETRIEVE command upon the expiry of START command.
Records can be randomly accessed using ITEM option of READQ. READ is not
destructive.
Deletion of queue deletes all the records in it. Deletion of recoverable TSQ
should follow sync point before next WRITEQ.
READ is destructive and only sequential. Once the record is READ, it will be
logically deleted and cannot be read again.
Automatic Task Initiation: When number of records in the queue exceeds the
TRIGLEV defined in the DFHDCT entry of the queue, the transaction coded in
the TRANSID of DFHDCT is automatically triggered. This ATI is possible only
in TDQ.
There are two types of TDQ – Intra and Extra partition. The DCT entry
identifies the type of queue from TYPE parameter.
Intra Partition Queues are used within a CICS region and DELETEQ deletes
all the records physically in the queue.
Extra partition Queues are used across the regions and systems. If you want
to pass some data from CICS to batch or receive data from Batch to CICS,
Mainframe Refresher Part-1 Page:27
In the same program TDQ cannot be opened in both input and output mode.
TSQ are preferred over TDQ for data passing. TDQ is used for batch
interface or on ATI requirement.
MASTER TRANSACTIONS
CEMT:
This is Master Terminal transaction. It is menu driven and easy-to-use
transaction but due to its nature of manipulating the CICS environment, most of the
functions are restricted to application programmer or end user.
CEMT INQUIRE|SET|PERFORM
CEMT INQ TRAN|PRO|FILE – Display information from PCT|PPT|FCT
CEMT INW TASK – Display the active running tasks in the region
CEMT SET command can be used to reset the values of PCT|PPT|FCT.
PERFORM has to be handled carefully. CEMT PERFORM SHUTDOWN will shut down
the entire CICS region.
Frequently used commands:
CEMT SET PR(PGM-NAME) NEW - To create a new copy of an application program
CEMT SET DA(file-name) CLO/OPEN - To close/open a file from CICS.
CECI:
This is Command Interpreter transaction. CICS commands can be pre-tested
using this command before placing them into the program.
CEBR:
This is browse transaction. TSQ can be browsed using this transaction.
CEDF:
This is Diagnostic Facility transaction. If you want to debug your program step
by step, then before typing transaction ID type CEDF so that debug mode will be set.
Mainframe Refresher Part-1 Page:28
At the top of the ABEND dump, there is a dump header area, which provides
ABEND code, TASK (the transaction ID), Program Status Word (PSW) and the
contents of registers at the time of ABEND.
PSW.
It is a double word field containing the status information at the time of
ABEND. 32nd bit says the addressing mode in use. If the addressing mode is 31 bits,
then the bit will be ‘1’ and the bits 33 to 63 contains the next sequential instruction
(NSI), which would have been executed if the ABEND had not occurred.
First make sure that you have program compilation and link edited
SYSPRINTS of the program ABENDED and dump prints of the ABENDED transaction
is with you. Program should be compiled with LIST option.
2. From the program storage, identify the starting address of program storage.
3.Subtract the starting address of program storage from the NSI address identified in
the first step, you will get the displacement of the NSI from the beginning of
program storage.
4.Find the displacement of application program from the beginning of the load
module in the link edit list and subtract this value from the calculated NSI
displacement to get the real NSI displacement.
5.Find the statement in the compilation listing that corresponds to the OFFSET
calculated in the previous step. The statement one above is the statement that
caused the ABEND.
6.Analyse the statement for the cause of ABEND. This might have involved one or
more fields. Most of the times, you can easily come to conclusion the cause of the
Mainframe Refresher Part-1 Page:29
ABEND once you identified the statement. If you could not, then you may check the
value of the field at the time of ABEND as follows.
FCT
All the VSAM files, PATH between base cluster and alternate index and any
BDAM datasets are to be registered in FCT to access them in the application
program.
SERVREQ lists the authorized input/output operations against the file. If other
than the specified services is requested in the file control command, then INVREQ
condition will occur.
FILESTAT indicates the initial file status when CICS initially starts. BUFND and
BUFNI indicate the number of data buffers and index buffers respectively. Default
value is one for BUFNI and two for BUFND. STRNO is the number of VSAM strings by
which concurrent access to the file is allowed.
If the file being registered is path, then BASE indicates the FCT name of the
base cluster.
PPT
Mainframe Refresher Part-1 Page:30
All the CICS application programs and BMS map sets must be registered in
PPT. If the program is not registered here, then the program is unrecognizable to
CICS.
DFHPPT TYPE=ENTRY,
PROGRAM=name| MAPSET= name
[PGMLANG=(ASSEMBLER | COBOL | PLI)],
options..
ASSEMBLER is the default program language. All the map-sets are considered as
written in assembler.
PCT
The control information of all CICS transactions must be registered in
program control table (PCT).
DFHPCT TYPE=ENTRY,
TRANSID=name,
TASKREQ=xxxx, (PF1-PF24, PA1-PA3)
PROGRAM=name,
[DTIMOUT=mmss],
[RTIMOUT=mmss],
[RESTART= NO | YES],
[TRANSEC=1 | DECIMAL], (1-64)
[DUMP=YES|NO],
…Other options..
TCT
All the terminals, which are to be under CICS control, should be registered in
TCT. Terminal Control Program uses this table for identifying the terminals and
performs all input/output operations against these terminals.
DFHTCT TYPE=ENTRY,
ACCMETH=VTAM,
TRMIDNT=name,
TRMTYPE=type,
Mainframe Refresher Part-1 Page:31
FEATURE=(UCTRAN,..)
Options..
DCT
TDQ control information is registered here. Destination Control Program uses
this table for identifying all TDQs and performs input/output operations against
them.
ATI:
TRANSID and TRIGLEV are used for automatic task initiation. If the number of
records in TDQ exceeded the number of records mentioned against TRIGLEV, then
transaction ID mentioned against TRANSID will be invoked automatically.
Once a record of intra partition TDQ is read by a transaction, the record is logically
removed from, the queue. If REUSE = YES is coded, then the space occupied by it
can be used by other records in future but the logically deleted records are not
recoverable.
OPEN=INITIAL means the file will be open at the CICS start-up time and
DEFERED means the file will be closed until it is specifically opened by CEMT.
DSCNAME defines data control block and for one DSCNAME, a corresponding
DFHDCT entry must be made with TYPE=SDSCI and the same DSCNAME, which in
effect indicates DDNAME of extra partition dataset in JCL or CICS JOB itself.
TYPFILE indicates the file to be INPUT, OUTPUT or READ BACKWARD
(RDBACK)
NODE('*') specifies a destination node to send the JCL to. USERID is set to
the name of the internal reader INTRDR. A unique token will be allocated by CICS
when the SPOOLOPEN is executed and placed in the field you specify using
TOKEN(report_token). The token will be used as a sending field on subsequent
commands. The token will be 8 bytes long.
To write each line of the job to the spool use the SPOOLWRITE command.
EXEC CICS
SPOOLWRITE FROM(io_area) TOKEN(report_token)
RESP(resonse_field)
END-EXEC.
The "io_area" field should be the name of a data item containing the line of
JCL. The "report_token" field should be the same as the 8 byte token returned from
SPOOLOPEN. An end of job statement ('//' or '/*EOF') should be written as the last
line.
Finally you must close the spool using SPOOLCLOSE. (Note if you do not
explicitly close the spool it will be closed when the transaction terminates,
However it is good practice to close the spool explicitly)
EXEC CICS
SPOOLCLOSE TOKEN(report_token) RESP(response_field)
END-EXEC.
Again the "report_token" field must be the same as the one allocated at
SPOOLOPEN.
Notes:
The RESP option should be coded on all the Commands and it is
recommended that you also code RESP2, because additional information is
returned for some exception conditions in this field.
DCT entries and JCL DD statements are not needed when using this method.
Note that in order to use this method DFHSIT SPOOL=YES must be coded in
the CICS System Initialization Table. Check with your friendly local SysProg if
you are unsure.
Under OS/VS COBOL the SPOOLWRITE command had to have FLENGTH
specified. FLENGTH specifies the length of the data being written in a fullword
binary field. This field is optional in newer versions, if it is omitted then the
length is assumed to be the length of the data item (io-area) specified in
FROM.
Be aware of the performance considerations for writing to the spool, IBM says
"Transactions that process SYSOUT data sets larger than 1000 records, either for
INPUT or for OUTPUT, are likely to have a performance impact on the rest of CICS".
(Source: CICS/ESA V4R1 Application Programming Reference SC33-1170-00)