Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
_______________________________________________________________________________
Table of Contents
1. INTRODUCTION TO CICS..........................................................................3
1.1. Objectives..........................................................................................................3
1.2. Application Systems ..........................................................................................3
1.3. Comparison of BATCH & ONLINE Systems..........................................................4
1.4. CICS Introduction................................................................................................4
4
1.5. CICS Terminolgy ................................................................................................4
1.6. Features of CICS................................................................................................6
1.7. CICS System Components..................................................................................8
1.8. CICS Control Programs And Tables ....................................................................8
1.9. Sign ON And Sign OFF......................................................................................11
2. CICS APPLICATION PROGRAMMING.......................................................12
2.1. Objectives........................................................................................................12
2.2. Structure Of a CICS Application Program.........................................................12
2.3. Termination Statements...................................................................................13
Commands for a Small Program..............................................................................13
2.5. Execption Conditions.......................................................................................17
..............................................................................................................19
2.6. Sample Program(s)..........................................................................................19
2.7. Program Preparation........................................................................................22
2.8. DB2 Precompiler...............................................................................................23
2.9. Translator.........................................................................................................23
2.10. CICS Transactions ..........................................................................................23
2.11. Exercise..........................................................................................................26
26
3. MAPS AND DISPLAYS.............................................................................27
3.1. Objectives........................................................................................................27
3.2. Introduction to BMS..........................................................................................27
3.3. Screen Layout Documentation.........................................................................28
3.4. Physical MAP ..................................................................................................28
3.5. Symbolic Map ..................................................................................................33
3.6. Sending a Map to the Screen..........................................................................36
3.7. Extended Attributes.........................................................................................37
3.8. Cursor Positioning ............................................................................................37
3.9. SEND CONTROL command ...............................................................................38
3.10. Common CICS Program Declarations.............................................................38
3.11. Receiving a Map from the Screen..................................................................39
3.12. Ending a CICS Transaction (RETURN Command)............................................42
3.13. Multipage message with Single Panel............................................................42
3.14. Pseudo Conversational Applications..............................................................45
3.15. Structure of a sample Application Program....................................................47
3.16. Exercise..........................................................................................................49
3.17. Passing control to other programs.................................................................50
4. FILE HANDLING ...................................................................................53
4.1. Introduction......................................................................................................53
53
4.2. VSAM Datasets.................................................................................................54
4.3. Exercise...........................................................................................................69
4.4. DB2 Database.................................................................................................71
4.5 PRECOMPILATION..............................................................................................81
_______________________________________________________________________________
CICS Training Material Revision 2.0
1
CICS Training Material
_______________________________________________________________________________
5. CICS QUEUEING FACILITIES...................................................................85
5.1. Objectives........................................................................................................85
5.2. CICS Queueing Facilities...................................................................................85
5.3. Transient DATA QUEUE (TDQ)..........................................................................85
5.4. Temporaty Storage Queue(TSQ)......................................................................89
APPENDIX..................................................................................................93
A. COMMON ABEND CODES.....................................................................................93
B. JCL ......................................................................................................................95
_______________________________________________________________________________
CICS Training Material Revision 2.0
2
CICS Training Material
_______________________________________________________________________________
1. INTRODUCTION TO CICS
1.1. Objectives
• Application Systems
• Batch & Online
• CICS Introduction
• CICS System Terminology and Concept
• CICS Control Programs & Tables
• CICS Sign on and Sign off process
Examples for Online Systems are: Railway Reservation System, Hotel Room Booking etc.
Examples for Batch Systems are: Monthly Reports like Payslips and other Statements.
_______________________________________________________________________________
CICS Training Material Revision 2.0
3
CICS Training Material
_______________________________________________________________________________
A basic unit of work, which is scheduled by Operating system is called Task. CICS
as a whole is one of many tasks under OS (Other tasks: TSO, Batch jobs etc.)
Similar to OS, CICS schedules a unit of work within CICS region. This is called a
CICS task which is a unit of work scheduled by CICS. Multiple terminals may invoke
the same task.
_______________________________________________________________________________
CICS Training Material Revision 2.0
4
CICS Training Material
_______________________________________________________________________________
1.5.2. Transaction
A CICS transaction can create more than one task concurrently if the same
transaction is initiated more than once .We can also say a transaction is an
exchange between a terminal and a database representing an application process.
For example, an enquiry, or a deposit and balance update. Using transaction
identifier, we can execute a task under CICS region.
1.5.3. Program
A task invoked by a terminal. The terminal, which invokes a task remains associated
with that task so that when the program sends data, it will go to the invoking
terminal, is called divert terminal.
CICS automatically provides some system related information to each task in the form of
EIB, which is unique to CICS command level.
CICS automatically updates certain fields of this block when a task is initiated and after
each command is executed. The application program can access these fields when
required.
♦ Program uses a pair of SEND (for sending messages to the terminal) and
RECEIVE (for receiving input from termincal) commands.
_______________________________________________________________________________
CICS Training Material Revision 2.0
5
CICS Training Material
_______________________________________________________________________________
• The non-conversation mode does not involve any conversation with the
terminal user. Usually the transaction in this mode is a one-way
transaction for output only.
• Mainly used for report printing or message switching.
• The task is terminated after a message is sent, with a linkage to the next task.
All resources associated with the task, including the storage, are released.
• When the user completes his/her response (by pressing ENTER or PF key),
the next task is automatically initiated by CICS.
• The task receives data from the terminal and processes it.
• This is a multitask operation from the system’s point of view. As the resources
are freed while waiting for user’s response, this is more efficient.
• Although the task ended the transaction is not complete. Before the first end it
must save necessary information for the second task. A task normally ends
when the first program issues the return command.
JCL is not required to run a CICS application program. . CICS itself is a job
executed through JCL like other batch jobs. Once the CICS job starts, this job is
considered as one CICS region, under which more than one application
transaction (or programs) can be executed concurrently.
1.5.10. MRO
Multi Region Operation is communication between a CICS system and other CICS
system in the same processor.
CICS provides services to the suspended task depending upon the command, and
it is then placed in the queue of waiting task according to its priority number.
_______________________________________________________________________________
CICS Training Material Revision 2.0
6
CICS Training Material
_______________________________________________________________________________
We can say Multithreading is a subset of multitasking since it concerns tasks,
which use the same program.
Several terminals requiring the same program will use only one copy of the
program thus saving main storage.
This feature is possible because multitasking allows each task requiring the same
program to use part of the same copy of the program when that task is active.
• REENTRANT - Program that does not modify itself in any way during
execution, so that it can continue processing after an interruption by the
Operating System (OS). The interruption is done by OS Supervisory calls
(SVC) in reentrancy program. It is called reenterable program or serially
reusable program. On-line program is an example for Reentrant program.
For example let us take three OS Tasks A, B & C. An OS task (A) which uses a
program has exclusive use of the CPU resource. At an interruption time (i.e., SVC)
in the program,the OS task (A) is suspended. OS saves the status of the OS task
(A) and executes other tasks B , C.When other OS taks reach a SVC while the
task A’s wait status becomes complete , OS restores the status of the task (A)
(i.e. ‘reenter’ to the program) and continues to execute until the next SVC.
This process makes it possible for tasks A B & C to run concurrently. If tasks A B
and C , data areas of the program will be destroyed unless the data area is to be
kept unique to each task.
Under CICS, a program interruption is done not at the Supervisory call (SVC) time
but at the time of CICS command. The CICS command is RETURN with
Transaction identifier (TRANSID). Reentrancy under the CICS environment called
‘quasi’ inorder to distinguigh this from the reentrant program, which is the term
under OS/multithreading environment. Pseudoconversation programs are an
example for quasi-reentrancy.
Note: A program can be specified as reentrant by coding the RENT option during
compilation
The essential role of CICS is to act as an interface between application programs and the
operating system as the DB/DC control system. CICS consists of five major system
components:
• Data Handling Functions – Provides an Interface between CICS and user data.
It can interface with data access methods such as VSAM and database access
methds such as DB2. It can maintain data integrity by control of simultaneous
record updates and also protection of data at abnormal termination of a task or
at system failures (OS or CICS)
CICS has a set of IBM-supplied Control Programs and corresponding CICS user-specified
control Tables, which form its core portion called the CICS nucleus. All user CICS
resources have to be defined in these tables. They are
a. Terminal Management:
• Comprises of TCP - Polls Terminals, Handles different communication protocols,
Logs data communication errors.
• Terminal Control Table (TCT) – Describes each terminal in the network by type,
priority and address.
• Terminal I/O Area (TIOA) - The initial 12 bytes filler in the symbolic map.
1. Holds messages from the terminal until working-storage for the application
program is defined.
2. Holds messages being sent to a terminal until the line is free for
transmission.
b. Program Management:
• Program Control Program (PCP) – Keeps track of which programs are in storage
and where they are located.
c. Storage Management:
• Storage management has only a storage control program (SCP) which aquires and
releases storage as necessary.
d. File Management:
_______________________________________________________________________________
CICS Training Material Revision 2.0
9
CICS Training Material
_______________________________________________________________________________
• File Control Program (FCP) interacts with system access methods to perform file I/O
requests.
• File Control Table (FCT) contrains information on files related to the following.
e. Task Management:
• Program Control Table (PCT) contains information about programs, related to the
following:
1. The transaction ID and its associated program.
2. Task priority and security.
• Task Control Area (TCA) contains pointers to storage areas and control areas for
programs and terminals.
a. Terminal Control.
TCP places the data from the terminal into TIOA and sets the pointer into the TCT
entry of the terminal. If there is no task associated with this terminal TCP passes
control to KCP which realizes the transaction identifier in TIOA.
b. Task control.
KCP creates a task for the transaction then checks whether the transaction identifier
is a valid entry in the Program Control Table (PCT)
If the trans-id is invalid an error message is sent to the terminal and the task is
terminated. Otherwise it requests the SCP to acquire storage for the Task Control
Area (TCA) in which KCP prepares control data for the task.
KCP assigns a priority to the task , then places it in the queue of waiting tasks.
_______________________________________________________________________________
CICS Training Material Revision 2.0
10
CICS Training Material
_______________________________________________________________________________
KCP through PCT tries to find the application program associated with the
transaction.
c. Program control
If PPT entry of the application program does not show the resident address of the
program, KCP passes control to PCP, which fetches the application program from
the load library and places it into the main storage. KCP passes control to the
application program. The application program starts its processing. This is how the
transaction is initiated.
Example:
Userid . . . . Groupid . . .
Password . . .
Language . . .
New Password . . .
_______________________________________________________________________________
CICS Training Material Revision 2.0
11
CICS Training Material
_______________________________________________________________________________
2.1. Objectives
IDENTIFICATION DIVISION
PROGRAM - ID. (required)
AUTHOR. }
A CICS command consists of a keyword phrase, the function, its options and the
arguments for options and a delimiter.
Example.
Be careful about periods. Avoid them after END-EXEC where you don’t really want them.
For eg, within an IF . . . THEN . . . ELSE statement, the translator places a period into the
generated code if a period follows END-EXEC. The period following END-EXEC terminates
the IF statement also.
_______________________________________________________________________________
CICS Training Material Revision 2.0
13
CICS Training Material
_______________________________________________________________________________
Eg. IF A = B
EXEC CICS
...........
END-EXEC
ELSE
MOVE ‘NO’ TO ANSWER
END-IF.
The above example, as given, will not give any error. However, if a period follows the END-
EXEC, the period terminates the IF statement also, and the program doesn’t recognize the
ELSE portion, generating a compilation error
EXEC CICS
RECEIVE INTO (DATA-AREA) LENGTH (DATA-AREA)
END-EXEC.
• RECEIVE command is used to receive into memory, 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 S9(4) COMP field. It
has to be specified in LENGTH option.
EXEC CICS
SEND FROM (data-area) LENGTH (data-area)
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 is optional
Eg.
MOVE "HELLO" TO VAR!
EXEC CICS SEND FROM (VAR1) END-EXEC.
_______________________________________________________________________________
CICS Training Material Revision 2.0
14
CICS Training Material
_______________________________________________________________________________
The SEND TEXT Command is used to send a single-stream text to a terminal. BMS
Maps are not required for SEND TEXT Command
Format
MULTITEXT OPERATION
• Use the SEND TEXT Command with the ACCUM Option for accumulating the
text block.
• Then Issue the SEND PAGE command to send the entire text
There are two fields in the EIB called EIBDATE and EIBTIME, which contain the
date and time values at task initiation time. There are different commands to
process this date and time.
EXEC CICS
ASKTIME ABSTIME (data-area)
END-EXEC.
• Used to format the date and time information in various formats, using the
ABSTIME value obtained with the ASKTIME command.
EXEC CICS FORMATTIME
_______________________________________________________________________________
CICS Training Material Revision 2.0
15
CICS Training Material
_______________________________________________________________________________
ABSTIME(data-area) (required)
[YYDDD(data-area)]
[YYMMDD(data-area)]
[YYDDMM(data-area]
[MMDDYY(data-area]
[DDMMYY(data-area]
[DATESEP(data-value)] (default is “/”)
[DAYOFWEEK(data-area)]
[DAYOFMONTH(data-area)
[MONTHOFYEAR(data-area]
[YEAR(data-area]
[TIME(data-area]
[TIMESEP(data-value)] (default is “:”)
END-EXEC.
• Used to delay the processing of a task for the specified time interval or until the
specified time.
_______________________________________________________________________________
CICS Training Material Revision 2.0
16
CICS Training Material
_______________________________________________________________________________
EXEC CICS
ASSIGN [CWALENG(data-area)]
[TCTUALENG(data-area)]
[TWALENG(data-area)]
[USERID(data-area)]
[ABCODE(data-area)]
END-EXEC
CWALENG : To access the length of Common Work Area(CWA)
TCTUALENG : To access the length of Terminal Control Table User Area(TCTUA)
TWALENG : To access the length of Transaction work area(TWA)
USERID : To access the User id
ABCODE : To access the abend code
Exception conditions are those that could occur during execution of a command. There are
different ways of handling these exception conditions.
• Define a fullword binary field S9(8) comp in working storage as the response
field.
• Code RESP option with the response field in any CICS command.
• After command execution, check the response code in the response field with
DFHRESP (xxxxxxx) where xxxxxxx is NORMAL for normal completion or
Any exceptional condition (depending upon the command)
Eg.
WORKING-STORAGE SECTION.
01 ws-resp PIC S9(8) COMP.
01 ws-send-unsuccessful PIC X(1).
PROCEDURE DIVISION.
EXEC CICS
SEND FROM(data) RESP(ws-resp)
END-CICS.
IF ws-resp = DFHRESP(INVREQ)
MOVE ‘N’ to ws-send-unsuccessful.
_______________________________________________________________________________
CICS Training Material Revision 2.0
17
CICS Training Material
_______________________________________________________________________________
2.5.2. HANDLE CONDITION
EXEC CICS
HANDLE CONDITION
LENGERR (lengerr-para)
ERROR (other-errors-para)
END-EXEC.
Control is transferred to lengerr-para if LENGERR condition occurs for any command. For
any other error, control is transferred to other-errors-para.
NOHANDLE Option
_______________________________________________________________________________
CICS Training Material Revision 2.0
18
CICS Training Material
_______________________________________________________________________________
EXEC CICS
SEND FROM(data)
LENGTH (value)
NOHANDLE
END-EXEC.
Even if an exception condition occurs during the SEND command, it is ignored and control
is transferred to the statement after the SEND statement.
Format is
EXEC CICS handle abend program (name) label (label) cancel reset
END-EXEC.
The Handle Aid command is used to specify the label (paragraph) to which control is to be
passed when a specified aid is received in the program. After the completion of a terminal
input command such as RECEIVE control will be passed to the specified paragraph in the
program.
• The key ranges are PA1 to PA3, PF1 to PF24, ENTER , CLEAR.
• The above keys are called Attention Identifier (AID) Keys.
• ANYKEY means any of the above except ENTER key.
• A specific key option will override an ANYKEY option.
• An option without a label deactivates a previous label set for that option.
Sample program 2
_______________________________________________________________________________
CICS Training Material Revision 2.0
20
CICS Training Material
_______________________________________________________________________________
100019 END-EXEC.
100020 EXEC CICS
100021 FORMATTIME
100022 ABSTIME(WS-TIME)
100023 DDMMYY(W-DATE)
100024 DATESEP('/')
100025 TIME(W-TIME)
100026 TIMESEP(':')
100028 RESP(W-RESP)
100029 END-EXEC.
100030 IF W-RESP = DFHRESP(NORMAL)
100031 CONTINUE
100032 ELSE
100033 MOVE 'FORMATTIME ERROR! JOB CANCELED!! ‘ TO W-TEXT
100035 EXEC CICS SEND FROM(W-TEXT) END-EXEC
100035 PERFORM END-PARA
100046 END-EXEC.
100048 EXEC CICS
100049 SEND FROM(WS-GRP) ERASE
100055 END-EXEC.
100057 END-PARA.
100058 EXEC CICS RETURN END-EXEC.
100065 GOBACK.
Sample Program 3
Sample Program 4
_______________________________________________________________________________
CICS Training Material Revision 2.0
21
CICS Training Material
_______________________________________________________________________________
000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID. TRG072P1.
000210 *SAMPLE Program for SEND TEXT WITH ACCUM
000300 ENVIRONMENT DIVISION.
000400 DATA DIVISION.
000500 WORKING-STORAGE SECTION.
003600 01 TEXT-HEADER.
003700 10 FILLER PIC S9(4) COMP VALUE 29.
003800 10 FILLER PIC X VALUE '&'.
003900 10 FILLER PIC X.
004000 10 FILLER PIC X.
004100 10 FILLER PIC X(29) VALUE
004200 'COMPANY PROFILE - PAGE && '.
004203 01 TEXT-LENGTH PIC S9(4) COMP.
004210 01 TEXT-BODY1 PIC X(10) VALUE 'TEST1'.
004220 01 TEXT-BODY2 PIC X(10) VALUE 'TEST2'.
004230 01 W-USERID PIC X(8).
004300 PROCEDURE DIVISION.
004400 MAIN-PROC.
004401 EXEC CICS ASSIGN USERID(W-USERID) END-EXEC.
004402 MOVE 10 TO TEXT-LENGTH
004410 EXEC CICS SEND TEXT
004420 FROM(TEXT-BODY1)
004421 LENGTH(TEXT-LENGTH)
004430 HEADER(TEXT-HEADER)
004440 ACCUM
004450 ERASE
004460 END-EXEC.
004461 MOVE 10 TO TEXT-LENGTH
004470 EXEC CICS SEND TEXT
004480 FROM(TEXT-BODY2)
004481 LENGTH(TEXT-LENGTH)
004490 ACCUM
004491 ERASE
004492 END-EXEC.
004493 EXEC CICS SEND PAGE
004494 END-EXEC.
004700 EXEC CICS
004800 RETURN
004900 END-EXEC.
005000 GOBACK.
****** **************************** Bottom of Data ****************************
_______________________________________________________________________________
CICS Training Material Revision 2.0
22
CICS Training Material
_______________________________________________________________________________
• Running the DB2 precompiler first is the preferred method. DB2 precompiler
precedes another process, binding, not mentioned here.
• Messages or warnings are provided on all the listings.
• The transaction identifiers, associated programs and files need to be defined to
CICS. This is usually done by the Systems Programmers.
The DB2 precompiler recognizes EXEC SQL statements, which it will comment out and
replace with, in our case, COBOL PERFORM and CALL statements.
2.9. Translator
The Translator recognizes the EXEC CICS statements. They are commented out and
replaced with statements in the appropriate language. In a COBOL-CICS program, MOVE
instructions and CALL Statemenets are inserted and passed on to the COBOL compiler.
The following is an example of how a CICS command is converted into corresponding
COBOL code.
Example
Eg:
_______________________________________________________________________________
CICS Training Material Revision 2.0
23
CICS Training Material
_______________________________________________________________________________
This will take the newly compiled version of program TRGXXXP1 for updation. But
cannot be performed if the program is in use. If ‘NE’ is not given the CEMT
command will display the status of the program TRGXXXP1 which was compiled
before updation..
This transaction will take the new copy or latest compiled version of the map
MAPXXX.
File (TRGXXXF1) Vsa Ope Ena Rea Upd Add Bro Del Sha
Dsn( TRGXXX.VSAM.ESDS)
RESPONSE: NORMAL
If you change the ‘Ope’ to ‘Clo” and press enter, then the file which is opened will be
closed.
Note: you should always check RESPONSE for NORMAL, Otherwise it will show
error message.
The terminal that you are using for the EDF interaction must be in transceive (ATI/TTI)
status and be able to send and receive data. This is the most common status for
display terminals, but you can find out by asking your system programmer to check its
status.
For a transaction initiated at a terminal, you can use EDF on the same terminal as the
transaction you are testing, or on a different one. On the same terminal, you must
start by clearing the screen and entering the transaction code CEDF, otherwise you
may get unpredictable results. The message THIS TERMINAL: EDF MODE ON is
displayed at the top of an empty screen. You clear the screen again and run your
transaction in the normal way.
If you are using two terminals, you enter CEDF tttt at one, naming the second in tttt.
Then you run your transaction on the second terminal.
_______________________________________________________________________________
CICS Training Material Revision 2.0
24
CICS Training Material
_______________________________________________________________________________
Example:
(i) Let us say your transaction identifier is GC01
(ii) If you want to execute the program in interactive debugging mode. Enter
CEDF and then transaction identifier as follows:
It will wait for your response before executing each CICS command
You can use the command-level interpreter (CECI) transaction to check the syntax
of CICS
Commands and process these commands interactively on a 3270 screen. CECI
allows you to follow through most of the commands to execution and display the
results. It also provides you with a reference to the syntax of the whole of the CICS
command-level application programming and system programming interface.
CECI interacts with your test system to allow you to create or delete test data,
temporary storage queues, or to deliberately introduce wrong data to test out error
logic. You can also use CECI to repair corrupted database records on your
production system.
Question mark (?) before the CECI command requests a syntax check only. No
execution.
CECI ? delay inerval(000100)
_______________________________________________________________________________
CICS Training Material Revision 2.0
25
CICS Training Material
_______________________________________________________________________________
6 If You want to use Diagnostic Facility use CEDF (Ex: Type CEDF &
enter)
7 Enter the transaction identifier
2.11. Exercise
1. Write a simple CICS program to receive the current transaction ID from the
screen and send a message to the screen as ‘My Transaction ID is XXXX’,
where XXXX is the transaction ID.
2. Write a CICS program to send the current system date on to the screen in the
format ‘20-10-01’ and the current time in the format ‘12:12:12’.
3. Write a CICS program to send the message ‘Current date is ‘, followed by a
delay of 10 seconds, followed by the display of the actual date.
_______________________________________________________________________________
CICS Training Material Revision 2.0
26
CICS Training Material
_______________________________________________________________________________
BMS is a part of Terminal Management service module of CICS . BMS is a facility that
moves data streams to and from the terminal.
_______________________________________________________________________________
CICS Training Material Revision 2.0
27
CICS Training Material
_______________________________________________________________________________
3.3. Screen Layout Documentation
NAME : C__________
SEX : _ Unprotected
Fields
AGE : __
Numeric Field
• Constants describe the meaning of the field.
• Protected fields cannot be changed.
• Unprotected fields can be changed.
• The cursor can be interpreted as an invitation to “Start Entering Here”.
• A stopper field after NAME can cause the cursor to skip to the next
unprotected field (SEX).
• A stopper field after AGE should lock the keyboard indicating field overrun.
♦ Coded using BMS macros assembled and linkedited into CICS Load Library.
♦ It is a program in the form of load module stored in one of the runtime libraries
and CICS loads it when executing a program using this map.
♦ 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 the starting position, length, field
characteristics (Attribute Bytes) and default data for each field, and allows BMS
to construct an output data stream.
• The Physical Map is actually a program (defined to PPT) in the form of a Load
Module.
• The Physical Map is coded using BMS macros.
• The BMS macros are then assembled separately and link edited into the CICS
load library
_______________________________________________________________________________
CICS Training Material Revision 2.0
28
CICS Training Material
_______________________________________________________________________________
3.4.2. Physical Map Contents
DFHMDF, DFHMSD, DFHMDI are all CICS BMS macros. Formats of BMS Macros are
described below. Users by default won’t code their own macros. They define the
screens using some facility like SDF (Screen Definition Facility) provided by IBM, and
generate the macros and the symbolic maps through SDF itself. The macros are then
assembled to get the Physical Map, and optionally the Symbolic Map also.
The BMS map definition macros are purely assembler macros. Macro is an instruction
similar to assembler macro, which is a group of assembler instructions for a specific
function. The following coding convention to be maintained.
Ex:
Where TYPE, MODE, LANG are the operands for the mapset SAMPLE.
_______________________________________________________________________________
CICS Training Material Revision 2.0
29
CICS Training Material
_______________________________________________________________________________
Column 72 is for Continuation character. If we define a mapfield and if it continues to
second line then we have to specify ‘X’ at column 72 for continuation otherwise it can be
blank.
FORMAT
mapset DFHMSD TYPE=&SYSPARM, X
[MODE=INOUT,] X
[LANG=COBOL,] X
[STORAGE=AUTO,] X
[TIOAPFX=YES,] X
[CTRL=(FREEKB, FRSET,PRINT)]
3.4.2.2. OPTIONS
_______________________________________________________________________________
CICS Training Material Revision 2.0
30
CICS Training Material
_______________________________________________________________________________
TIOAPFX = YES To reserve the prefix space (12 bytes) for BMS command to
access TIOA.
CTRL
FREEKB To unlock keyboard after each output operation. Otherwise
the user must press the RESET key each time.
FRSET Specifies that all Modified Data Tags be turned off when the
map is sent to the terminal. Use this option if you want the
terminal only to transmit data that the operator modifies.
ALARM : To send an alarm at screen display time.
PRINT : To indicate the mapset to be sent to the printer.
FORMAT
_______________________________________________________________________________
CICS Training Material Revision 2.0
31
CICS Training Material
_______________________________________________________________________________
3.4.2.5. DFHMDF macro
FORMAT
DFHMDF POS=(1,8), X
LENGTH=20, X
ATTRB=(ASKIP,BRT), X
INITIAL=‘EMPLOYEE NAME’
empn DFHMDF POS (1,30), X
LENGTH=20, X
ATTRIB=(UNPROT,NORM)
3.4.2.6. Options
INITIAL : Defines initial value of the field
ATTRIB : Defines attribute character of the field.
LENGTH : Length of field
JUSTIFY : Justify the field to RIGHT or LEFT. LEFT is default.
PICIN :} PICTURE clause of field.
PICOUT :}
3.4.2.7. PICIN/PICOUT
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. PICIN tells BMS how to move data into the ‘I’
suffix field. PICOUT tells COBOL how to display the data. This option is allowed
only for COBOL applications and not in any other languages.
Eg. : F1 DFHMDF POS=40,LENGTH=10,PICOUT=’$$$,$$0.00’
F2 DFHMDF
POS=60,LENGTH=6,PICIN=’9999V99’,PICOUT=’ZZ9.99’
_______________________________________________________________________________
CICS Training Material Revision 2.0
32
CICS Training Material
_______________________________________________________________________________
UNPROT: Unprotected field. Data can be entered. Should be specified for all
input fields.
NUM : Numeric field, only (0 to 9) and (“.” & “_”) are allowed.
BRT : To Highlight the field
NORM : Normal display
DRK : Dark display (invisible).
IC : Insert Cursor. Cursor is positioned in this field.
If IC is specified on more than one field of a map, cursor will be
placed in the last field.
FSET : Field set (MDT on). Regardless of field being modified or not, MDT
will be set.
♦ If the field on the screen is modified by the terminal user, MDT is automatically
SET to “1” (ON).
♦ IF CTRL=FRSET is specified in the DFHMSD or DFHMDI macro, MDT will be
reset to “0” (OFF) when the map is sent to the terminal.
♦ IF FSET is specified in the ATTRB parameter of DFHMDF macro, MDT will be
set to “1” (ON) regardless of whether the terminal user modifies or not.
♦ MDT is set ON/OFF depending upon the amount of information needed to be
transmitted to and from the terminal. Protected fields will have MDT OFF.
Unprotected fields will have their MDT set automatically when any change is
made.
_______________________________________________________________________________
CICS Training Material Revision 2.0
33
CICS Training Material
_______________________________________________________________________________
(Assuming there are 2 fields called FLD1 and FLD2 in the map MAPNAM1)
01 MAPNAM1I.
02 FILLER PIC X(12).
02 FLD1L COMP PIC S9(4). ----------> The length of the field (L)
02 FLD1F PIC X. ----------> Field attribute (F/A)
02 FILLER REDEFINES FLD1F.
03 FLD1A PIC X.
02 FLD1I PIC 9(5). ----------> Field data (I)
02 FLD2L COMP PIC S9(4).
02 FLD2F PIC X.
02 FILLER REDEFINES FLD2F.
03 FLD2A PIC X.
02 FLD2I PIC X(6).
01 MAPNAM1O redefines MAPNAM1I.
02 FILLER PIC X(12).
02 FILLER PIC X(3).
02 FLD1O PIC 9(5). -----------> Field data (O)
02 FILLER PIC X(3).
02 FLD20 PIC X(6).
MAPNAM1I is used while receiving maps, while MAPNAM1O is used while sending maps.
3.5.3.1 INPUT
_______________________________________________________________________________
CICS Training Material Revision 2.0
34
CICS Training Material
_______________________________________________________________________________
“L” Halfword binary - Contains the length of data entered by the terminal
operator
“F” One byte flag field - If EOF (erase to end of field) key is pressed, it will
contain x‘80’, and “l” field will contain zeros.
“I” Contains the data received from the screen.
3.5.3.2 OUTPUT
“A” one byte field that describes the Attributes of the field. Sets the following
attributes :
PROTECTED/UNPROTECTED
ASKIP
NUM
MDT
Non-Display (DARK) / Display(NORMAL/BRIGHT)
SAMPLE MAP
EXEC CICS
SEND MAP(Mapname)
[MAPSET(Mapsetname)]
[MAPONLY|DATAONLY]
[FROM(data-area)]
[LENGTH(data-value)]
[ERASE | ERASEUP]
[FREEKB]
[FRSET]
END-EXEC
Exception Conditions : INVMPSZ - Specified map is too wide for the terminal.
INVREQ - Not a valid request (Check for errors)
_______________________________________________________________________________
CICS Training Material Revision 2.0
36
CICS Training Material
_______________________________________________________________________________
ERASEUP Erase only the unprotected fields.
FREEKB Specifies that the 3270 keyboard should be unlocked after the map is
sent. If not specified, the keyboard remains locked.
FRSET Set MDT flags of all the fields to ‘0’.
• Using constants in the name field for MAP and MAPSET (FROM is not
required)
Eg.
SEND MAP(‘MAP1’) MAPSET(‘SET1’)
Using variables in the name field for MAP and MAPSET (This makes FROM(data-
area) a required parameter)
If the color or highlighting of a field has to be changed, additional symbolic fields are
needed which are called the EXTENDED ATTRIBUTES
Coding DSATTS (for symbolic map) and MAPATTS (for physical map) parameters in
the BMS macro definitions allows the use of extended attribute characteristics.
MAPATTS parameter allows you to set up the physical map with any of the
characteristic(s) coded.
DSATTS parameter creates appropriate suffixed labels for the attribute
characteristic(s) coded.
_______________________________________________________________________________
CICS Training Material Revision 2.0
37
CICS Training Material
_______________________________________________________________________________
Place -1 into the field-length field (“L” suffix) of the required field before the
SEND MAP command. Cursor will be placed at this field when the map is sent.
Example:
Move –1 to AddressL
Perform send-map
The above example will place the cursor at address field. The addressL will be
defined in the symbolic map.
This is used to send device controls to a terminal without any map or data. Commonly,
this is used to clear a screen at the end of a transaction, or before sending a map.
EXEC CICS
SEND CONTROL [ERASE]
[FREEKB]
END-EXEC
COPY DFHAID Declares Attention Identifier (AID) constant. Attention identifier (AID)
indifcates which method the terminal operator has used to initiate the transer of information
from the terminal devices to CICS. Used to trap PF,ENTER, CLEAR Keys etc. The
DFHAID member contains the following AID codes :
DFHENTER, DFHCLEAR, DFHPA1 to DFHPA3, DFHPF1 to DFHPF12.
_______________________________________________________________________________
CICS Training Material Revision 2.0
38
CICS Training Material
_______________________________________________________________________________
The EIBAID field can be tested after each terminal control (or BMS) input operation.
Eg:Exec CICS Receive Map(…) Mapset(…) ..End-exec.
If EIBAID = DFHPF1 perform Update-routine.
Execution results: If PF1 function key is pressed, then upate-routine paragraph will be
performed
COPY DFHBMSCA Declare field attribute bytes. Used to dynamically set field attributes
on Screen. See Appendix at the end of the material for more details.
COPY MAPSET1 Copy Symbolic Map into the CICS Application program.
EXEC CICS
RECEIVE MAP(mapname)
[MAPSET(mapsetname)]
[INTO(data-area)]
[LENGTH(data-value)]
END-EXEC
Exception Conditions: MAPFAIL - Data received has a length of ‘0’. (when nothing is entered on the
screen)
• Using constants in the name field for map and mapset (INTO is not required).
This is commonly used.
Eg. RECEIVE MAP(‘MAP1’) MAPSET(‘SET1’)
• Using variables in the name field for MAP and MAPSET. This makes INTO a
required parameter.
Eg. MOVE ‘MAP1’ TO MAPVAR
MOVE ‘SET1’ TO SETVAR
_______________________________________________________________________________
CICS Training Material Revision 2.0
39
CICS Training Material
_______________________________________________________________________________
RECEIVE MAP(MAPVAR) MAPSET(SETVAR) INTO(MAP1I)
• Using only the MAP parameter. In this case the name in the MAP option must
be the MAPSET name.
AID/CURSOR
On a RECEIVE MAP, CICS updates the EIB with the following information:
• The screen cursor position relative to zero is placed in EIBCPOSN.
• The name of the input key the terminal operator pressed is placed in the field
EIBAID.
WORKING-STORAGE SECTION.
COPY DFHAID.
.......
PROCEDURE DIVISION.
IF EIBAID=DFHPF12 THEN
........
IF EIBAID=DFHENTER THEN
.......
IF EIBCPOSN LESS THAN 80 THEN
........
When a program is invoked through a transaction, the EIBAID and EIBCPOSN fields of
the EIB can be checked prior to issuing a RECEIVE MAP command. This enables the
program to take action depending upon the key pressed or depending upon the cursor
position.
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.
EIBCPOSN can be used to determine where the cursor was positioned on the screen.
3.11.5. CURSLOC
_______________________________________________________________________________
CICS Training Material Revision 2.0
40
CICS Training Material
_______________________________________________________________________________
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
CURSLOC=YES allows you to determine after a RECEIVE MAP command, which map field
had the cursor in it. CURSLOC=NO is the default
CURSLOC=(NO/YES) may be coded on the DFHMSD or the DFHMDI macro. If coded on
the DFHMSD macro, it will provide a default for all the maps in that mapset.
If CURSLOC=YES is specified, BMS will set the ‘F’ suffix field to X’02’ indicating that field
contained the cursor. If the cursor is in a field for which there is no symbolic label (i.e. a
DFHMDF with no label), the program will not be notified.
Note: The ‘F’ suffix field continues to be used to indicate the operator key pressed. The
Erase-to-End-of-Fixed (EOF) key can be identified by the field being set to X’80’.
Therefore, with 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’.
_______________________________________________________________________________
CICS Training Material Revision 2.0
41
CICS Training Material
_______________________________________________________________________________
3.12. Ending a CICS Transaction (RETURN Command)
EXEC CICS
RETURN [TRANSID(name)]
[COMMAREA(data-area)]
[LENGTH(data-area)]
END-EXEC
Exception Conditions : INVREQ - Transaction name not found.
LENGERR - Length specified is greater than the length of the COMMAREA
data-area.
EXAMPLE:
Define COMMAREA in working-stroage section as
01 COMMAREA.
02 VARS PIC X(4).
TRANSID: Specifies the next transaction to be invoked from here. If not specified, the
current transaction ends, and control is transferred back to CICS. Transaction name should
be a 4 letter word (Eg. “GC01”).
COMMAREA: Specifies a communication area to be made available for the next program, if
needed. This is the area used for passing data from one program to another. In the
receiving program, variable DFHCOMMAREA must be specified in the Linkage Section,
which now contains the data in the communication area. Data-area refers to an area
defined in the Working-Storage section of the calling program.
LENGTH: The length of the COMMAREA.
Issue the SEND MAP command with ACCUM and PAGING Options, which accumulates
the map as a multipage message.
Repeat step 1 until all maps are accumulated
Issue the SEND PAGE Command, which sends the entire maps as one logical message.
_______________________________________________________________________________
CICS Training Material Revision 2.0
42
CICS Training Material
_______________________________________________________________________________
Example
ACCUM-PARA.
EXEC CICS SEND MAP (‘HEADER’)
MAPSET (‘map072’)
ERASE
ACCUM
PAGING
END-EXEC.
PAGE-RTN.
The above Send command will do page accumulation but will not send the actual screen.
At the completion of SEND PAGE Command a series of maps/screens are actually sent to
the terminal as one logical message.
_______________________________________________________________________________
CICS Training Material Revision 2.0
43
CICS Training Material
_______________________________________________________________________________
IDENTIFICATION DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
COPY DFHAID.
COPY DFHBMSCA.
COPY MAPSET1. (structure of MAPSET1 will be similar to the one described earlier.
PROCEDURE DIVISION.
EXEC CICS
SEND MAP(MAPNAM1)
MAPSET(MAPSET1)
FREEKB
ERASE
FROM(MAPNAM1O)
END-EXEC.
MOVE LOW-VALUES TO MAPNAM1I.
EXEC CICS
RECEIVE MAP(MAPNAM1)
MAPSET(MAPSET1)
INTO(MAPNAM1I)
END-EXEC.
EXEC CICS
RETURN
END-EXEC.
This program will send the map MAPNAM1 to the screen, wait for the user to enter data,
and when the user presses the ENTER key, receives the map, and ends the transaction,
returning the control to CICS.
RECEIVE MAP is executed only when the user presses any of the function keys or the
ENTER key. Till then, the program waits endlessly.
Sample program 2
_______________________________________________________________________________
CICS Training Material Revision 2.0
44
CICS Training Material
_______________________________________________________________________________
600000 PROCEDURE DIVISION.
660100 MAIN-PROC.
790102 PERFORM SEND-MAP
790105 PERFORM RECEIVE-MAP
790106 EXEC CICS RETURN END-EXEC.
790108 GOBACK.
790111 SEND-MAP.
790112 MOVE LOW-VALUES TO HEADERO.
790113 EXEC CICS
790114 SEND MAPSET('MAPXXX') MAP('HEADER') FROM(HEADERO)
790120 ERASE
790200 END-EXEC.
930100 RECEIVE-MAP.
930200 EXEC CICS
930300 RECEIVE MAPSET('MAPXXX') MAP('HEADER') INTO(HEADERO)
930400 END-EXEC.
*********************************** Bottom of Data ****************************
_______________________________________________________________________________
CICS Training Material Revision 2.0
45
CICS Training Material
_______________________________________________________________________________
• One Transaction identifier and one program: This technique is the best out
of all the three because the entries in CICS Tables are one PPT and one PCT
like our normal conversation but not wasting the time by waiting for user
response. Here we use same program & transaction identifier in TRANSID of
RETURN command with Communication area (COMMAREA) to pass
information.
Return Transid will terminate the transaction and specify TRN2 as the next transaction.
When operator enters data and presses the ENTER key, the transaction TRN2 will
automatically start (a new task is initiated), and program2 will be invoked.
COMMAREA
• COMMAREA is a very important concept while developing CICS applications.
It is used for passing data from one pseudo-conversational task to another or
while linking one program to another.
• A COMMAREA is a CICS maintained unit of storage for passing and receiving
data between CICS programs
• The first time a COMMAREA is passed, it must be defined as an area of
storage in the working storage section of the program passing the
COMMAREA.
• The RETURN command has a parameter for passing a COMMAREA to the
program associated with the subsequent transaction.
• The subsequent program (the receiver of the COMMAREA) must define a
variable called DFHCOMMAREA in its LINKAGE SECTION. Once this is done,
it will automatically access the COMMAREA fields.
_______________________________________________________________________________
CICS Training Material Revision 2.0
46
CICS Training Material
_______________________________________________________________________________
♦ In this case, Program1, as both the sender and the receiver of the
COMMAREA, needs the Working-Storage Section definition to SEND and the
Linkage Section definition of DFHCOMMAREA to RECEIVE.
♦ Also, Program1 must be able to distinguish between the FIRST TIME entry into
the program when there is no COMMAREA, and subsequent times when
COMMAREA data exists in the Linkage Section. This is done using the
EIBCALEN field of the EIB.
3.14.3. EIBCALEN
_______________________________________________________________________________
CICS Training Material Revision 2.0
47
CICS Training Material
_______________________________________________________________________________
IDENTIFICATION DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
COPY DFHAID.
COPY DFHBMSCA.
COPY MAPSET1. (structure of MAPSET1 will be similar to the one described earlier.
01 WS-COMMAREA PIC X(1) VALUE ‘A’.
LINKAGE SECTION.
01 DFHCOMMAREA PIC X(1).
PROCEDURE DIVISION.
IF EIBCALEN = 0
EXEC CICS
SEND MAP(MAPNAM1)
MAPSET(MAPSET1)
FREEKB
ERASE
FROM(MAPNAM1O)
END-EXEC
EXEC CICS
RETURN TRANSID(‘E01A’)
COMMAREA(WS-COMMAREA)
END-EXEC
ELSE
MOVE LOW-VALUES TO MAPNAM1I
EXEC CICS
RECEIVE MAP(MAPNAM1)
MAPSET(MAPSET1)
INTO(MAPNAM1I)
END-EXEC
EXEC CICS
RETURN
END-EXEC
END-IF.
Sample Program 2:
_______________________________________________________________________________
CICS Training Material Revision 2.0
48
CICS Training Material
_______________________________________________________________________________
440000 IDENTIFICATION DIVISION.
460000 PROGRAM-ID. TRGXXXP1.
460100 *THIS SAMPLE CONVERSATION PROGRAM SEND SCREEN AND
460200 *RECEIVE DATA FROM SCREEN USING PSEUDO CONVERSATION
480000 ENVIRONMENT DIVISION.
540000 DATA DIVISION.
540100 WORKING-STORAGE SECTION.
540110 COPY MAP1.
540200 01 COMMAREA.
540210 02 VARS PIC X(4).
540255 LINKAGE SECTION.
540256 01 DFHCOMMAREA.
540257 02 VARS PIC X(4).
600000 PROCEDURE DIVISION.
660100 MAIN-PROC.
660200 IF EIBCALEN = 0
790102 PERFORM SEND-MAP
790103 PERFORM RETURN-TRANS
790104 ELSE
790105 PERFORM RECEIVE-MAP.
790106 PERFORM TRANS-END.
790111 SEND-MAP.
790112 MOVE LOW-VALUES TO HEADERO.
790113 EXEC CICS
790114 SEND MAPSET('MAPXXX') MAP('HEADER') FROM(HEADERO)
790120 ERASE
790200 END-EXEC.
930100 RECEIVE-MAP.
930200 EXEC CICS
930300 RECEIVE MAPSET('MAPXXX') MAP('HEADER') INTO(HEADERO)
930400 END-EXEC.
930500 RETURN-TRANS.
930600 EXEC CICS RETURN
930700 TRANSID('GCXX')
930800 COMMAREA(COMMAREA)
930900 LENGTH(LENGTH OF COMMAREA)
931000 END-EXEC.
931100 TRANS-END.
931200 EXEC CICS RETURN END-EXEC.
931300 GOBACK.
*********************************** Bottom of Data ****************************
3.16. Exercise
_______________________________________________________________________________
CICS Training Material Revision 2.0
49
CICS Training Material
_______________________________________________________________________________
1 Design a screen for accepting two numbers from the user and displaying t he
sum on the screen. Write a program to send this screen, receive input, and
send the output. Write the program in both conversational and pseudo
conversational methods.
1. Design a mapset with 3 maps – a header map, a body map, and a message
map. The header should display the current date and time on the right top
corner, and the user-id on the left. The body map should contain a screen for
receiving two nos. and displaying the sum. The message map should appear
in the bottom and display messages if any. Write a CICS program to send the
header, the body, and the message maps. If user presses the ENTER key
without any data, the time should be updated automatically. If the user enters
any wrong data, message should be displayed.
Thus a LINKed program returns to the original program, at the instruction following the
LINK command, while an XCTLed program doesn’t return to the calling program.
Logical levels
CICS
0
Prog A Prog B
XCTL B LINK C 1
RETURN RETURN
Prog C Prog D
XCTL D LINK xx
2
RETURN RETURN
The Program A (Prog A) is at the logical level 1,so that the RETURN command in Prog A
will cause control to be returned to CICS itself at the level 0. Since Program A issues the
XCTL command for program B will be at the level 1.Therefore the RETURN command in
_______________________________________________________________________________
CICS Training Material Revision 2.0
50
CICS Training Material
_______________________________________________________________________________
prog B will also control to be returned to CICS itself as level 0, not prog A at level 1.Since
prog B issues the LINK command for PROG C, program C will be the level 2. Therefore the
return command in prog C will be cause control to be returned to Prog B at the level 1.
Since prog C issues XCTL command for prog D, prog D will be at level 2.Therefore, the
RETURN command in prog D will cause control to be returned to prog B at the level 1,not
at level 2.
Data may be passed between the two programs through the COMMAREA option of the
LINK or XCTL command
• Program1 issues LINK to Program2.
• The LINKed program Program2 runs at a new logical level and returns back to
the LINKing program.
• Program2 obtains the Commarea data through a variable DFHCOMMAREA
coded in its Linkage Section.
• When Program2 issues RETURN, control passes back to Program1.
The LINK Command is used to pass control from Main application program at one logical
level to another subprogram at the next logical level. The Main program expects control to
be returned back from subprogram. This is achieved by RETURN Command given in
subprogram. After executing the LINK command in Main program ,the program will execute
the next statement .The COMMAREA is to communicate data from main program to
subprogram and the LENGTH is length of the COMMAREA.
EXEC CICS
LINK PROGRAM (pgmname)
[COMMAREA (ws-commarea)]
[LENGTH (ws-length)]
END-EXEC
Exception Conditions - NOTAUTH -- Security check
PGMIDERR – Program specified is not found in PPT
Eg. EXEC CICS LINK PROGRAM (PROG1) COMMAREA (WS-COMMAREA)
END-EXEC
The XCTL Command is used to pass control from Main application program at one logical
level to another program at the same level. Main program doesn’t expect control to be
returned back from subprogram. The COMMAREA is to communicate data from main
program to next program and the LENGTH is length of the COMMAREA. After the
execution of XCTL Command, Control willl not return back to main program. This command
has less overheads so that performance is better when compared to LINK Command.
_______________________________________________________________________________
CICS Training Material Revision 2.0
51
CICS Training Material
_______________________________________________________________________________
EXEC CICS
XCTL PROGRAM (pgmname)
[COMMAREA (ws-commarea)]
[LENGTH (ws-length)]
END-EXEC
Exception Conditions - NOTAUTH - Security check
PGMIDERR - Program specified is not found in PPT
LENGERR - Occurs when length specified is greater than the
Length of data area specified in commarea.
Example
_______________________________________________________________________________
CICS Training Material Revision 2.0
52
CICS Training Material
_______________________________________________________________________________
4. FILE HANDLING
4.1. Introduction
CICS allows a program to access data files in a variety of ways. In an online system most
file accesses are random because the transactions to be processed are generally not
grouped together. The CICS file Control Program provides application programs with
services to Read, Write, Rewrite and Delete records in a file.
In addition, it makes application programs independent of the database structure, manages
exclusive control over the record in order to maintain data integrity during record updates.
Input-Output Section
SELECT statement
FD Statement
Open/Close Statement
JCL Parameters
The system programmer defines the File Control Table (FCT) to specify the characteristics
of files to be used under CICS while the application programmer simply codes the relative
file control commands in the program. The access method being used is transparent to the
application programmer.
If a task is updating a record the other tasks must be restrained from accessing that record
till the task is completed. This control is called exclusive control over the resources during
updates. In CICS environment many tasks might be concurrently accessing the same file or
record.
CICS will secure exclusive control of the Control Interval where the record to be updated
resides in the VSAM file so that nobody else can access the same record or control interval
until the record is rewritten,deleted or the program issues an UNLOCK commandor the task
terminates.
_______________________________________________________________________________
CICS Training Material Revision 2.0
53
CICS Training Material
_______________________________________________________________________________
When an application program accesses a file, the file must be open under CICS . For this
FCT defines a file open / close status.
Files are not opened and closed by the application program, instead they are opened and
closed in the following manner:
a. Files that are used by all applications may be opened when CICS
is initialised at the beginning of the day and closed when CICS is
terminated.
b. The users may actually open and close files many times during
the day using the Master Terminal Transaction (CEMT)
Working-Storage Section.
File record description, including the record key. (no FD entries)
Procedure Division.
Move value of the record key to be read to the record key field.
EXEC CICS READ FILE(filename)
_______________________________________________________________________________
CICS Training Material Revision 2.0
54
CICS Training Material
_______________________________________________________________________________
• PARTIAL KEY
For KSDS Key specified can be a full key or partial key.
If partial key, keylength has to be provided.
RBA (Relative Byte Address) can also be used instead
of actual key value.
For ESDS RIDFLD contains a 4 byte RBA.
For RRDS RIDFLD contains 4 Byte binary Relative Record
Number. (RRN)
Example
WORKING-STORAGE SECTION.
05 RECKEY PIC X(6).
PROCEDURE DIVISION.
MOVE value TO RECKEY.
RIDFLD must be set to the value of the key of the record to be retrieved.
RIDFLD must be large enough to hold a full record key even when a partial key is
used.
INTO Names the field in the working storage section where the data has to be
placed.
RIDFLD The Record Identification field Can be a KEY (KSDS), RBA (ESDS), RRN
(RRDS)
_______________________________________________________________________________
CICS Training Material Revision 2.0
55
CICS Training Material
_______________________________________________________________________________
LENGTH Half-word binary. It indicates maximum length of the record to be read. It is
optional. Compulsory for Variable length records.
UPDATE File is to be read for Update or Delete operation.
_______________________________________________________________________________
CICS Training Material Revision 2.0
56
CICS Training Material
_______________________________________________________________________________
Used to read a nonspecific record based on the generic key (i.e, a higher part of key) specified,
instead of full key.This can be used when you don’t know the complete information of the key.
EXEC CICS
READ FILE(filename)
INTO (data-area)
RIDFLD(REC-KEY)
KEYLENGTH(3) -------> specifies length of Generic key. It must be specified.
GENERIC
LENGTH(WS-LEN)
END-EXEC
EXAMPLE:
MOVE 80 TO WK-LEN
MOVE ‘BAG’ TO REC-KEY
EXEC CICS
READ FILE(‘TRGXXXF1’)
INTO (REC1)
RIDFLD(REC-KEY)
KEYLENGTH(3)
GENERIC
LENGTH(WS-LEN)
END-EXEC
Execution results: Suppose the file TRGXXXF1 has the following records in order
ARG112
ARG111
BAG110 - This record, the first record of the generic key ‘BAG’ ,will be read
first
BAG112
Example
MOVE 50 to WS - LEN.
MOVE ‘BAG’ TO REC-KEY.
EXEC CICS READ
FILE(‘FILEAAA’)
INTO(data-area)
RIDFLD(REC-KEY)
KEYLENGTH(3)
GENERIC
LENGTH (WS-LEN)
END-EXEC.
DATA IN FILE: BAG 112
BAG 111
BAG 110
This record will be read BAG 112 as this is the first record with generic key ‘BAG’.
WRITE command
_______________________________________________________________________________
CICS Training Material Revision 2.0
58
CICS Training Material
_______________________________________________________________________________
EXEC CICS
WRITE FILE(filename)
FROM(data-area)
LENGTH(data-value)
RIDFLD(data-area)
[KEYLENGTH (data-value)
[MASSINSERT]
END-EXEC
Exceptional Conditions : INVREQ WRITE not allowed
WRITE issued for a file opened with READ/UPDATE
DISABLED,DUPREC,FILENOTFOUND,NOSPACE,NOTAUTH,NOTOPEN
The MASSINSERT option is used when adding multiple records in ascending key
sequence. This option is coded for every write command in a series of writes. Mass insert
operation must be terminated by issuing the UNLOCK command.
To release exclusive control of the record established by the previous READ command with
UPDATE option
EXEC CICS
UNLOCK FILE(filename)
END-EXEC
Exception Conditions : DISABLED, FILENOTFOUND, NOTAUTH, NOTOPEN
The primary key cannot be modified. This command must be preceded by a READ
UPDATE command
_______________________________________________________________________________
CICS Training Material Revision 2.0
59
CICS Training Material
_______________________________________________________________________________
EXEC CICS REWRITE FILE(filename)
FROM(data-area)
LENGTH(data-value)
END-EXEC
Exceptional Conditions :DUPREC Attempt to rewrite a record with duplicate key
INVREQ REWRITE tried without previous READ UPDATE
command
NOSPACE No space available for updating the record
FILENOTFOUND, NOTOPEN, NOTAUTH can also occur.
Data-value in LENGTH option is the length of the new record
DELETE
EXEC CICS
DELETE FILE(filename)
RIDFLD(data-area)
KEYLENGTH(data-value)
GENERIC
NUMREC(data-area)
END-EXEC
Exception Conditions : INVREQ DELETE not allowed
DELETE without RIDFLD and without prior READ/UPDATE
DELETE issued for an ESDS
DELETE with RIDFLD for file opened with READ/UPDATE
DISABLED, DUPKEY, FILENOTFOUND, NOTAUTH, NOTOPEN can also
occur.
NUMREC data-area contains the number of records deleted on a GENERIC DELETE. A
half-word binary field S9(4) COMP should be provided to NUMERIC.
KEYLENGTH indicates the length of the generic key. Higher part of the key information
must be supplied in the RIDFLD.
Records cannot be deleted from an ESDS.
_______________________________________________________________________________
CICS Training Material Revision 2.0
60
CICS Training Material
_______________________________________________________________________________
EXEC CICS
READ FILE(filename)
UPDATE
INTO(data-area)
LENGTH(data-area)
RIDFLD(data-area)
END-EXEC
EXEC CICS
DELETE FILE(Filename)
END-EXEC
Direct Delete
Here the RIDFLD is provided and the corresponding record is deleted. Cannot be used if a
READ UPDATE command is pending on the file.
EXEC CICS
DELETE FILE(filename)
END-EXEC
EXEC CICS
DELETE FILE (name)
RIDFLD(data-area)
END-EXEC
Exceptional Conditions
INVREQ Delete operation is not allowed on the file.
Example:
4.2.8.Deadly Embrace
One transaction needs exclusive use of some resource held by a second transaction and
the second transaction cannot release the resource because it is waiting for some resource
held by the first.
Only way of breaking the deadlock is to cancel one or both the transactions.
_______________________________________________________________________________
CICS Training Material Revision 2.0
61
CICS Training Material
_______________________________________________________________________________
Establish
Position
Retrieve Next
Record
Yes
Yes
No
Process Record
Process
No
No
Change End of Browse
Position
Yes
Terminate Browse
♦ Establish position
♦ Retrieve and process records
♦ Terminate browse.
♦ Record retrieved as a part of browse cannot be updated during browse.
STARTBR The STARTBR command is used to Establish a browse starting position for
a file.This command is for establishing the position only. The actual record will be read by
the READNEXT or READPREV commands.
_______________________________________________________________________________
CICS Training Material Revision 2.0
62
CICS Training Material
_______________________________________________________________________________
READNEXT The READNEXT command is used to read a record from a file sequentially
forward.The STARTBR command should have been issued before starting the command
and should be successful. If you specify the command in a perform loop it will read records
forward till end of file condition or till the condition specified in perform statement is
reached.
RESETBR The RESETBR command is used to reestablish another starting point within
the same browse operation against the same file.Otherwise the RESETBR performs
exactly same as the STARTBR command.
ENDBR This command is to terminate the browse operations.At the end of the
STARTBR or RESETBR command operations this command has to be issued to end the
browse operations.
EXEC CICS
STARTBR FILE(filename)
RIDFLD(data-area)
[GTEQ | EQUAL]
[KEYLENGTH(data-value) [GENERIC]]
END-EXEC
Exception Conditions : INVREQ Browse operations not allowed
KEYLENGTH value is less than 0 or greater than file length
DISABLED, DUPKEY, NOTOPEN, NOTAUTH, NOTFND,FILENOTFOUND
can also occur.
GTEQ If no record is found for exact key, CICS places position on the next
available record. Default for a KSDS or RRDS.
EQUAL If no record is found for the exact key, exceptional conditionoccurs.
NOTFND Default for an ESDS.
GENERIC Places the position at the first record satisfying the partial key.
4.2.10.3.READNEXT command
To read a record of a file sequentially forward. STARTBR must have been successfully
completed before READNEXT command.
_______________________________________________________________________________
CICS Training Material Revision 2.0
63
CICS Training Material
_______________________________________________________________________________
EXEC CICS
READNEXT FILE(filename)
INTO(data-area)
LENGTH(data-value)
RIDFLD(data-area)
END-EXEC
Exception Conditions : INVREQ READNEXT issued without a previous successful STARTBR
KEYLENGTH value is less than 0 or greater than file length
ENDFILE End of file reached during BROWSE
DUPKEY, NOTAUTH, NOTFND, FILENOTFOUND can also occur.
EXEC CICS
RESETBR FILE(filename)
RIDFLD(data-area)
[KEYLENGTH(data-value) [GENERIC]]
[GTEQ|EQUAL]
END-EXEC
Exception Conditions : INVREQ RESETBR issued without previous STARTBR
FILENOTFOUND, NOTAUTH, NOTFND
Explanations for these options, and the exception conditions possible are same for
STARTBR.
EXAMPLE
startbr command
readnext command
MOVE ‘TRG’ to REC-KEY
EXEC CICS RESETBR FILE(‘FILEAAA’)
RIDFLD(REC-KEY)
GTEQ
_______________________________________________________________________________
CICS Training Material Revision 2.0
64
CICS Training Material
_______________________________________________________________________________
END-EXEC.
Browse operation is reset to TRG111. (for the same sample data given for the READ FILE
command)
EXEC CICS
ENDBR FILE(name)
END-EXEC
Exception Conditions : INVREQ ENDBR issued without previous STARTBR
NOTAUTH, FILENOTFOUND
• Several concurrent browse operations can be performed against the same file.
Each browse operation is to be identified by the REQID parameter in the
browse commands.
• Other parameters and options remain the same as for the single browse
operation.
Example
Operation (1)
MOVE ‘ARG’ to REC-KEY-1.
EXEC CICS STARTBR
FILE (‘FILEAAA’)
REQID(1)
RIDFLD(REC-KEY-1)
GTEQ
END-EXEC.
Operation (2)
MOVE ‘BAG’ TO REC-KEY-2.
EXEC CICS STARTBR
FILE (‘FILEAAA’)
REQID(2)
RIDFLD(REC-KEY -2)
GTEQ
END-EXEC.
_______________________________________________________________________________
CICS Training Material Revision 2.0
65
CICS Training Material
_______________________________________________________________________________
Operation (1)
EXEC CICS READNEXT
FILE (‘FILEAAA’)
REQID(1)
INTO(FILE-AREA)
RIDFLD(REC-KEY-1)
END-EXEC.
Operation (2)
EXEC CICS READNEXT
FILE (‘FILEAAA’)
REQID (2)
INTO (FILE-AREA)
RIDFLD(REC-KEY-2)
END-EXEC.
Sample program
Create a VSAM-KSDS data set,record size 80, then use the below metioned CICS program
for writing data on KSDS data set.
_______________________________________________________________________________
CICS Training Material Revision 2.0
67
CICS Training Material
_______________________________________________________________________________
_______________________________________________________________________________
CICS Training Material Revision 2.0
68
CICS Training Material
_______________________________________________________________________________
005720 MOVE NAMER TO NAMEO
005730 MOVE ADDRESSR TO ADDRO
005740 MOVE PHNOR TO PHO
005750 MOVE DOBR TO DOBO
005751 MOVE 'DISPLAYED ' TO MSGO.
005752 EXEC CICS SEND MAPSET('MAPXXX') MAP('HEADER')
005753 FROM (HEADERO)
005754 END-EXEC.
005760 EXEC CICS RECEIVE MAPSET('MAPXXX') MAP('HEADER')
005761 INTO (HEADERI)
005770 END-EXEC.
005800 READPREV-PARA.
005900 EXEC CICS
006000 READPREV
006100 FILE ('TRGXXXF1')
006200 INTO (REC1)
006300 RIDFLD(KEYR)
006400 RESP(WS-RESP)
006500 END-EXEC.
006501 MOVE LOW-VALUES TO HEADERO.
006510 MOVE KEYR TO CODEO
006520 MOVE NAMER TO NAMEO
006530 MOVE ADDRESSR TO ADDRO
006540 MOVE PHNOR TO PHO
006550 MOVE DOBR TO DOBO
006560 MOVE 'DISPLAYED ' TO MSGO.
006561 EXEC CICS SEND MAPSET('MAPXXX') MAP('HEADER')
006562 FROM(HEADERO)
006563 END-EXEC.
006570 EXEC CICS RECEIVE MAPSET('MAPXXX') MAP('HEADER')
006571 INTO (HEADERI)
006580 END-EXEC.
****** **************************** Bottom of Data ****************************
4.3. Exercise
1. (i) Develop the Department Master Maintenance (DMM) transaction,based on the
following specification. File name can be given as Userid.TRG.KSDS(Userid is
Your logon id)
_______________________________________________________________________________
CICS Training Material Revision 2.0
69
CICS Training Material
_______________________________________________________________________________
DEPTNO X(4) Department Number
DESCRPTN X(20) Description
(iii) Upon receiving control again,read the input message and validate the data.If
thefunction(FFF) is invalid or Key (KKKK) not specified ,send error
message and repeat (ii) .
(iv) If the function is ADD,write a dummy record with new department code for
later use ,send a message for add and terminate the task.If error, send error
message & repeat step(ii)
(v) If the function is DEL,deletete the department code entered ,send a
delete message and terminate the task.If error send error message &
repeat step (ii)
(vi) If the function is UPD,read the record for the key and move description field
from input to description field defined in the following screen(if record not
found repeat step (ii) by sending error message )and then send and
receive Description data from the screen as follows
DESCRIPTION DDDDDDDDDDDDDDDDDDDD
.
WHERE DDDDDDDDDDDD: Description data
After receiving the data ,update the record and terminate the task.
(vii) If function is EXT,terminate the task.
_______________________________________________________________________________
CICS Training Material Revision 2.0
70
CICS Training Material
_______________________________________________________________________________
Send instruction message and receive messages as follows
SQL statements can be embedded in the CICS application program to communicate data
requests to the DB2 database. SQLCODEs can be used to determine the result of the
execution of SQL commands. Plan name needs to be predefined in the RCT (Resource
Control Table). This is usually done by system programmers.
We can access DB2 data from CICS programs. When DB2 data is accessed from
CICS, multiple threads can be active simultaneously, enabling concurrent access to
a DB2 subsystem by multiple users of a CICS region. A mechanism called CICS
Attachment Facility connects CICS with DB2. Using this facility, each CICS region
can be connected to only one DB2 subsystem at a time. Each subsystem can,
however, to be connected to more than one CICS region at a time.
_______________________________________________________________________________
CICS Training Material Revision 2.0
71
CICS Training Material
_______________________________________________________________________________
CICS provides an interface to DB2, but DB2 requires its own region independent of
the CICS region. Both CICS and DB2 require its own unique regions under the OS.
CICS application programs can be issue a set of commands for SQL services in
order to access the DB2 database.
Program 1:
000110 ******************************************************************
000113 ******************************************************************
000510 ******************************************************************
000530 * LIBRARY(TRGXXX.DB2.INPUT(THIRD)) *
000540 * ACTION(REPLACE) *
000550 * LANGUAGE(COBOL) *
000560 * QUOTE *
000570 * ... IS THE DCLGEN COMMAND THAT MADE THE FOLLOWING STATEMENTS *
000580 ******************************************************************
000595 ) END-EXEC.
_______________________________________________________________________________
CICS Training Material Revision 2.0
72
CICS Training Material
_______________________________________________________________________________
000596 ******************************************************************
000598 ******************************************************************
000599 01 DCLEMP.
000601 10 ENAME.
000606 ******************************************************************
000608 ******************************************************************
000610 01 HEADERI.
_______________________________________________________________________________
CICS Training Material Revision 2.0
73
CICS Training Material
_______________________________________________________________________________
000798 10 DEPTNOL COMP PIC S9(4).
003600 01 REC1.
004510 SELECT *
004530 END-EXEC.
004700 PARA0.
_______________________________________________________________________________
CICS Training Material Revision 2.0
74
CICS Training Material
_______________________________________________________________________________
008100 EXEC SQL WHENEVER SQLWARNING GOTO DBERROR END-EXEC.
008300 PARA1.
009700 GOBACK.
009800 SEND-MAP.
010100 ERASE
010200 END-EXEC.
010240 * END-EXEC.
010300 DBERROR.
Program 2:
_______________________________________________________________________________
CICS Training Material Revision 2.0
75
CICS Training Material
_______________________________________________________________________________
000110 *********************************************************************************************
000112 * A TABLE AND THEN DISPLAYING ALL THE RECORDS THROUGH CICS. *
000113 **********************************************************************************************
000510 ****************************************************************************************
000560 * QUOTE *
000580 *****************************************************************************************
000595 ) END-EXEC
000596 *********************************************************************************************
000598 ******************************************************************
000599 01 DCLEMP.
000601 10 ENAME.
_______________________________________________________________________________
CICS Training Material Revision 2.0
76
CICS Training Material
_______________________________________________________________________________
000603 49 ENAME-TEXT PIC X(20).
000606 ******************************************************************
000608 ******************************************************************
000610 01 HEADERI.
_______________________________________________________________________________
CICS Training Material Revision 2.0
77
CICS Training Material
_______________________________________________________________________________
002200 10 FILLER PIC X(3).
003000 01 REC.
003200 10 ENAMER.
004510 SELECT *
004530 END-EXEC.
004700 PARA0.
_______________________________________________________________________________
CICS Training Material Revision 2.0
78
CICS Training Material
_______________________________________________________________________________
008210 PERFORM PARA2.
008300 PARA1.
009700 GOBACK.
009800 SEND-MAP.
010100 ERASE
010200 END-EXEC.
010240 * END-EXEC.
010300 DBERROR.
010600 PARA2.
_______________________________________________________________________________
CICS Training Material Revision 2.0
79
CICS Training Material
_______________________________________________________________________________
010710 MOVE LOW-VALUES TO HEADERI.
010900 ERASE
011000 END-EXEC.
011200 END-EXEC.
011900 END-EXEC.
_______________________________________________________________________________
CICS Training Material Revision 2.0
80
CICS Training Material
_______________________________________________________________________________
000480 BIND PLAN(TRGXXXP1) -
000490 MEMBER(TRGXXXC1) -
000500 VALIDATE(BIND) -
000510 ISOLATION(CS) -
000520 RELEASE(C) -
000530 EXPLAIN(NO)-
000540 OWNER(TRGXXX)-
000550 LIB('TRGXXX.DBRMLIB.DATA')
000580 /*
000590 //o
4.5 PRECOMPILATION
Pre-compiler Functions:
OUTPUT
Modified source
DCLGEN
_______________________________________________________________________________
CICS Training Material Revision 2.0
81
CICS Training Material
_______________________________________________________________________________
COPYLIBS
Process:
Process:
OUTPUT PLAN
Function:
Reads the SQL statements from DBRMs and produces a mechanism to access data
from tables.
1. Owner, Qualifier
2. Action (REPLACE/ADD)
3. Isolation (CS/RR)
_______________________________________________________________________________
CICS Training Material Revision 2.0
82
CICS Training Material
_______________________________________________________________________________
4. Acquire (USE/DEALLOCATE)
5. Release (COMMIT/DEALLOCATE)
6. Validate (BIND/RN)
7. Explain
8. Flag.
Owner:
Qualifier:
Action:
Isolation:
This determines the mode of page locking implemented by the programs as it runs.
CS – Cursor Stability:
Releases the page locks as soon as another page is accessed or an COMMIT is
issued. Improves concurrency.
RR – Repeatable Read (DEFAULT):
Releases the page locks until a COMMIT is issued.
Acquire:
This determines the mode of table space locking implemented by the program as it
runs.
Use:
Table space locks are acquired when the table space is accessed.
Allocate:
Release:
Commit:
Table space locks are released at COMMIT or ROLLBACK time.
Deallocate:
_______________________________________________________________________________
CICS Training Material Revision 2.0
83
CICS Training Material
_______________________________________________________________________________
Table space locks are released only when the plan finishes and is deallocated.
Validate:
Method of checking for the existence and validity for DB2 access tables and
authorization
Bind – Validates at Bind time itself
Run – Validates at run time.
Flag:
_______________________________________________________________________________
CICS Training Material Revision 2.0
84
CICS Training Material
_______________________________________________________________________________
To know about
• CICS Queues
CICS offers two facilities to store data that are temporary in nature. The data can be
collected by 1 or more online transactions, to be used later by the same transaction or by a
different transaction or even passed to a batch program. These queues are Transient Data
Queues(TDQ) and Temporary Storage Queues( TSQ).
_______________________________________________________________________________
CICS Training Material Revision 2.0
85
CICS Training Material
_______________________________________________________________________________
_______________________________________________________________________________
CICS Training Material Revision 2.0
86
CICS Training Material
_______________________________________________________________________________
EXEC CICS
WRITEQ TD QUEUE(name)
FROM(data-area)
[LENGTH(data-value)]
END-EXEC
QUEUE: The name is upto four characters, and defined in the DCT
LENGTH: Specifies length of record to be written. Required for variable length records.
_______________________________________________________________________________
CICS Training Material Revision 2.0
87
CICS Training Material
_______________________________________________________________________________
5.3.5. Transient Data Input
EXEC CICS
READQ TD QUEUE(name)
INTO(data-value)
[LENGTH(data-value)]
END-EXEC
EXEC CICS
DELETEQ TD QUEUE(name)
END-EXEC
LENGERR Length specified in output is greater than the maximum record size
allowed in the DCT.
Length option is not coded for variable length record
Record length longer than length specified for input area.
QZERO The queue is empty, meaning end of file on a READQ.
INVREQ READQ attempts to read a queue opened for output. (cannot occur for
extrapartition queue)
WRITEQ attempts to write to queue opened for input. (cannot occur for intrapartition
queue)
DELETEQ attempts to delete an Extrapartition queue.
NOSPACE No space in the Intrapartition TDQ for a WRITEQ command.
NOTOPEN Destination is closed. (only for extrapartition queue)
QBUSY READQ attempts to access a record in an Intrapartition TDQ that is being
written to or deleted by another task. The task waits until the queue is no
longer being used for output.
IOERR Input/Output error on the queue.
QIDERR The Dest-Id specified cannot be found in DCT.
_______________________________________________________________________________
CICS Training Material Revision 2.0
88
CICS Training Material
_______________________________________________________________________________
5.4. Temporaty Storage Queue(TSQ)
Temporary Storage Queue (TSQ) is a queue used to store data records by a CICS
application program. The temporary Storage Program (TSP) provides the capability to store
and retrieve data in TSQ.
In order to avoid confusion and to maintain data security, a naming convention will be
required.
E.g DTTTTANN
where D Division (‘A’ for accounts, ‘B’ for budget’, etc)
TTTT Terminal id(EIBTRMID)
A Application code ( A, B, C ...)
NN Queue no. ( 1, 2, 3 ...)
5.4.2. WRITEQ TS
EXEC CICS
WRITEQ TS QUEUE(name)
FROM(data-area)
[LENGTH(data-value)]
[ITEM(data-area)]
[REWRITE ]
[MAIN / AUXILLARY]
END-EXEC
_______________________________________________________________________________
CICS Training Material Revision 2.0
89
CICS Training Material
_______________________________________________________________________________
REWRITE Used to rewrite the record identified by ITEM.
MAIN / AUXILIARY To specify the storage medium. Main storage or VSAM dataset .
5.4.3. READQ TS
EXEC CICS
READQ TS QUEUE(name)
INTO(data-area)
[LENGTH(data-value)]
[ITEM(data-value) / NEXT]
[NUMITEMS(data-area)]
END-EXEC
EXEC CICS
DELETEQ TS QUEUE(name)
END-EXEC
ITEMERR Item number specified is invalid, or attempt made to read beyond the
end of the queue by the NEXT option.
LENGERR Length specified is greater than the maximum record length.
NOSPACE Sufficient space not available in temporary storage.
IOERR Irrecoverable I/O error
QIDERR Specified queue id is not present.
_______________________________________________________________________________
CICS Training Material Revision 2.0
90
CICS Training Material
_______________________________________________________________________________
BROWSING CICS QUEUE
• 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.
_______________________________________________________________________________
CICS Training Material Revision 2.0
91
CICS Training Material
_______________________________________________________________________________
007200 MOVE SPACES TO FILLER1.
007300 MOVE NAMEI TO NAMER.
007400 MOVE ADDRI TO ADDRESSR.
007500 MOVE PHI TO PHNOR.
007600 MOVE DOBI TO DOBR.
007700 MOVE CODEI TO REC-KEY KEYR.
007800 EXEC CICS WRITEQ TS
007900 QUEUE('TRGXXXF')
008000 FROM (REC1)
008100 RESP(WS-RESP)
008200 MAIN
008300 END-EXEC.
008400 IF WS-RESP = DFHRESP(NORMAL)
008500 CONTINUE
008600 ELSE
008700 EXEC CICS
008800 SEND TEXT FROM(WS-ERR-MSG)
008900 LENGTH(LENGTH OF WS-ERR-MSG)
009000 END-EXEC.
009100 RETURN-TRANS.
009200 EXEC CICS
009300 RETURN TRANSID('GCXX')
009400 COMMAREA(COMMAREA)
009500 LENGTH(LENGTH OF COMMAREA)
009600 END-EXEC.
009700 RETURN-PARA.
009800 EXEC CICS RETURN END-EXEC.
009900 GOBACK.
****** **************************** Bottom of Data ****************************
EXERCISE
(i) Create a ESDS DATASET & Using TSQ Commands provide for
addition,deletion,updation as per the example given at the end of chapter 4.
_______________________________________________________________________________
CICS Training Material Revision 2.0
92
CICS Training Material
_______________________________________________________________________________
APPENDIX
A. COMMON ABEND CODES
Abend codes are generated by the occurrence of some Exception Conditions on
excecuting CICS commands. The most common way of overcoming these abends is to
code HANDLE CONDITIONS for these conditions in the program, and also check the
program carefully for any other possible errors. Most of these errors occur during file
handling or due to data exception error.
ABM0 Mapname could not be found
User Action : Correct the program so that it supplies a valid mapname to BMS, and check
that the map actually exists.
AEIA ERROR condition was raised by one of the CICS commands
AEID EOF condition was raised
AEIL DSIDERR error condition was raised
AEIM NOTFND error condition was raised
AEIQ IOERR error condition was raised
AEIR NOSPACE error condition was raised
AEIO DUPKEY error condition was raised
AEIP INVREQ error condition was raised
AEIS NOTOPEN error condition was raised
AEIT ENDFILE error condition was raised
AEIV LENGERR error condition was raised
AEIZ ITEMERR error condition was raised
AEI0 PGMIDERR error condition was raised
AEI2 ENDDATA error condition was raised
AEIW QZERO error condition was raised
AEI1 TRANSIDERR error condition was raised
AEI8 MAPFAIL error condition was raised
AEI9 MAPFAIL error condition was raised
AEXL DISABLED error condition was raised
AEYH QIDERR error condition was raised
AEY7 NOTAUTH error condition was raised
APCT An application program could not be found in the PPT when it was needed.
Another possible cause is that the entry is in the PPT but is disabled, or the
program itself has a zero length.
User Action: Check if the name of the program is correct. If the program is
available, try issuing NEWCOPY command again for it.
ASRA This abend is issued by CICS when it traps a program check suffered by an
application program. Examples of program checks that can cause an ASRA
abend are 0C4's and 0C7's.
User Action: Check if any invalid move or other invalid statements have been
coded in the program. Correct the program and try again. Most of the time, it
is a program error.
_______________________________________________________________________________
CICS Training Material Revision 2.0
93
CICS Training Material
_______________________________________________________________________________
ASRB This abend is issued by CICS when it traps an MVS abend that occurred
during the life of an application task. Examples of abends that can cause an
ASRB abend are S213's, S013, etc.
_______________________________________________________________________________
CICS Training Material Revision 2.0
94
CICS Training Material
_______________________________________________________________________________
B. JCL
JCL for translate, compile & linkedit - CICS COBOL program
_______________________________________________________________________________
CICS Training Material Revision 2.0
95
CICS Training Material
_______________________________________________________________________________
003900 //* including what to do if your program contains calls to
004000 //* the common programming interface.)
004100 //*
004200 //TRN EXEC PGM=DFHECP&SUFFIX,
004300 // PARM='COBOL2',
004400 // REGION=®
004500 //STEPLIB DD DSN=&INDEX..SDFHLOAD,DISP=SHR
004600 //SYSPRINT DD SYSOUT=&OUTC
004700 //SYSPUNCH DD DSN=&&SYSCIN,
004800 // DISP=(,PASS),UNIT=&WORK,
004900 // DCB=BLKSIZE=400,
005000 // SPACE=(400,(400,100))
005100 //*
005200 //COB EXEC PGM=IGYCRCTL,REGION=®,
005300 // PARM='NODYNAM,LIB,OBJECT,RENT,RES,APOST,MAP,XREF'
005400 //*STEPLIB DD DSN=&COMPHLQ..COB2COMP,DISP=SHR
005500 //STEPLIB DD DSN=&COMPHLQ..SIGYCOMP,DISP=SHR
005600 //SYSLIB DD DSN=&DSCTLIB,DISP=SHR
005700 // DD DSN=&INDEX..SDFHCOB,DISP=SHR
005800 // DD DSN=&INDEX..SDFHMAC,DISP=SHR
005900 // DD DSN=&INDEX..SDFHSAMP,DISP=SHR
006000 //SYSPRINT DD SYSOUT=&OUTC
006100 //SYSIN DD DSN=&&SYSCIN,DISP=(OLD,DELETE)
006200 //SYSLIN DD DSN=&&LOADSET,DISP=(MOD,PASS),
006300 // UNIT=&WORK,SPACE=(80,(250,100))
006400 //SYSUT1 DD UNIT=&WORK,SPACE=(460,(350,100))
006500 //SYSUT2 DD UNIT=&WORK,SPACE=(460,(350,100))
006600 //SYSUT3 DD UNIT=&WORK,SPACE=(460,(350,100))
006700 //SYSUT4 DD UNIT=&WORK,SPACE=(460,(350,100))
006800 //SYSUT5 DD UNIT=&WORK,SPACE=(460,(350,100))
006900 //SYSUT6 DD UNIT=&WORK,SPACE=(460,(350,100))
007000 //SYSUT7 DD UNIT=&WORK,SPACE=(460,(350,100))
007100 //*
007200 //COPYLINK EXEC PGM=IEBGENER,COND=(7,LT,COB)
007300 //SYSUT1 DD DSN=&INDEX..&LIB(&STUB),DISP=SHR
007400 //SYSUT2 DD DSN=&©LINK,DISP=(NEW,PASS),
007500 // DCB=(LRECL=80,BLKSIZE=400,RECFM=FB),
007600 // UNIT=&WORK,SPACE=(400,(20,20))
007700 //SYSPRINT DD SYSOUT=&OUTC
007800 //SYSIN DD DUMMY
007900 //*
008000 //LKED EXEC PGM=IEWL,REGION=®,
008100 // PARM='&LNKPARM',COND=(5,LT,COB)
008410 //SYSLIB DD DISP=SHR,DSN=CEE.SCEELKED
008420 // DD DISP=SHR,DSN=IGY.V2R1M0.AIGYMOD1
008430 // DD DSN=&INDEX..SDFHLOAD,DISP=SHR
008500 //*SYSLMOD DD DSN=&PROGLIB,DISP=SHR
008600 //SYSUT1 DD UNIT=&WORK,DCB=BLKSIZE=1024,
008700 // SPACE=(1024,(200,20))
008800 //SYSPRINT DD SYSOUT=&OUTC
008900 //SYSLIN DD DSN=&©LINK,DISP=(OLD,DELETE)
009000 // DD DSN=&&LOADSET,DISP=(OLD,DELETE)
009100 // DD DDNAME=SYSIN
_______________________________________________________________________________
CICS Training Material Revision 2.0
96
CICS Training Material
_______________________________________________________________________________
****** **************************** Bottom of Data ********
_______________________________________________________________________________
CICS Training Material Revision 2.0
97
CICS Training Material
_______________________________________________________________________________
JCL for generation of Physical Map
_______________________________________________________________________________
CICS Training Material Revision 2.0
98
CICS Training Material
_______________________________________________________________________________
000260 //SYSUT1 DD DSN=&&SYSUT1,SPACE=(4096,(120,120),,,ROUND),
000270 // UNIT=SYSALLDA,DCB=BUFNO=1
000280 //SYSPRINT DD SYSOUT=*
000290 //SYSLIN DD DUMMY
****** **************************** Bottom of Data ****************************
_______________________________________________________________________________
CICS Training Material Revision 2.0
99
CICS Training Material
_______________________________________________________________________________
Two CICS Copy Library members which are commonly copied into the CICS application
programs are DFHEIBLK and DFHBMSCA which contain the Execute Interface Block(EIB)
and attribute characters respectively .
DFHEIBLK Member
The DFHEIBLK member is a set of field definitions of the Execute Interface Block .It is
copied automatically into the application programme by the CICS command translator and
COBOL Compiler. i.e Programmer don’t need to include COPY statement for DFHEIBLK as
‘COPY DFHEIBLK ‘ in his application program. When CICS activates the application
program,it places the proper value into the corresponding EIB fields and the values will be
updated as the program is executed.Some of the list of EIB fields included in the
DFHEIBLK are listed below.
Time of the day when the task is started and updated when the task is initiated.
May be updated by the program with the ASKTIME command
Date tge task started and updated when the task is initiated
May be updated by the program with the ASKTIME command
This number appears in trace table entries generated while the task is in control
The symbolic terminal identifier of the terminal or its logical unit associated with the task
Updated when the task is initiated
The cursor address (position) on the screen associated with the last terminal or BMS
operation from a display device such as the 3270 type terminals.
Length of the communication area passed to the application program from the previous
program, through LINK or XCTL command with the COMMAREA and LENGTH options
Contains zero when no communication area is passed
Updated when the program first executes within a task
_______________________________________________________________________________
CICS Training Material Revision 2.0
100
CICS Training Material
_______________________________________________________________________________
Response code returned by the last CICS command issued by the task.
Updated when the sevice corresponding to the command has been completed
Used for debugging similar to EIBFN
The symbolic identifier of the last dataset referred to in a File Control command
Used for debugging programs aborted due to file errors
DFHBMSCA Member
An application programmer must issue the COPY statement in order to include the
member in program..The DFHBMSCA Copy Library member contains some of the following
list of character definitions and their characteristics.
_______________________________________________________________________________
CICS Training Material Revision 2.0
101
CICS Training Material
_______________________________________________________________________________
DFHBMPRO Protected ‘.’ 60
DFHBMBRY Bright ‘H’ C8
DFHUNIMD Unprotected,intensify,light pen
Detectable,MDT on ‘I’ C9
DFHUNNUM Unprotected,numeric,MDT on ‘J’ D1
DFHUNINT Unprotected,intensify,light pen
Detectable,MDT on ‘R’ D9
_______________________________________________________________________________
CICS Training Material Revision 2.0
102