CICS TS Application Programming Guide
CICS TS Application Programming Guide
CICS TS Application Programming Guide
SC09-4460-03
SC09-4460-03
Note
Before using this information and the product it supports, be sure to read the general information under Notices on page
287.
Contents
Figures . . . . . . . . . . . . . . vii
Tables . . . . . . . . . . . . . . . ix
About this book . . . . . . . . . . . xi
Who should read this book .
Document organization . .
How to send your comments
Conventions used in this book
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. xi
. xi
. xii
. xii
. 3
. 3
. 3
. 3
. 4
. 5
. 5
. 7
. 8
. 9
. 10
11
. 11
. 12
. 13
. 14
. 15
. 16
. 16
. 16
. 17
. 18
. 18
. 18
. 20
20
. 20
. 20
. 21
22
. 25
. 31
. 36
. 38
. 42
|
|
|
42
45
46
46
46
49
49
49
49
49
50
50
51
52
52
53
53
53
55
55
55
55
56
56
56
57
57
58
58
59
59
59
60
60
61
61
62
62
62
62
62
63
63
63
63
iii
64
64
64
65
65
65
66
66
66
66
|
|
|
|
|
101
iv
101
101
102
103
103
105
105
105
107
120
130
130
133
137
138
139
140
141
142
145
151
|
|
. 157
. 159
. 161
. 164
173
173
173
174
174
175
175
175
179
179
180
181
181
181
182
183
183
184
184
185
185
186
186
187
187
.
.
.
.
.
.
191
191
191
194
195
196
197
. 198
. 198
. 198
.
.
.
.
.
199
201
201
202
205
213
213
214
214
214
215
215
216
217
218
218
218
219
219
220
222
225
226
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
244
246
247
247
250
251
251
252
. 253
. 253
. 254
. 254
. 254
. 255
. 255
. 255
. 256
. 257
. 258
. 263
. 263
. 269
228
229
229
231
Abend handling . . . . . .
Coding considerations for recovery
Debugging services . . . . . .
Using the API for trace services .
Dump . . . . . . . . . .
Performance monitoring services . .
The monitoring service . . . .
Statistics services . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
233
233
234
237
239
242
242
. 243
.
.
.
.
.
.
.
.
.
.
.
.
. 276
. 278
. 281
Bibliography . . . . . . . . . . . . 285
Notices . . . . . . . . . . . . . . 287
Trademarks and service marks
. 288
Index . . . . . . . . . . . . . . . 291
Contents
vi
Figures
1.
2.
3.
4.
. 39
. 39
. 70
. 71
5.
6.
7.
8.
9.
10.
vii
viii
Tables
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
| 33.
|
| 34.
|
| 35.
|
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
. 117
. 118
.
.
.
.
118
119
119
139
145
. 149
. 157
. 160
. 163
. 170
. 171
189
211
. 214
. 214
. 215
216
. 219
231
. 281
. 282
ix
Document organization
Table 1. Road map for the CICS Application Programming Guide book
If you want to...
Refer to...
xii.
xi
This book contains information about all TXSeries CICS products. Where the
information is different for a specific operating system, it is presented as follows:
v If the information is brief, the information is qualified by the product name in
line with the text, usually in a list or enclosed in parenthesis. Refer to the
following example:
/usr/lpp/cics on AIX
/opt/cics on HP-UX
/opt/cics on Solaris.
v If the information is more that a few words, but smaller than a page, it is
presented as shown:
Meaning
Bold
Indicates values you must use literally, such as commands, functions, and resource
definition attributes and their values. When referring to graphical user interfaces
(GUIs), bold also indicates menus, menu items, labels, buttons, icons, and folders.
Monospace
Indicates text you must enter at a command prompt. Monospace also indicates screen
text and code examples.
Italics
Indicates variable values you must provide (for example, you supply the name of a file
for file_name). Italics also indicates emphasis and the titles of books.
<>
<Ctrl-x>
<Return>
Refers to the key labeled with the word Return, the word Enter, or the left arrow.
Represents the UNIX command-shell prompt for a command that does not require
root privileges.
Represents the UNIX command-shell prompt for a command that requires root
privileges.
C:\>
>
When used to describe a menu, shows a series of menu selections. For example, Select
File > New means From the File menu, select the New command.
xii
Meaning
Entering commands
When instructed to enter or issue a command, type the command and then press
<Return>. For example, the instruction Enter the ls command means type ls at a
command prompt and then press <Return>.
[]
{}
Enclose lists from which you must choose an item in syntax descriptions.
...
Ellipses in syntax descriptions indicate that you can repeat the preceding item one or
more times. Ellipses in examples indicate that information was omitted from the
example for the sake of brevity.
IN
In function descriptions, indicates parameters whose values are used to pass data to
the function. These parameters are not used to return modified data to the calling
routine. (Do not include the IN declaration in your code.)
OUT
INOUT
In function descriptions, indicates parameters whose values are passed to the function,
modified by the function, and returned to the calling routine. These parameters serve
as both IN and OUT parameters. (Do not include the INOUT declaration in your code.)
Indicates the full path name where the CICS product is installed; for example,
C:\opt\TXSeries\cics on Windows or /opt/cics on Solaris. If the environment
variable named CICS is set to the product path name, you can use the examples
exactly as shown; otherwise, you must replace all instances of $CICS with the CICS
product path name.
| $CICS
|
|
|
|
CICS on Open Systems
| TXSeries CICS
|
CICS
Refers collectively to the CICS product for all supported UNIX platforms.
Refers collectively to the CICS for AIX, CICS for HP-UX, CICS for Solaris, and CICS
for Windows products.
Refers generically to the CICS on Open Systems and CICS for Windows products.
References to a specific version of a CICS on Open Systems product are used to
highlight differences between CICS on Open Systems products. Other CICS products
in the CICS Family are distinguished by their operating system (for example, CICS for
OS/2 or IBM mainframe-based CICS for the ESA, MVS, and VSE platforms).
xiii
xiv
Refer to...
application programs, including interfaces to files and database products. The CICS
family has a long history and wide acceptance in transaction processing. The key
features of the CICS family are the common application programming interface
and easy-to-use communications. These allow significant source compatibility and
access to data and services across CICS systems. The members of the CICS family
satisfy these requirements in various ways.
The CICS family members are often grouped when describing common
characteristics. Those groups are:
v IBM CICS for Windows
v CICS on Open Systems
CICS for AIX offers CICS capabilities for transaction processing on the IBM
RISC System/6000, the IBM workstation for scientific and commercial
applications.
IBM CICS for HP-UX offers CICS capabilities for transaction processing on
Hewlett-Packards HP 9000 Series 800 Corporate Business Servers.
CICS for Solaris offers CICS capabilities for transaction processing on the
SUN Solaris Operating Environment.
v IBM mainframe-based CICS
CICS for MVS/ESA for the MVS/ESA environment provides transaction
processing for large mainframe centers and for large distributed sites.
CICS/MVS for the MVS/XA and MVS/ESA environments also provides
transaction processing for the large mainframe center.
CICS/VSE for the VSE/ESA environment provides transaction processing for
the intermediate central site as well as distributed user locations requiring
volume transaction processing.
CICS/DOS/VS for the VSE/SP environment provides transaction processing
for small- to medium-sized businesses.
The following CICS products are also available:
v CICS/400 for the OS/400 environment provides CICS capabilities for online
transaction processing on the AS/400, the IBM midrange processor for business
and commercial applications.
v CICS OS/2 provides CICS capabilities for transaction processing on PCs running
OS/2. It also provides transaction processing for the distributed location where
the PC can access data locally or at the mainframe.
See CICS Family: API Structure and CICS Family: Interproduct Communication for
related information.
The processing done by the transaction processing system can be grouped into
logical units of work (LUWs). Each LUW is a set of related changes to data. For
example, in an accounting system, one LUW comprises updating accounts payable,
updating the books, and creating a check. The work performed by each LUW is
completely separate from the work performed by any other LUW. If the LUW
changes multiple resources they are either all changed successfully or none of them
are. The transaction processing system ensures that, when there are multiple users
accessing the resources, the partial changes made in one LUW are not made
available to other users until the LUW is completed. Once an LUW has been
completed, its changes are permanent.
For more information on transaction processing, see Concepts and Planning.
The program source file is then translated (using the cicstran program) prior to
being compiled, though translation and compilation can be done in one step with
the cicstcl command. See Chapter 8, Translating, compiling, and link-editing CICS
application programs, on page 213 for more information.
CICS on Open Systems and CICS for Windows support various compilers and
languages.
Chapter 1. Introduction to CICS application programming
v Use distributed program link (DPL) to call CICS programs on other systems.
v Access resources on other CICS systems with function shipping or distributed
transaction processing (DTP).
The ECI consists of three types of calls:
1. Program link calls that cause a CICS program to be executed on a CICS server.
2. Status information calls that retrieve status information about the application
and its connection to the CICS server.
3. Reply solicitation calls that retrieve information after asynchronous program
link or asynchronous status information calls.
Also available with the ECI is the ability to retrieve information about available
servers to which the calls are directed.
Note: The term program can have different meanings in different contexts.
Therefore, the terms CICS program, application program, executable, COBOL
program, and loadable object are used when the use of program is otherwise
misleading or unclear.
Transaction scheduler
This CICS component is responsible for scheduling and dispatching the transaction
to be run. Each user, device and transaction has an associated priority; when you
submit a transaction the scheduler computes an overall priority for it which it uses
to prioritize requests in times of heavy demand. When able to do so, it dispatches
the transaction request to an available application server for processing.
The scheduler communicates with the application server and the CICS on Open
Systems client. The scheduler, as the controller of the overall workload, also
controls the number of application servers in the region.
Application servers
An application server is a multi-threaded CICS process providing a complete
environment for running a CICS transaction. If your transaction is conversational,
it will be processed by exactly one application server, but if it is
pseudoconversational each transaction in the sequence may in turn be executed by
a different server.
When you configure CICS, you specify the minimum and maximum number of
servers for your region. The transaction scheduler ensures that this minimum
number is always present, and creates and destroys servers up to the defined
maximum number depending on the overall workload.
All the application servers in the pool have to be located on the same node, but do
not need to be on the same node as the CICS on Open Systems client. They
communicate with each other using signals and shared memory, and use RPCs to
communicate with the other components of the region.
10
begins execution. This applies irrespective of the language the program is written
in. Programs produced by the supported compilers are shared automatically
between multiple application servers on the same machine. A copy of the program
is loaded by each application server that is requested to run it.
11
12
and some standard function (see BMS functions supported in CICS on page 72).
This allows you to code source maps that describe the prompts and inputs on your
screen, which you process using the BMS processor. You then code CICS
commands in your application to send and receive these maps to and from the
terminal. The commands you can use for this purpose are:
v SEND TEXT
v SEND CONTROL
v SEND MAP
v HANDLE AID
v RECEIVE MAP
See Basic mapping support (BMS) services on page 71 for information on these
commands.
File services
CICS allows you to access user files managed by an Encina Structured File Server
(SFS) as VSAM files. VSAM refers to the Virtual Storage Access Method that provides
direct or sequential processing of fixed- and variable-length records on direct
access devices.
For more information about how CICS accesses SFS files as VSAM files, see
VSAM emulation by SFS and distributed CICS on page 108 and for more
information about how CICS accesses DB2 files as VSAM files, see VSAM
emulation by DB2 and distributed CICS on page 113.
SFS files support keyed, sequential, and relative access. Files can be defined as
recoverable or non-recoverable. CICS cooperates with SFS to provide the
transactional properties for accessing recoverable files.
In addition to the usual file facilities that allow you to read from, write to, and
delete a file, CICS provides a file browse function. You select the record at which
you want the browse to start. You can then read each record in the file in turn,
either forwards or backwards through the file.
13
Queue services
CICS provides some special storage areas of its own, called transient data queues
and temporary storage queues. The transient data service handles queues of data to
be sent to terminals, such as printers, and to sequential files. The temporary storage
service provides an internal scratchpad. Both of these storage types can be made
recoverable.
Journal services
CICS provides facilities for creating and managing journals. A journal is a set of
special-purpose sequential files and may be used, for example, to keep an audit
trail or system log.
See also the CICS Application Programming Reference.
Timer services
Timer services are provided that enable you to start and control transactions. The
commands are:
v ASKTIME
v CANCEL
v DELAY
v FORMATTIME
v RETRIEVE
v START
v SUSPEND
These commands are discussed in Timer services on page 179.
Synchronization services
Synchronization services enable serialized access to resources. The commands are:
v DEQ
v ENQ
These commands are discussed in Synchronization services on page 181.
14
Storage services
Storage areas and commands that manage task storage are provided. The
commands are:
v ADDRESS
v FREEMAIN
v GETMAIN
v LOAD
v RELEASE
These commands are discussed in Storage services on page 182.
Configuration services
Commands are available to enquire upon and dynamically configure CICS runtime
resource definitions, such as files and transactions. The commands you can use for
this purpose are:
v ASSIGN
v INQUIRE and SET
These commands are discussed in Configuration services on page 186.
Refer to the CICS Administration Reference and the CICS Application Programming
Reference for additional guidance information on the use of INQUIRE and SET.
15
Error handling
As described in Error-handling services on page 233, a number of commands
allow you to handle exception conditions that might arise during the running of
your applications. Those commands are:
v ABEND
v HANDLE ABEND
v HANDLE CONDITION
v IGNORE CONDITION
v POP HANDLE
v PUSH HANDLE
Debugging services
As described in Chapter 9, Coding for problem determination, on page 233,
commands are available to help you debug application programs. The commands
are:
v TRACE
v ENTER
v DUMP
Performance monitoring
As described in Performance monitoring services on page 251, commands are
available to help you analyze the performance of your system and of individual
transactions, thereby helping to determine problems. The commands used for this
are:
v COLLECT STATISTICS
v ENTER
v INQUIRE STATISTICS
v PERFORM STATISTICS RECORD
v SET STATISTICS
16
Alternatively, you can request that your source program is translated, compiled,
and link-edited in one step cicstcl. The advantage of using this alternative is that
CICS uses the correct compilers and sets up the options required by CICS for
translation.
The IBM PL/I compiler has an integrated CICS processor. This means that it is
unnecessary (and indeed not possible) to run a separate CICS translator step for
CICS programs written in IBM PL/I. You should therefore only use either cicstcl or
the IBM PL/I invoked directly and not attempt to use cicstran.
Chapter 8, Translating, compiling, and link-editing CICS application programs,
on page 213 provides full details.
|
|
The Animator tool enables you to test a Micro Focus Server Express COBOL or
Micro Focus Net Express COBOL application program online without modifying
the program. This tool intercepts execution of the application program at various
points before displaying information about the program. Any screens sent by the
application program are displayed by the tools, so that you can converse with the
application program during testing just as you would on the production system.
See Using a compilers integrated debugging tool to debug CICS applications on
page 263.
You can also debug C, C++, and IBM COBOL programs by using debugging
services provided by the relevant compiler. See Using debugging tools integrated
with compilers running on CICS for Windows on page 263.
CICS also provides supplied transactions CECI and CECS for the interpretive
execution and syntax checking of commands. See Using Command Level
Interpreter (CECI) and Syntax Checker (CECS) on page 256.
17
18
19
A sample transaction
This information shows you how to write a simple CICS transaction that sends a
message to your terminal. Use this exercise to perform a simple test of your system
and to become familiar with some of the CICS application programming concepts.
On CICS for Windows, you can also refer to the Installation Verification Programs
(IVP), which can be found in opt\cics\samples\IVP. The IVP programs are
documented in Planning and Installation Guide.
20
21
22
You can use the dynamic load facility for functions within your program. If you
have a function that is common to several programs, then you can minimize your
storage requirements by making it shared and dynamically loadable.
CICS links to the dynamic load facility through the cicstcl utility. The following
command example displays the command on the AIX platform.
23
the caller, or it can be dynamically loaded. Statically linking in the called program
is faster but inflexible; dynamically loading a called program can be slower but
more flexible.
Furthermore, by dynamically loading a called program, you can arrange for the
called program to be shared. In this instance, the first call to it will be
comparatively slow, but subsequent calls will be faster while it remains loaded.
You should be aware that when you take this approach you are not descending a
CICS logical level. (See Application program logical levels on page 174.)
Finally, in designing your COBOL applications, avoid recursion. COBOL products
used with TXSeries CICS other than Micro Focus Server Express COBOL (on Open
Systems) and Micro Focus Net Express (on Windows) provide only a limited
support for recursion. For example, a COBOL program can be coded in such a way
that it can use EXEC CICS LINK to directly LINK to itself, but a set of COBOL
programs cannot be coded to indirectly LINK recursively. In an example of two
programs, progA and progB, progA can directly LINK to itself (provided it has
been coded to do so), but progA cannot LINK to progB and then have progB LINK
back to progA.
If you are using Micro Focus Server Express COBOL or Micro Focus Net Express,
you can use recursion using EXEC CICS LINK and EXEC CICS XCTL. You must
specify the /DATA-CONTEXT flag when you compile the COBOL programs. Each
time the program is called, it gets a new copy of working storage.
24
When using CICS statements in class templates, the statements must be translated
before the template class definition is included in any program. In header files,
avoid using CICS statements in inline functions and methods.
Perform all initialization of static objects in CICS C++ cached programs in the
object constructors, since they are initialized only once.
Explicitly delete any dynamically allocated storage.
Note: Do not use CICS statements in static object constructors or destructors. Static
constructors and destructors are called outside a CICS Logical Unit of Work,
and so using CICS statements at these points can cause abends.
25
All of these areas are main storage facilities and come from the same basic source:
the task private pool of the application server. (See Application servers on page
10) None of them are recoverable, and none can be protected by resource-level
security keys. They differ, however, in accessibility and duration and, therefore,
each meets a different set of storage needs. The TIOA is a storage area that is
associated with a terminal, and is allocated from the task shared pool.
|
|
Transaction work area (TWA): The size of the transaction work area is
determined by the TWASize option in the Transaction Definitions (TD). If this is
given a non-zero value, the TWA is always allocated, it lasts for the entire duration
of the transaction, and it is accessible to all of the programs in the transaction.
Processor overhead associated with using the TWA is minimal. You do not need an
EXEC CICS GETMAIN command to access it, and you address it using a single
EXEC CICS ADDRESS command.
The TWA is suitable for fairly small data storage requirements and for larger
requirements that are both relatively fixed in size and are used more or less for the
duration of the transaction. Because the TWA exists for the entire transaction, a
large TWA size has much greater benefit for conversational than for
pseudoconversational transactions.
User storage acquired by GETMAIN without SHARED option: User storage is
available to all the programs in a transaction, but some effort is required to pass it
across an EXEC CICS LINK or EXEC CICS XCTL. However, its size is not fixed,
and it can be obtained (using EXEC CICS GETMAIN commands) just when the
transaction requires it and returned as soon as it is no longer needed.
Consequently, user storage is useful for large storage requirements that either are
variable in size or have a shorter duration than the transaction. This storage is
freed at task termination if it is not explicitly freed by the transaction or is shared
storage.
An EXEC CICS GETMAIN command involves a large amount of processor
overhead. Therefore, use it only for large amounts of storage. For smaller storage
amounts, use the TWA , or group the requests together into a larger request.
Although the storage acquired by an EXEC CICS GETMAIN command may be
held somewhat longer when using combined requests, the processor overhead and
the reference set size are both reduced.
|
|
|
|
|
26
if the program has already been invoked. In C and C++, recursive invocations of a
program in the same transaction share one copy of its statics and external data.
27
specifically designed for relatively large amounts of data that have a relatively
long lifetime or are accessed infrequently.
v You can make queues in auxiliary storage recoverable, but not queues in main
storage.
Only one transaction at a time can update a recoverable temporary storage
queue. If you choose to make queues recoverable, bear in mind the possibility of
enqueues.
v If a task tries to write to temporary storage and there is no space available, CICS
suspends it. The task is not resumed until some other task frees the necessary
space in the file. This can produce unexplained response delays, especially if the
waiting task owns exclusive-use resources, in which case all other tasks needing
those resources must also wait. You can use the NOSUSPEND option to avoid
this; see The NOSUSPEND option on page 37.
v It can be more efficient to use main temporary storage exclusively in very
low-volume systems that have no need for recovery.
The following points apply to temporary storage in general:
v You must use a CICS command every time data is written to or read from a
temporary storage queue, and CICS must find or insert the data using its
internal index. This means that the overhead for using main temporary storage
is greater than for the CWA or terminal user area. With auxiliary storage, often
the most frequently used, there is usually file I/O as well, which increases
overhead even more.
v You need not allocate temporary storage until it is required; you need to keep it
only as long as it is required, and the item size is not fixed until you issue the
command that creates it. This makes it a good choice for relatively high-volume
data and data that varies in length or duration.
v The fact that temporary storage queues are named as they are created provides a
very powerful form of random access to saved data. You can access scratchpad
areas for terminals, file records, and so on, simply by including the terminal
name or record key in the queue name.
v Resource-level protection is available for temporary storage.
Common work area (CWA): The common work area (CWA) is a single control
block that is allocated at system startup time and it exists for the region. The size
is fixed by specifying a value for the CWASize parameter in the Region Definition
(RD). This means that the CWA has the following characteristics:
v There is almost no overhead in storing or retrieving data from the CWA.
Transaction programs must issue one ADDRESS command to get the address of
the area but, after that, they can access it directly.
v Data in the CWA is not recovered if a transaction or the system fails.
v It is not subject to resource-level security.
v CICS does not regulate use of the CWA. All programs in all applications that use
the CWA must follow the same rules for shared use. The content of and access
to the CWA will be one of the design issues that you will need to discuss with
application developers. It is sensible to supply a copybook or include file to
describe the contents.
v The CWA is especially suitable for small amounts of data, such as status
information, that are read or updated frequently by multiple programs in an
application.
v The CWA is not suitable for large-volume or short-lived data because it is
always allocated.
28
v You must ensure that data used in one transaction does not overlay data used in
another, by following the rules for shared use discussed above.
v You must ensure that programs do not overrun the end of the CWA as this
corrupts the storage areas in the Task Shared Pool, causing other transactions to
fail.
Terminal user area (TCTUA): The terminal user area is defined using the
TCTUALen option in the Terminal Definitions (WD). If this length is not zero, the
address of the area can be obtained with an EXEC CICS ADDRESS command.
Terminal user areas have the following characteristics in common with the CWA:
v Minimal processor overhead (only one ADDRESS command needed)
v No recovery
v No resource-level security
v No regulation of use by CICS
v Fixed length
v Unsuitable for large-volume or short-lived data
Unlike the CWA, however, the terminal user area for a particular terminal is
usually shared only among transactions using that terminal. It is therefore useful
for storing small amounts of data of fairly standard length between a series of
pseudoconversational transactions. Another difference is that it is not necessarily
permanently allocated, because the terminal user area only exists while the
Terminal Definition is set up. The Terminal User Area is allocated from system
startup for nonautoinstall terminals and when the Terminal Definition is generated
for autoinstall terminals. It is discarded for autoinstalled terminals when their
destination is deleted.
Using the terminal user area in this way does not require special discipline among
using transactions, because data is always read by the transaction following the
one that wrote it. However, if you use terminal user areas to store longer-term data
(for example, terminal or operator information needed by an entire application),
they require the same care as the CWA to ensure that data used in one transaction
does not overlay data used in another. You should also take care not to exceed the
length of the allocated terminal user areas, because this causes corruption in other
storage areas allocated from the CICS Task Shared Pool.
|
|
|
29
Saving the data on the screen is easy to code, but has two limitations. First, you
should not use it with screens that contain large amounts of data if the likelihood
of errors is high. This is because of the additional line traffic needed to resend the
unchanged data. (This does not apply to locally-attached terminals.)
Second, if the user presses the CLEAR key, the screen data is lost, and the
transaction must be able to recover from this. You can avoid this by defining the
CLEAR key to mean CANCEL or QUIT, if this is appropriate for the application
concerned.
Data other than keyed data may also be stored on the screen. This data can be
protected from changes (except those caused by CLEAR) and can be nondisplay, if
necessary.
Intrapartition transient data: Intrapartition transient data has some characteristics
in common with auxiliary temporary storage. Like temporary storage,
intrapartition transient data consists of queues of data, kept together in a single
data set, with an index that CICS maintains in main storage.
You can use transient data for many of the purposes for which you would use
auxiliary temporary storage, but there are some important differences:
v Transient data queue names must be defined in the Transient Data Definitions
(TDD) before CICS is started. You cannot define them arbitrarily at the time the
data is created. Thus, transient data does not have the same dynamic
characteristics as temporary storage.
v Transient data queues must be read sequentially, and each item can be read only
once. That is, after a transaction reads an item, that item is removed from the
queue and is not available to any other transaction. In contrast, items in
temporary storage queues may be read either sequentially or directly (by item
number). They can be read any number of times and are never removed from
the queue until the entire queue is purged.
These two characteristics make transient data inappropriate for scratchpad data
but suitable for queued data such as audit trails and output to be printed. In
fact, for data that is read sequentially once, transient data is preferable to
temporary storage.
v Items in a temporary storage queue can be changed; items in transient data
cannot.
v Transient data queues are always written to a data set. (There is no form of
transient data that corresponds to main temporary storage.)
v You can define transient data queues so that writing items to the queue causes a
specific transaction to be initiated (for example, to process the queue).
Temporary storage has nothing that corresponds to this trigger mechanism,
although you may be able to use a START command to perform a similar
function.
v Transient data has more varied recovery options than temporary storage. It can
be physically or logically recoverable.
v Because the commands for intrapartition and extrapartition transient data are
identical, you can switch easily between the internal CICS facility (intrapartition)
and an external data set. To do this, you need only change the TDD, not your
application programs. Temporary storage has no corresponding function of this
kind.
Operating System files: You can also use operating system files to save data
between transactions. This method probably has the largest overhead in terms of
30
31
For shared or distributed data, you must consider data integrity. Programming
requirements to ensure data integrity are more complex when data is shared or
distributed.
v Data backup and recovery
If your data is vital, you must consider how to recover the data if it is lost.
Recovery might be provided by CICS or another facility. Programming
requirements to ensure recoverability are more complex when data is shared or
distributed.
v Portability
If you need to store or access your data from multiple platforms (AIX and MVS
for example), you must ensure that your choice is supported in all potential
environments. Possible future cross-platform requirements also need to be
considered.
v Performance
Some forms of storage are much more efficient than others. There is generally a
trade-off between performance and function, so you must balance your other
requirements against your performance requirements.
Structure and function: The most important difference between data stored by a
database management system and data stored in either flat files or queues is the
structure that the storage manager imposes on the data. This structure dictates the
application programming interface to the data and determines how easy or hard it
is to store and retrieve the data for a particular processing requirement. If the data
is complex, the structure can be the overriding consideration.
A related difference is where knowledge of the data structure is stored. In a
database management system (DBMS), the logical structure of the data resides in
the DBMS. The physical structure can be changed considerably without changing
application code. In flat files, the logical structure of the data is embedded in the
programs using it, and logical and physical structures coincide.
DBMSs provide services and utilities for managing recovery, sharing and
distribution that can be essential to your application. If your data is voluminous,
recovery and other management functions can dictate that you use a DBMS.
Sharing and distribution: Another storage consideration is the potential users of
the data. Will users access the data from more than one CICS platform? Is the
access made concurrently or serially?
The inability to share data has historically been an impediment to application
growth and change. The problems arise as follows:
v Increases occur in both the size of the data and the frequency with which the
data is accessed: Growth in demands for data occur because applications grow
in volume beyond expectations, or a successful application spawns other
applications which make use the same data. The applications no longer fit on
the processor where they began, and sometimes, they cannot fit on the largest
system available. These applications have to be split into multiple CICS regions,
and possibly, the data needs to be shared among these regions.
v Requirements change for data access availability: Applications originally
intended to be online for only part of the day can grow to demand 24-hour
availability. Data sharing becomes necessary because there is no time when CICS
is not operating to run the associated batch cycle. This associated processing
must be done while CICS is running.
32
33
up of all three updates together. If your task fails after making any one of the
updates, you need some way to remove that all updates, so the data is internally
consistent.
Database management systems generally provide integrity for the data they
manage. Changes to databases are considered provisional until the task making
them issues a request to commit the changes, at which time they are all made
simultaneously. However, a database manager provides this kind of integrity only
to data under its control. CICS extends the concept to allow you to define a set of
related changes to data stored in different facilities, including direct access files,
queues, and database managers.
CICS guarantees that if it cannot complete all the changes to protected data in a
single logical unit of work (LUW), it makes none of them. For example, if you
have made half of a sequence of related updates when a computer fails, CICS
backs out the changes it has made so far in the logical unit of work before
resuming. In general, you decide which data is to be protected in this way,
although sometimes database managers have a say in the matter. Not all types of
data are eligible, and if the integrity of your data is vital, you must consider this
when you choose how to store it.
Dynamic backout and recovery:
There are two situations in which updates to resources can possibly need to be
undone: an individual task can fail part way through an LUW, or the whole
system can fail. (LUWs generally coincide with tasks, although it is possible to
break a task into multiple LUWs; an LUW never spans tasks.)
The resources updated within a single LUW can belong to more than one resource
manager. When this situation occurs, CICS recovery actions include the joint
responsibility of all the resource managers involved. For example, when you are
using an XA-compliant relational database management system (RDBMS), CICS
acts as the XA-compliant transaction manager and controls the backout actions
both of itself (as a resource manager) and of the RDBMS; on the other hand, SFS is
itself a recoverable resource manager. Therefore, although CICS keeps track of such
recoverable entities as transient data queue read and write pointers, it is SFS that
performs the major backout and recovery work.
CICS saves the original and current state of all of its recoverable data that has been
changed in the current LUW. It saves this information in the Region Pool. If the
LUW needs to be rolled back, CICS simply discards the current state information,
leaving the data in its original state. It also instructs all of the resource managers
involved in the LUW to roll back their work.
When there is a failure that results in the abnormal termination of a CICS region,
on restart, CICS has to process every LUW that was incomplete at the time of the
failure. Whether or not other resource managers have to do likewise is dependent
upon whether they also failed. For example: a region has only one SFS was
running, and that server did not fail. In this case, the server is still running, and it
is necessary to restart only CICS.
Restoring the state of recoverable resources after a system failure requires an
external record of all the work that needs to be redone. For this purpose, CICS is
configured to periodically take snapshots (checkpoints) of the states of all
recoverable resources. On restart, CICS reads the checkpoint to reestablish the
34
states of the recoverable resources at the time the checkpoint was written, and then
processes all relevant information held for the region.
The frequency with which this checkpoint occurs is configurable. Refer to the
CheckpointInterval attribute described in the CICS Administration Reference.
Guaranteeing integrity across an LUW involves the need to protect all involved
tasks so that other LUWs cannot update them until the current LUW ends. This
guarantees that only the LUW having the failed transactions needs to be rolled
back. Therefore, the locks that prevent concurrent updates must be extended to the
end of the LUW. Extending the locks, of course, increases the associated delays.
If a task just wants to read data that has been updated in an uncommitted LUW, it
might use data that is subsequently changed because the LUW that wrote it failed.
To ensure read integrity in this situation, readers as well as updaters of
uncommitted data must be locked out until the updating LUW ends.
Data backup and recovery:
The task of keeping backup copies is more complicated with online systems,
because the data is constantly changing. One way to handle backups is to make a
full copy periodically, and keep a record of subsequent changes. In this way, you
can reconstruct the current data by reapplying these changes to the most recent full
copy. Another way to handle backups is to write duplicate copies of critical
databases. This can be done synchronously, so that the two copies are kept exactly
the same, or asynchronously, where the backup copy can be slightly behind the
primary one. Many users keep one copy physically remote from the normal
processing site.
In addition to the time and operational complexity of making the copies, there are
online costs associated with protecting your data. First, there is the overhead of
recording the changes. (Recovery requires an image of each changed resource after
the change.) Second, these after images must be recorded on an external medium by
the time the task making them reaches syncpoint. This requirement ensures that
even if CICS malfunctions at that time, no committed changes are lost in the
process. Furthermore, this external recording of the after image requires that the
task wait for the I/O to complete before the syncpoint processing can be
completed.
Considerations involved in deciding how to handle backups include the following
issues:
v Is your data is voluminous or volatile?
v How long does it take to make the copies?
v How frequently are backups required?
v How long can your business sustain an outage while you rebuild your data after
an accident?
The business demands and the data storage facilities available in each situation
will dictate your approach to backup requirements.
The following operational concerns are relevant to backup decisions:
v Who will perform the process and how much automation is required? (This is
particularly important if more than one form of data storage is involved.)
35
36
Wait conditions
In some CICS products, it is possible to inadvertently stop all CICS activity by
using a facility that causes an operating system wait. This can only occur in CICS
for system dumps, whether operator or software initiated.
Auxiliary trace
Efficiency can be improved by using auxiliary trace to review your application
programs. It can identify many common coding problems, such as:
v unnecessary code
v too many or too large EXEC CICS GETMAIN commands
v failure to release storage when it is no longer needed
v failure to unlock records held for exclusive control that are no longer needed
v unintended logic loops.
37
For journaling commands, the restrictions apply to the sum of the LENGTH and
PFXLENG values. For further details, see the CICS Application Programming
Reference. Note that for journal records, the journal buffer size may impose a limit
lower than 24KB.
Recommendation: For any command, 24KB is a good working limit for LENGTH
specifications. Subject to user-specified record and buffer sizes, this limit is unlikely
either to cause an error or to place a constraint on applications.
You will probably not find a 24KB limit too much of a hindrance; online programs
do not often handle such large amounts of data for the sake of efficiency and
response time.
Note: The value in the LENGTH operand should never exceed the length of the
data area addressed by the command.
38
Task A
START
WRITE
READ
UPDATE
Syncpoint
Exclusive Control
during update
Task B
WRITE
READ
UPDATE
START
Wait
Syncpoint
Exclusive Control
during update
Figure 2 illustrates two tasks updating the same record in recoverable SFS files or
DB2 files. Task A is given exclusive control of the record until the update is
committed (at the end of the LUW). During this period, Task B waits.
Task A
START
WRITE
READ
UPDATE
Task B
START
WRITE
READ
UPDATE
Wait
Exclusive Control
until end of LUW
Syncpoint
39
40
41
Note: The concurrent use of locks against more than one resource introduces the
possibility of transaction deadlock.
See the CICS Application Programming Reference and the CICS Administration Guide
for related information.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
You can use the C language function alloca to allocate stack storage for
automatic variables and dynamically sized automatic variables. This storage is
the quickest to allocate and deallocate and is automatically cleaned up when the
function exits or the transaction program abends. The application programmer
must ensure that this memory is freed at an appropriate time. Because it is not
simple to defend against the possibility that a transaction program will abend
while holding malloc storage, it is normal for transaction programs to use EXEC
CICS GETMAIN instead.
42
Avoiding locks
Transaction programs can run concurrently as long as they do not depend on or
update the same data. If they do require the same data, the second transaction
must possibly wait until the first transaction reaches syncpoint.
You can design your application to minimize the amount of contention for locks.
For example, suppose that you must keep a count in a file of the number of
transactions executed in your system. Every transaction needs to contain
statements like the following:
EXEC CICS READ FILE("count_file") UPDATE ... ;
count = count + 1 ;
EXEC CICS REWRITE FILE("count_file") ;
43
Reading programs
On CICS for AIX only
Programs written in C, IBM COBOL, or PL/I are mapped into storage from
the file system, and so require very little paging space.
44
v Programs are cached for each application server, so a new copy of the
program has no effect on an application server if the application server
has not yet run the program.
v The SET PROGRAM NEWCOPY or SET PROGRAM COPY(NEWCOPY)
commands for a Micro Focus Server Express COBOL or Net Express
program remove every program previously loaded by the application
server, so a fresh copy of every such program is used after one of these
commands is run, not just the program for which the SET PROGRAM
NEWCOPY or SET PROGRAM COPY(NEWCOPY) command is issued.
These commands have no effect on Java programs.
45
Database Managed Space (DMS) Table Space, where the database manager
controls the storage space.
By default, DB2 uses SMS Table Space. It is recommended however, that DMS
Table Space is used with CICS since, in general, it provides a performance
improvement.
See the DB2: Administration Guide for details on how to create DMS table space.
See also Improving performance of database access on page 45 for more
information about CICS and database performance.
Refer to the Oracle performance tuning guide for any performance enhancements.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
For both XA and non-XA connections to WebSphere MQ, CICS transactions that
access WebSphere MQ resources must either:
v Invoke the MQDISC call before returning to CICS
or
v Install the Task termination exit sample program provided by WebSphere MQ
|
|
|
|
The MQDISC call or the WebSphere MQ Task termination exit sample perform the
necessary clean up of WebSphere MQ resources. If you install the WebSphere MQ
Task termination exit sample, it is invoked by CICS during normal and abnormal
task termination.
|
|
|
If you do not either install the WebSphere MQ Task termination exit sample, or call
MQDISC before returning to CICS, you will experience unexpected CICS
application server abends during subsequent transaction runs.
|
|
|
|
For information about the WebSphere MQ Task termination exit sample and how
to install it, see the WebSphere MQ System Administration Guide. Refer to the CICS
Administration Guide for information about how to configure WebSphere MQ with
CICS using XA and non-XA connections, and about building CICS/MQ
46
applications.
47
48
49
Thread safety
Compile all CICS programs by using the thread safe version of a runtime language
library.
As discussed in How CICS runs your transactions on page 8, your application
programs run in a multi-threaded process. Certain types of function may not
behave correctly when called consecutively from two or more threads. These
functions should either not be used, or they should only be called using a
serialization technique. For example, any function that keeps static data between
calls (such as ctime) should not be used.
CICS-safe functions
Even if a function is thread safe, you cannot always use it in the CICS
environment. Functions that you can use in CICS application programs without
restrictions are called CICS-safe functions.
The functions and services below are not CICS safe and must not be used at all, or
at best, used with caution. In many cases, CICS uses these functions and services
itself; their use in application programs possibly causes CICS to behave
unpredictably.
Note: The absence of a function from this list does not imply or guarantee that it
is CICS safe.
Table 4. Non-CICS-safe functions
50
Function or Service
Restriction
Do not use.
Do not use.
setlocale
Do not use.
Do not use.
exit or _exit
Do not use.
Restriction
fork
kill
raise
Do not use.
assert
Do not use.
abort
Do not use.
sigprocmask
Do not use.
signals
Do not use.
Do not use.
DCE threads
Encina TRAN
Do not use.
Encina Transactional C
Do not use.
Encina threadTid
Do not use.
51
Options
Defaults from
LENGTH
INTO
DUMP
FROM
LENGTH
FROM
CONVERSE
FROMLENGTH (unless
FROMFLENGTH is specified)
FROM
CONVERSE
INTO
CONVERSE
MAXLENGTH or MAXFLENGTH
with no argument
INTO
RECEIVE
INTO
RECEIVE
MAXLENGTH or MAXFLENGTH
with no argument
INTO
SEND
FROM
LENGTH
COMMAREA
CONNECT PROCESS
PROCLENGTH
PROCNAME
CONNECT PROCESS
PIPLENGTH
PIPLIST
JOURNAL
PFXLENG
PREFIX
RECEIVE MAP('MAPNAME')
without INTO or SET
INTO
MAP
MAP
52
53
v For Micro Focus Server Express COBOL and Net Express programs:
COBDIR
Ensure that the environment variable is in the System environment for use
within CICS.
COBPATH and COBDIR are defined by the compilers at installation time.
For Micro Focus Net Express COBOL programs, all COBOL calls check for the
program in the PD database the first time the program is called. If there is no
PD entry, the run-time looks for the program in the COBDIR directory. After
the first call to this program, disabling the program has no effect.
Note: Refer to xii for a description of how $CICS is used to represent the
product pathname.
v If it is specified as a file name or a base name in a CALL statement, it can
reside in:
/var/cics_regions/region/bin
In the called program PROG, the CICS translator inserts DFHEIBLK and
DFHCOMMAREA into the linkage section and into the USING list of the
procedure division statement. You code the procedure division statement normally.
In the previous example, this is:
PROCEDURE DIVISION USING PARM1 PARM2
The translator inserts DFHEIBLK and DFHCOMMAREA into this statement before
PARM1.
54
Note: The CALL and PROCEDURE DIVISION statements shown above are
examples only. PARM1 and PARM2 are not mandatory.
Working storage
Applications written in COBOL are given a fresh copy of their working storage
when they are first used within a transaction.
It is not possible for CICS to arrange cancellation of anything but the top level
CICS program. If you wish to have working storage for such programs set to the
initial state both within and across transactions, you must ensure these programs
are cancelled individually.
If you are using Micro Focus Net Express COBOL, every program is given new
working storage if the /DATA-CONTEXT flag was specified when the program
was compiled.
Recursion
Applications written in COBOL should avoid using recursion. See COBOL
PERFORM and CALL commands on page 23 for more information.
Mixing languages
A run unit is a running set of one or more programs that communicate with each
other by COBOL CALL statements. It is an execution of a single entry as defined
in the Program Definitions (PD). PD entries are not required for called
subprograms. In a CICS environment, a run unit is entered at the start of a CICS
task, or invoked by an EXEC CICS LINK or EXEC CICS XCTL command.
Be aware of three rules governing calls between COBOL and C or C++ programs
under CICS.
Chapter 3. Programming constraints
55
v COBOL programs that contain CICS commands can CALL C or C++ programs
as long as the called C or C++ programs do not contain any CICS commands.
v C or C++ programs that contain CICS commands can CALL COBOL programs
as long as the called COBOL programs do not contain any CICS commands.
v COBOL programs can EXEC CICS LINK or EXEC CICS XCTL to a C or C++
program regardless of whether or not the C or C++ program contains CICS
commands.
Therefore, if your COBOL program invokes a C or C++ program that contains
CICS commands (or vice versa), use EXEC CICS LINK or EXEC CICS XCTL rather
than the COBOL CALL statement.
Releasing resources
In short-lived processes, any resources (such as file handles and memory) will be
automatically released. Since CICS uses long-running application servers, this
release will not be automatically done at the end of a transaction. CICS will only
clean up the CICS resources that it owns (such as EXEC CICS GETMAIN storage).
Therefore it is important that if a CICS program calls a function such as open
directly, a corresponding close must be called before the end of the program. If
close is not called, the system may run out of resources.
The resources affected by this consideration include memory segments,
semaphores, locks and file handles.
56
Then translate the program on the workstation. Use the cicscobinsert utility to
provide a necessary conversion for alphanumeric literals during interaction
between applications and CICS. See Using Micro Focus Net Express to compile
EBCDIC-enabled COBOL programs on page 227 for information on how to use
this utility with the cicstcl or cicstran commands.
The Micro Focus Net Express compiler converts alphanumeric literals to EBCDIC.
It does not convert character constants represented in hexadecimal format. As a
result, these constants must exist as their hexadecimal equivalent EBCDIC values.
See your compiler documentation for more information. Programs compiled with
the EBCDIC directive run as EBCDIC programs; for example, PIC 9 fields hold
values from XF0 through XF9.
When an application is run and an EXEC CICS call is made, character values are
converted from EBCDIC to ASCII and from ASCII to EBCDIC as required.
Examples of fields and arguments that are converted in this way include the
following:
v EIBTRNID and EIBTRMID field values.
v Arguments to EXEC CICS commands.
The content of data areas passed to EXEC CICS commands is not converted.
Chapter 3. Programming constraints
57
Restrictions
You should not use COBOL statements to request operating system functions that
can be requested from the CICS API.
You should also not use the following COBOL statements:
v STOP RUN
v DISPLAY
If the PROGRAM-ID statement is used, the program name must be the same as the
filename.
The PROGRAM-ID is used by the COBOL compilers as the entry-point name,
defaulting to upper-case.
On CICS on Open Systems you can use compiler options to allow a mixed-case
entry-point name, but CICS does not support mixed-case for Micro Focus Server
Express COBOL, and supports mixed case for IBM COBOL only if you compile
and link in separate steps and do not use cicstcl.
On CICS for Windows, CICS does not support mixed-case entry-point names for
IBM COBOL or Micro Focus Net Express COBOL.
Micro Focus Net Express programs are never unloaded from memory.
See the CICS Application Programming Reference for related information.
58
EXEC CICS HANDLE ABEND PROGRAM commands are allowed, but you cannot
use EXEC CICS PUSH HANDLE and EXEC CICS POP HANDLE.
FOR
UNTIL
HOURS(data-value)
MINUTES(data-value)
SECONDS(data-value)
HOURS(data-value)
MINUTES(data-value)
SECONDS(data-value)
FOR has the same meaning as the INTERVAL option used with COBOL programs
(interval of time). UNTIL has the same meaning as the TIME option (absolute
time).
The following is an example of the EXEC CICS DELAY command:
EXEC CICS DELAY UNTIL HOURS(2) MINUTES(15) SECONDS(37);
59
START
EXEC CICS START
AFTER
AT
HOURS(data-value)
MINUTES(data-value)
SECONDS(data-value)
HOURS(data-value)
MINUTES(data-value)
SECONDS(data-value)
AFTER has the same meaning as the INTERVAL option (interval of time). AT has
the same meaning as the TIME option (absolute time).
Time arguments
HOURS(hh)
The option specifies the hours time argument. The argument (hh) is
defined as a 32 bit binary data value.
MINUTES(mm)
The option specifies the minutes time argument. The argument (mm) is
defined as a 32 bit binary data value.
SECONDS(ss)
The option specifies the seconds time argument. The argument (ss) is
defined as a 32 bit binary data value.
If more than one of the time components (HOURS, MINUTES, SECONDS) is
specified, the omitted ones will be assumed to have a zero value and the permitted
ranges will be:
1. Hours - 0 to 99
2. Minutes - 0 to 59
3. Seconds - 0 to 59
If only one time component (HOURS, MINUTES, SECONDS) is specified, the
permitted range will be 0 to the equivalent of 99 hours 59 minutes and 59 seconds.
60
Commands
Option
Defaults to
FROM
&map1.map1o
Option
Defaults to
INTO
&map1.map1i
4
The transaction id under which the program is running
A pointer to the EIB
A pointer to the commarea (or NULL)
The commarea length
Note that this scheme differs from other approaches used by the CICS family
where only the transaction identifier (tranid) is provided and the value for argc is set
to 1.
When you link-edit an application program to be run under CICS (using cicstcl,
for example), the object you create is not directly executable by the operating
system both because it contains some unresolved symbols and because it expects to
be run by the CICS application server. The CICS application server (see
Application servers on page 10) provides a complete environment for running
the loadable objects produced by cicstcl. To run your transaction, CICS looks up
the name and location of a CICS program, and uses the operating system dynamic
61
loading facility to load that program into the application server. The unresolved
symbols in the program are then resolved by symbols provided by the server and
the program begins execution.
IBM C++ executables must have a suffix of .ibmcpp for identification by CICS.
Mixing languages
A run unit in CICS C or C++ is a single CICS C or C++ program. A CICS
transaction can consist of many run units, each of which can be in a different
language, provided that programs written in one language communicate with
programs written in another language only by using EXEC CICS LINK or EXEC
CICS XCTL commands.
62
If you specify the RESP option or the RESP2 option or both in an EXEC CICS
statement, you must specify EXEC CICS ADDRESS EIB(dfheiptr) beforehand. The
name dfheiptr is required. Omitting this step causes the transaction to abend with
an abend code of ASRA.
Releasing resources
In short-lived operating system processes, any resources (such as file handles and
memory) will be automatically released. Since CICS uses long-running application
servers, this release will not be automatically done at the end of a transaction.
CICS will only clean up the CICS resources that it owns (such as EXEC CICS
GETMAIN storage). Therefore it is important that if a CICS program calls a
function such as open directly, a corresponding close must be called before the end
of the program. If close is not called, the system may run out of resources.
The resources affected by this consideration include memory segments,
semaphores, locks and file handles.
String handling
CICS does not generally support the C convention of delimiting strings using a
null byte. Instead, strings are padded with spaces to their maximum length. All
strings output from CICS are always space padded, and therefore cannot be used
directly by C string manipulation functions.
You should take care in passing strings terminated with a null to the CICS
interface. This will work in situations where the option concerned is not of a fixed
length, but will not work for fixed length options. For example, a CICS file name
can be up to eight characters in length, so you can open the literal ABCD and
CICS will handle this correctly. But, temporary storage queue names (including
REQID on certain commands) must be exactly 8 bytes. Therefore, CICS will take
whatever bytes happen to be after the null following ABCD as part of the TSQ
name.
C++ considerations
Do not use iostream objects in CICS programs.
Do not place CICS statements in header files as part of an inline function
definition. CICS statements in class templates must be translated before the
inclusion of the template class definition in any program. C++ allows the creation
of new objects on the heap and it is important that these objects are deleted after
use to avoid memory leaks. Ensure that all initialization is done within the object
constructors.
You should also ensure that your prodDir is set to the path of any class libraries
used in your CICS environment file.
Do not use CICS statements in static object constructors or destructors. Static
constructors and destructors are called outside a CICS Logical Unit of Work, and
so using CICS statements at these points can cause abends.
See the CICS Application Programming Reference for related information.
63
64
Commands
Options
Defaults from
LENGTH
INTO
DUMP
FROM
LENGTH
FROM
CONVERSE
FROMLENGTH (unless
FROMFLENGTH is specified)
FROM
CONVERSE
INTO
Options
Defaults from
CONVERSE
MAXLENGTH or MAXFLENGTH
with no argument
INTO
RECEIVE
INTO
RECEIVE
MAXLENGTH or MAXFLENGTH
with no argument
INTO
SEND
FROM
LENGTH
COMMAREA
CONNECT PROCESS
PROCLENGTH
PROCNAME
CONNECT PROCESS
PIPLENGTH
PIPLIST
JOURNAL
PFXLENG
PREFIX
RECEIVE MAP('MAPNAME')
without INTO or SET
INTO
MAP
MAP
65
OPTIONS(MAIN) specification
If OPTIONS(MAIN) is specified for a PL/I program, the program can be the first
program of a transaction, or control can be passed to it by means of an EXEC CICS
LINK or XCTL command.
If OPTIONS(MAIN) is not specified, the program cannot be the first program in a
transaction, nor have control passed to it by an EXEC CICS LINK or XCTL
command.
The definition of the EIB (DFHEIBLK) is generated in each program, based upon
the pointer variable DFHEIPTR. In programs declared with OPTIONS(MAIN), the
DFHEIPTR variable is set up to address the EIB on entry. In programs other than
those declared with OPTIONS(MAIN), addressability to the EIB is the users
responsibility.
Addressability can be achieved by using the command:
EXEC CICS ADDRESS EIB(DFHEIPTR)
Addressability can also be achieved by passing the EIB address or the values of
particular EIB fields as arguments to the CALL statement that invokes the external
procedure.
Mixing languages
A run unit in CICS PL/I is a single CICS PL/I program. A CICS transaction can
consist of many run units, each of which can be in a different language, provided
that programs written in one language communicate with programs written in
another language only by using EXEC CICS LINK or EXEC CICS XCTL
commands.
Releasing resources
In short-lived operating system processes, any resources (such as file handles and
memory) will be automatically released. Since CICS uses long-running application
servers, this release will not be automatically done at the end of a transaction.
CICS will only clean up the CICS resources that it owns (such as EXEC CICS
GETMAIN storage). Therefore it is important that if a CICS program calls a
function such as open directly, a corresponding close must be called before the
end of the program. If close is not called, the system may run out of resources.
The resources affected by this consideration include memory segments,
semaphores, locks and file handles.
See the CICS Application Programming Reference for related information.
66
Terminal services
The CICS terminal services allow user-written application programs, terminals, and
logical units to communicate using API commands. Terminal services handle data
translation, transaction identification, synchronization of input and output
operations, and the session control needed to read from or write to a terminal. This
frees the application from the responsibility of controlling terminals.
During processing, an application program is connected to one terminal for one
task. The terminal services monitor which task is associated with which terminal,
and determine which task is to be initiated.
In intercommunications, terminal services are also used to control communication
with logical units (LU) or with another CICS system. An LU can represent a
terminal either directly, or indirectly, through a program stored in a subsystem
controller.
CICS for Windows supports terminals with a process known as a CICS local
terminal. The client process is responsible for reading user input, communicating
with an attached region to run transactions, receiving output from those
transactions, and displaying it to the end-user. The supplied CICS client cicsterm
(CICS on Open Systems) and cicsteld processes contain an IBM 3270 Information
Display System datastream emulation which supports a subset of the 3270
protocol.
CICS on Open Systems clients, cicsterm, and cicsteld however, cannot emulate all
I/O devices, such as card readers. To enable you to use these devices from CICS,
and to allow you to write enhanced 3270 emulations, the CICS on Open Systems
clients cicsterm and cicsteld processes are replaceable. Information about CICS on
67
Open Systems clients cicsterm and cicsteld, and about writing your own versions
of the replaceable code is in the CICS Administration Reference.
You can use terminal services to communicate with a remote system by means of
distributed transaction processing (DTP), which is described fully in the CICS
Intercommunication Guide.
You can use the following API commands to use the terminal services (provided
they apply to your terminal or logical unit):
RECEIVE
Read data from a terminal or logical unit.
SEND Write data to a terminal or logical unit.
SEND TEXT
Write text to a terminal or logical unit that is formatted in such as way that
words are not split across lines.
CONVERSE
Converse with a terminal or logical unit.
WAIT TERMINAL
Synchronize terminal input/output for a transaction.
ISSUE SIGNAL
Send an asynchronous interrupt.
Other services available in response to terminal services commands apply to
specific types of terminal. Because CICS supports many different terminal types, it
provides a number of special services. In particular, there are many commands for
communicating with display devices such as those members of the IBM 3270
Information Display System family.
Use the EXEC CICS SEND TEXT command to send text to a terminal. The text is
split into lines of the same width as the terminal, such that words are not broken
across line boundaries. If the text exceeds a page, it is split into pages that fit on
the terminal.
The data area containing the text to be sent is specified in the FROM option. The
LENGTH option specifies the length of this area. To help control the format of the
display, the text may contain embedded new-line characters and embedded blanks.
68
If the FROM data area contains more text than can fit on a single screen, BMS
creates another screen of formatted text and overwrites the previous screen. If the
ERASE option is used, then the previous screen is erased before the new screen is
written, thus improving the presentation of the text.
where netname is the network name specified in the Terminal Definitions (WD)
entry that represents the printer. Refer to the CICS Administration Reference for
additional information, such as how to specify a print command when
cicstermp is started.
2. Use either EXEC CICS START or CECI START, as shown:
EXEC CICS START TRANSID(transid) TERMID(termid) END-EXEC.
CECI START TRANSID(transid) TERMID(termid)
where transid is the application that issues the SEND TEXT PRINT command
(see Figure 3 on page 70), and termid is the printer model entry defined in the
WD. If cicstermp is running, these commands send the text to the printer
specified by the principal facility named with the TERMID(termid) option. If
cicstermp is not running, then the START command is queued until cicstermp
is started.
69
The output will read as shown in Figure 4 on page 71 (in 80 column mode):
70
ONCE UPON A TIME, THERE WERE THREE BEARS, DADDY BEAR, MUMMY BEAR, AND LITTLE
BABY BEAR. ONE DAY, EARLY IN THE MORNING BEFORE BREAKFAST, THEY ALL WENT OUT
FOR A WALK, LEAVING THE PORRIDGE TO COOL ON THE KITCHEN TABLE. WHILE THEY WERE
AWAY, GOLDILOCKS CAME UPON THE HOUSE WHILE SHE WAS SKIPPING THROUGH THE FOREST
AND, UPON SEEING THE PORRIDGE SITTING INVITINGLY ON THE TABLE, DECIDED THAT SHE
WAS HUNGRY AND PROMPTLY ATE EVERY BOWL OF PORRIDGE IN SIGHT. FEELING TIRED, SHE
THEN RETIRED TO THE BEDROOM AND FELL ASLEEP IN THE BABY BEARS BED. WELL, YOU
CAN IMAGINE THE COMMOTION WHEN THE BEARS GOT BACK. IT WAS ALL SORTED OUT,
THOUGH, WHEN THEY WENT UPSTAIRS AND FOUND GOLDILOCKS - THEY DECIDED THAT SHED
TASTE MUCH BETTER THAN THE PORRIDGE ANYWAY SO THEY ATE HER WITH SOME FRIED WILD
MUSHROOMS.
71
Is the function
provided?
Yes
Yes
Extended attributes
Yes
Formfeed control
Yes
Command-level requests
Yes
No
Yes
Yes
GDDM coordination
No
No
Yes
Block data
Yes
Yes
Yes
In addition to minimum function support, TXSeries CICS also support the use of
the EXEC CICS SEND TEXT command with the following options:
v FROM(data-area)
v LENGTH
v CURSOR
v FORMFEED
v ERASE
v PRINT
72
v FREEKB
v ALARM
v NLEOM
SEND TEXT is included in standard function BMS support.
The existing maps you migrate from other CICS family members are processed
within the TXSeries CICS environment with the limitation that minimum function
BMS and SEND TEXT with the limited options is supported. This supports the
IBM 3270 and IBM 3270-like range of displays and printers, except for SNA
character string printers. (SNA character string refers to, in SNA, a character string
composed of EBCDIC controls, optionally intermixed with end-user data, that is
carried within a request or response unit.)
73
DFHMDF
Defines a single field within a map.
To map screen display information into the application program, you use the EXEC
CICS RECEIVE MAP command. In order to send data from an application
program to a display screen or printer you use the EXEC CICS SEND MAP
command. You use the EXEC CICS SEND CONTROL command to transmit device
control orders.
See the CICS Application Programming Reference for related information.
CICS also provides the EXEC CICS HANDLE AID command. This command
passes control within an application program as a result of an attention identifier
(AID) being received from a display device.
On TXSeries CICS the cicsmap command processes a source file containing BMS
macros, and generates either a symbolic map or maps, or a physical map or maps,
or both as specified by the map input. You use command line options to control
the generation of symbolic or physical maps. See cicsmap - generate BMS map
files on page 276.
The map sets required in your region are defined in a Program Definitions (PD)
entry as described in the CICS Administration Reference.
For the following descriptions, the term processed means processed with the cicsmap
command, and the term defined means defined in a Program Definitions (PD) entry.
Symbolic Map
A symbolic description map set definition is processed and defined in the
subdirectory. The member name is usually the same as the map set name,
but it need not be. Alternatively, the symbolic map can be copied or
inserted directly into the application program.
Physical Map
A physical map set definition is processed and defined in the CICS regions
bin subdirectory.
When you define the physical map, you should consider whether to add a suffix to
its name. See Map set suffixing for more detail. The reason for suffixing a map is
that you might wish to produce alternative versions of it for different emulator
models.
Note: The cicsmap command takes no notice of DFHMSD TYPE=operand. Symbolic
and physical maps are generated depending on the options supplied to the
processes.
Map set suffixing: If you want to execute the same transaction from more than
one type of emulator, you might need to use BMS map set suffixing. If you are
prepared to use the same map to format data for all your emulators, you need not
read the rest of this section. If however, you wish to organize output data
according to the emulator in use, making best use of its features, you ought to
consider suffixing map sets.
To avoid problems at the assembly stage, do one of the following:
v Use SUFFIX or TERM on your DFHMSD maps (in which case, you can safely
use the same name for your map set and your maps).
v Make sure you use different names on your DFHMSD and DFHMDI macros.
74
75
You invoke the BMS processor directly from the command-line, by entering the
required options for the cicsmap command. For example:
cicsmap mapset.bms
If you have used the SUFFIX or TERM option, the output file is named:
.map
where x is replaced with the value given in the SUFFIX and TERM operands in the
map source file.
The BMS processor places the symbolic map file in the following for COBOL:
in the following for C or C++:
mapset.h
The symbolic map file is placed in the current working directory, overwriting any
previous symbolic map file for the same map set. No maps are generated if the
BMS processor detects any errors in the map source file.
The contents of the map source file alter the operation of the cicsmap program.
The LANG option you associate with the map set macro (DFHMSD) determines
the output of cicsmap. The LANG option does not affect the production of the
physical map file.
To generate the symbolic map file where the target language is COBOL, set the
option LANG in the map set macro in the map source file equal to COBOL. You
can use the output file as a COBOL copybook file using the COBOL verb COPY.
To generate the symbolic map file where the target language is C, set the option
LANG in the map set macro in the map source file equal to 'C'. You can use the
output file as an include file.
To generate the symbolic map file where the target language is PL/I, set the option
LANG in the map set macro in the map source file equal to PLI. You can use the
output file as a PL/I include file.
76
Input operations: When you have typed data on to a display, you will probably
want to send it to the host processor. You do this by:
v Pressing the ENTER key
v Pressing a program function (PF) key
Although the display will send modified data when you press PF keys, the keys
are not normally used for this. Generally, you assign a specified meaning to the
key itself.
If you want to send data from a terminal without the user having to enter it
explicitly, you can set the modified data tag (MDT) for the required field in the
output to the terminal.
An attention identifier (AID) character is always sent to the host processor
whenever a 3270 input operation is performed. This indicates the cause of the
input operation.
CICS ensures that an application program receives input data intended for it. The
AID allows the application program to react differently, depending on the input
operation. The effect of different combinations of data and AIDs depends entirely
upon the design of the application program.
Output operations: An emulator can receive data from an application program, as
well as send data to it. Some of the data can be displayed, the rest consists of
device controls. By building datastreams containing device controls, you can, for
example:
v Unlock the keyboard for input
v Reset the modified data tag (the MDT) of each field
v Erase all unprotected fields
v Position the cursor
The way you use these features is up to you. However, they can improve the
usability of your application program.
Display field concepts: An application program can divide a screen into more
than one field. The fields combine to produce a complete screen of data.
A field starts with an attribute character, continues with data characters, and ends
at the next attribute character. A field can contain only a single character or it can
span several lines, as the last character on a line is logically followed by the first
character on the next line.
If the screen width is the same as the map width, BMS allows a field to wrap
around from the end of one line to the start of the next. Because of the dependence
on resource definitions, it is not recommended that an application design should
depend on this function.
Normally, a display is divided into several fields by the program, but it is possible
to have a display with no fields (no attribute characters). This occurs when you
press the CLEAR key; such unformatted displays are not supported by BMS and
the use of the CLEAR key causes a MAPFAIL in BMS.
An application program can use the HANDLE AID command to detect the use of
the CLEAR key. An application programmer can use the HANDLE CONDITION
77
78
Extended color
Extended color attributes in an extended data stream determine the colors
of display elements. The datastream can specify the colors of
multicharacter fields. Seven colors can be selected: blue, red, pink, green,
turquoise, yellow, and neutral.
As soon as an extended color attribute is received, the display treats the
whole image as an extended color image. Fields that have no color
attribute adopt the default colors (green for normal intensity, white for
bright). If the color control switch has been set to base color, the part of the
image that has already been displayed will change from base color to
default color. Such a change, which could disturb an operator, can be
avoided by applying an extended color attribute to the first field in any
image that uses extended color.
The device interprets extended color attributes to determine the colors of
fields in an image.
Extended highlighting
Extended highlighting can be applied to characters, or character fields, in a
display that uses the extended data stream. It can take one of three forms:
BLINK, REVERSE, or UNDERSCORE.
Modified data tag (MDT)
The modified data tag is turned on when fields are modified by the
operator. When the operator presses the ENTER key or a PF key, only
fields that have been modified by the operator or selected by the cursor
select are transmitted to the processor. The program may send fields to the
terminal with the modified data tag already on to guarantee that the field
will be returned with the next inbound transmission.
Insert-cursor indicator
The insert-cursor indicator is not a field attribute. Instead, it places the
cursor under the first data character of the field. If the insert-cursor
indicator is specified for more than one field, the cursor is placed under
the first data character of the last field specified.
Not all devices support all the attributes. BMS ensures that attributes which are not
supported by the device (as specified in the emulator definition or determined by
an automatic query of the device following logon) are ignored when building the
datastream.
Note: The unprotected, protected, and autoskip characteristics of the attribute
character are mutually exclusive. Only one may be selected for each field.
The normal, bright, and nondisplay characteristics of the attribute character
are mutually exclusive. Only one may be selected for each field.
Programmed symbols: As well as the standard display symbol sets, some devices
can have optional additional symbol store. Support for this feature is limited in
CICS for AIXand IBM CICS for Windows to selection of the default Double-Byte
Character Set for the device (PS=8). This feature uses the extended data stream.
Field Outlining: Field outlining allows lines to be included above, below, to the
left, or to the right of a field. You can use these lines in any combination to
construct boxes around fields or groups of fields.
79
A keyword field can also be used in a data entry application to identify the
data being entered. For example:
ENTER QUANTITY:
Data fields
Contain data that the application program retrieves and displays. The data
may appear exactly as stored in a file, or it may be changed by the
application program. Data fields may also be left blank for the user to
enter data. The application program can use the entered data to make
80
MAP1
DFHMSD TYPE=&SYSPARM,MODE=INOUT,LANG=COBOL,STORAGE=AUTO,
TIOAPFX=YES
DFHMDI SIZE=(30,60),MAPATTS=(COLOR,HILIGHT),DSATTS=(COLOR,
HILIGHT),LINE=1,COLUMN=1,COLOR=GREEN,HILIGHT=REVERSE
DFHMDF POS=(6,10),LENGTH=11,ATTRB=(UNPROT,NORM),CASE=MIXED,
INITIAL=Hello World
DFHMDF POS=(6,22),ATTRB=(ASKIP,NORM),LENGTH=0
DFHMDF POS=(10,10),LENGTH=9,ATTRB=(UNPROT,NORM),CASE=MIXED,
INITIAL=Bye World
DFHMDF POS=(10,20),ATTRB=(ASKIP,NORM),LENGTH=0
DFHMSD TYPE=FINAL
X
X
X
X
Message area: You use the message area of a screen to send instructions or
messages to assist the user in processing a transaction. You should separate the
message area from the application data area to allow communication with the user,
without disturbing the application data. The message area is normally the bottom
one or two lines of the screen.
See the CICS Application Programming Reference for related information.
81
subfields. Each subfield can be referred to by its name, which is the name assigned
to the field, plus a single-letter suffix. Each kind of subfield has a different suffix.
Furthermore, the whole input or output data structure can be addressed by its
suffixed name. The suffixed name of an input map is its original name extended
by the suffix I. The corresponding suffix for the output map is O.
Input map data structures: The suffixes used to address subfields, and the
contents of those subfields, in input maps are:
Table 9. Suffixes used for input map data structures
F
A flag byte. This is normally set to X'00'. If the field has been modified but no
data is sent (that is, the field is cleared) the flag byte is set to X'80'.
Input data read from the display. It is set to X'00' if no data is entered for that
field.
A 16-bit binary length value. This defines the number of characters that are
typed into the data field before it is read by BMS.
Input field suffixes: Having read data, a program can process it by issuing
ordinary application programming commands that address fields by name.
Consider a field, called INPUT, in an input map. A program can test that either its
length field INPUTL contains a value greater than zero (data has been entered) or
that its flag byte INPUTF indicates that the field has been cleared. If INPUTL
contains a value greater than zero, you can, for example, move the first INPUTL
characters from INPUTI to another data area.
The suffix on the data structure for the whole map enables you to manipulate the
whole data structure. For example, you can write simple commands to copy the
whole structure into another data area.
Output map data structures: The suffixes used to address subfields, and the
contents of those subfields, in output maps are:
Table 10. Suffixes used for output map data structures
82
An attribute byte defining the characteristics of the field (for example, protected
or unprotected).
(C only). This suffix is appended to the field name to derive a structure which
occurs n times (where n is specified by the OCCURS operand of the DFHMDF
macro).
An attribute byte defining that SO/SI creation is to be used. SO/SI (shift in/shift
out) refers to code extension characters that are used to substitute graphic
characters in standard character sets.
Output data to be sent to the display. The program usually stores data in such a
field before sending the map. If the contents of the field begin with a null
character, the whole field is ignored, the contents of the display field being taken
from the physical map. If you want to send a blank field, you must store blanks
in the symbolic map data structure. Being non-null, this overrides the contents
of the physical map.
An attribute byte defining the programmed symbol set to be used within a field
in a display.
Table 10. Suffixes used for output map data structures (continued)
U
If you want to use programmed symbols, you must ensure that a suitable symbol
set has been sent to the device.
If MODE=INOUT is specified, the fieldnameA subfield is defined in the input
map data structure. (If you are using COBOL, you will find that compiler errors
occur if a MOVE statement modifying an attribute byte is qualified to refer to the
output map.)
Subfields with suffixes H, P, C, U, and M are only generated if the corresponding
attribute types are included in the DSATTS operand of the DFHMDI or DFHMSD
macros.
As with input data fields, a program can address individual subfields in an output
field, verifying or changing their contents. For example, an application program
can check a calculated data value, say BALANCE. If the value is found to be
negative, the highlight attribute constant (BALANCEH) in a field called BALANCE
can be set to produce highlighted characters when displayed. The data value in the
field occupies subfield BALANCEO.
You can also manipulate the whole output data structure using its suffixed name.
For example, you can copy data into it from another area.
Note: You must set this area to nulls before using its corresponding physical map
in an output operation. Otherwise, you can obtain unpredictable results. By
doing this, you ensure that fields and attributes in the output display inherit
the default contents of the physical map, not whatever happens to be in the
symbolic data structure.
The following examples shows how you might do this in COBOL, C and PL/I:
COBOL example:
C example:
memset(&mapo,0x0,sizeof(mapo));
PL/I example:
DCL STR BASED CHAR(32767);
...
SUBSTR(ADDR(MAPO)->STR,1,STG(MAPO)) = LOW(STG(MAPO));
83
C example:
accounto=CUSTNO;...........
accounth=DFHBLINK;.........
PL/I example:
accounto=CUSTNO;...........
accounth=DFHBLINK;.........
(1)
(2)
(1)
(2)
Refer to the IBM 3270 Information Display Programmers Reference for information
about determining the value of an attribute constant.
Invalid data: BMS does not check the validity of attribute and data values in the
symbolic data structure. However BMS does ensure that attributes are not sent to
emulators that do not support them. Invalid data may be transmitted to the
emulator. Some emulators can detect this invalid data and send error information
to CICS.
Sending data to a display: You use the EXEC CICS SEND MAP command to
send mapped data to a display. (See the CICS Application Programming Reference for
related information.) You can send three kinds of data, depending on what options
you specify, as follows:
v Constant display data (with attributes) such as headings, footings, prompt
fields, and comments.
v Variable display data (with attributes) such as user data or warning messages.
v Device control data such as instructions to clear the screen, or activate an alarm,
before displaying data.
The MAP option names the map that is used to format the data, and the MAPSET
option names the map set to which the map belongs.
If the MAPSET option is omitted in an EXEC CICS SEND MAP command, the
name in the MAP option is taken as the map set name.
In its simplest form, the EXEC CICS SEND MAP command is used as follows:
1. The application program assigns values to variables named in the symbolic
description map.
2. The program issues an EXEC CICS SEND MAP command. This uses the
application data in the application data structure to replace default data and
attributes in the physical map, and sends the modified map to the display.
For example, if the first map in a map set called DISPLAY is an output map of the
same name, the map can be displayed using the command:
SEND MAP('DISPLAY')
However, the omission of the MAPSET option in an EXEC CICS SEND MAP
command is not recommended.
Another map, called ERROR, in the same map set can be displayed by:
SEND MAP('ERROR') MAPSET('DISPLAY')
By default, BMS displays application data or attribute data from the application
data structure rather than default data from the physical map. To override this for
a given field, your program must set the corresponding subfield in the data
structure to hexadecimal zeros (X'00'). before issuing an EXEC CICS SEND MAP
command, or use the MAPONLY option.
84
85
The rules for C or STORAGE=AUTO specifies that the symbolic description maps are to
C++ are:
be declared as having the AUTOMATIC storage class. If
STORAGE=AUTO is not specified, they are declared as pointers. You
cannot specify both BASE=name and STORAGE=AUTO for the same
map set. If STORAGE=AUTO is specified and TIOAPFX is not,
TIOAPFX=YES is assumed. TIOAPFX is the 12-byte terminal
input/output area (TIOA) prefix.
When BASE=name, you must code an EXEC CICS GETMAIN
command that gets at least enough main storage to contain the largest
symbolic map in the map sets sharing this base.
The name specified in the BASE operand is used as the name of the
pointer variable on which the symbolic description map is based.
The rules for
PL/I are:
Alternative data structures: The examples so far have shown EXEC CICS SEND
MAP commands that contain literal field map names. If the field map name
referenced by your program is to be a variable, you need to code the additional
options, FROM and LENGTH, on the EXEC CICS SEND MAP command. Also you
can use your own data area rather than the data structures from the symbolic
86
description map, even when use you use a literal map name. FROM enables you to
display data stored in a data area other than the data structure for the symbolic
description map.
FROM and MAPONLY are mutually exclusive.
LENGTH specifies the length of the data string stored in the FROM data area. You
must specify the LENGTH option if the data to be mapped is shorter than the data
area expected by the map.
Device control options: As well as transmitting application data to a display,
BMS can relay device control commands. An application program uses options of
the EXEC CICS SEND command to specify which controls are to be activated.
Alternatively, it can use the BMS EXEC CICS SEND CONTROL command, which
transmits device control commands without also sending application data. For
example:
SEND MAP(ERROR) MAPSET(DISPLAY)
ERASE
CURSOR
ERASE
Erase screen and place cursor in top left-hand corner of screen before
output. The first EXEC CICS SEND MAP command of any CICS
application program should specify ERASE. This ensures that the size
of the screen is set to default.
ERASEAUP
FORMFEED
FREEKB
FRSET
Reset all modified data tags (to not modified state) before output.
The CICS local terminals, cicslterm, The CICS 3270 Terminal Emulator, and
cicsterm support the following screen sizes:
v 80 columns by 24 rows
v 80 columns by 32 rows
v 80 columns by 43 rows
v 132 columns by 27 rows
Cursor positioning: You can control the positioning of the display cursor in three
different ways, as described in Table 13 on page 88.
87
You can specify a two-byte cursor position on the BMS EXEC CICS
SEND commands. This enables you to specify the absolute value of the
cursor position on the screen after the SEND has been performed. Note
that the first location on the display screen is address zero.
You specify the address in parentheses after the CURSOR keyword, as
follows:
CURSOR(44)
Insert cursor
attribute
If you omit the CURSOR option, BMS will search the map for a field
with the IC attribute. (You would have given it this attribute by coding
ATTRB=IC on the DFHMDF macro for the field.) If there is more than
one field with the IC attribute, BMS places the cursor at the beginning
of the last one. If there is no such field, BMS places the cursor at the
cursor position from the map, which is screen address zero.
If you omit the CURSOR option from the EXEC CICS SEND
CONTROL command, the cursor position remains unchanged.
Symbolic cursor
positioning
Accessing data outside the program: Sometimes your program needs access to
information held by CICS. The ASSIGN command allows it such access.
Some ASSIGN options apply exclusively to BMS. For information about these
ASSIGN options, see the CICS Application Programming Reference.
However, you can only use the ASSIGN options that are concerned with the
position or size of the maps. Those EXEC CICS ASSIGN options are shown in
Table 14.
Table 14. EXEC CICS ASSIGN options
88
MAPLINE
MAPCOLUMN
MAPWIDTH
MAPHEIGHT
Receiving data from a display: You use the EXEC CICS RECEIVE MAP
command to receive data from a display. The data from the display is mapped into
a data area in an application program.
For information about the full syntax of the EXEC CICS RECEIVE MAP command,
see the CICS Application Programming Reference . The MAP option names the map
that is used to convert the data to its unformatted form, and the MAPSET option
names the map set to which the map belongs. The effect of omitting the MAPSET
option is the same as explained for a EXEC CICS SEND MAP command.
For example, in its simplest form, the EXEC CICS RECEIVE MAP command is
coded as:
RECEIVE MAP(DISPLAY)
This command tells BMS to map the input data into a symbolic map data structure
called DISPLAY. The example assumes that the name of the map set is also
DISPLAY.
Another map, MENU, in the same map set can be read by:
RECEIVE MAP(MENU) MAPSET(DISPLAY)
This command tells BMS to map the input data into a symbolic map data structure
called MENU.
After an EXEC CICS RECEIVE MAP command, your program can determine the
inbound cursor position by inspecting the value stored in EIBCPOSN. To do this,
the application program must be informed of the physical layout of the screen,
although BMS separates the screen layout from the application for other interfaces.
Refer to the following list:
v Receiving data into an alternative data structure
The sample EXEC CICS RECEIVE MAP commands shown above use a literal for
the name of the map or map set. You can also use a variable for these names, in
which case you must use one of the options INTO or SET.
If you code INTO, display data is mapped into the named data area rather than
into the data structure for the symbolic description.
If you code SET, BMS acquires a data area for you, maps the display data into it,
and stores the address of the data area in the named pointer reference. Note that
this data area includes the 12-byte terminal input/output area (TIOA) prefix, if
present. (The TIOA prefix is present when TIOAPFX=YES is coded with the
DFHMSD macro.) This option specifies that BMS should include a filler in the
symbolic description maps to allow for the unused TIOA prefix that occurs with
command-level application programs. If this operand is not specified, the BMS
processor issues a warning message and assumes TIOAPFX=YES. For
application portability, however, you should always code it. Refer also to the
EXEC CICS GETMAIN STORAGE=AUTO description in Getting storage for a
data structure on page 85.
BMS sets the receiving area to hexadecimal zeros (X'00') before performing the
EXEC CICS RECEIVE operation, so you should save any data in this area before
performing an EXEC CICS RECEIVE operation. Furthermore, if you depend on
BMS to set a data area to hexadecimal zeros (X'00') for you during an EXEC
CICS RECEIVE operation, you should be aware of the MAPFAIL condition. If
this arises, BMS does not set the input map to hexadecimal zeros (X'00').
89
If an operator types into a BMS input map, but does not fill one of the fields,
BMS justifies the input data, and pads the empty part of the field according to
predefined rules. These depend upon what you specify with the JUSTIFY
operand of the DFHMDF macro.
The MAPFAIL condition can occur unexpectedly after an EXEC CICS RECEIVE
MAP command. For example, it occurs if the emulator operator presses a
program access key (such as PA1 or PA2) when CICS is waiting to perform an
EXEC CICS RECEIVE command. Therefore, you should always consider using
the RESP option and inspecting the returned code, or coding an EXEC CICS
HANDLE CONDITION command for the MAPFAIL condition.
v Uppercase translation
By default, the data to be mapped is assumed to come from an emulator. The
emulator control table entry for the terminal can specify that all input data is to
be translated to uppercase. You can override this for any individual EXEC CICS
RECEIVE command by specifying ASIS. Note, however, that ASIS has no effect
on the first EXEC CICS RECEIVE MAP command of a transaction. (This means
that ASIS is irrelevant to pseudoconversational transactions, which issue only
one EXEC CICS RECEIVE MAP command.)
v Mapping data from another data area
Sometimes, you need to perform an input mapping operation in two stages;
accepting and storing the input data in one stage, mapping it in the second. For
example, your program might receive (but not map) data using an emulator
control EXEC CICS RECEIVE command. It would then have to map the data
from CICS storage.
You use the FROM and LENGTH options of the EXEC CICS RECEIVE MAP
command to specify that data is to be mapped from a data area instead of from
an emulator. FROM names the data area; LENGTH indicates the number of
bytes of data to be mapped. If the data is produced by an emulator control
EXEC CICS RECEIVE command, the LENGTH value of the EXEC CICS
RECEIVE MAP command must match that specified in the original EXEC CICS
RECEIVE command.
After an EXEC CICS RECEIVE MAP, the program can determine the type of
attention identifier (AID) by inspecting EIBAID. You cannot issue the EXEC
CICS RECEIVE MAP command in a task not associated with an emulator
because BMS needs to refer to emulator information to analyze the datastream.
For information about the emulator control EXEC CICS RECEIVE command, see
the CICS Application Programming Reference.
Note: The data obtained from an EXEC CICS RECEIVE BUFFER command
cannot be mapped since the data will not contain SBA (set buffer address)
orders and a MAPFAIL condition will be raised.
Responding to emulator input: Some operator actions cause an AID to be sent to
CICS. Each such action generates a different AID. The AID is a one-byte character,
and can be tested by an application program by inspecting the contents of the
EIBAID field and comparing it to the values supplied in the DFHAID copybook.
This can be used as a mechanism for controlling program flow. The EXEC CICS
HANDLE AID command controls conditional branching caused by attention
identifiers. If either the RESP, RESP2, or no EXEC CICS HANDLE option has been
specified, the HANDLE AID function is suspended for that command.
v Exception conditions
On input, you are only likely to encounter a MAPFAIL exception condition
when using minimum function BMS, as follows:
90
If the data to be mapped has a length of zero. This happens if a PA key or the
CLEAR key is pressed.
If an AID has been pressed and no data has been entered and no fields have
FRSET.
You should remember, however, that an exception condition is not necessarily an
error condition. Sometimes you might even want to treat an exception condition
as part of the normal course of events. Use the RESP option or the EXEC CICS
HANDLE CONDITION command to respond to exception conditions.
For information about the BMS commands, and the default system action they
invoke, refer to the list of conditions documented with each command. The
commands are documented in the CICS Application Programming Reference.
v EIBAID field
A program can examine the value of the EIBAID field in the EIB to find out
which attention key has been pressed. The 3270 emulator transmits an AID
character, which is stored in field EIBAID. The program can compare the
contents of EIBAID with the constants supplied in the CICS copybook DFHAID.
Using EIBAID is particularly suited to a structured programming environment.
For information about DFHAID, see the CICS Application Programming Reference.
v HANDLE AID command
Instead of examining the contents of EIBAID, you can use the EXEC CICS
HANDLE AID command to pass control to a specified label when CICS receives
an AID from a display device; control is passed after the input operation is
completed. In the absence of an EXEC CICS HANDLE AID for an AID, control
returns to the application program at the point immediately following the input
request.
You can suspend the EXEC CICS HANDLE AID command using the PUSH and
POP commands. Note that RESP (which invokes NOHANDLE) suspends the
EXEC CICS HANDLE AID function in the same way as it does with EXEC CICS
HANDLE CONDITION, and is better suited to a structured programming
environment.
An EXEC CICS HANDLE AID command takes precedence over an EXEC CICS
HANDLE CONDITION command, unless the exception condition stops receipt
of the AID. If an AID is received during an input operation for which a EXEC
CICS HANDLE AID is active, control passes to the label specified in the EXEC
CICS HANDLE AID command, regardless of any exception conditions that
occur.
An EXEC CICS HANDLE AID command for a specified AID remains active
until the task is terminated or until another EXEC CICS HANDLE AID is issued
for that AID. (If no label is specified in the new request, the existing EXEC CICS
HANDLE AID command is suspended.)
An EXEC CICS HANDLE AID command is valid only for the program in which
it is issued. Each new program in a task starts without any active EXEC CICS
HANDLE AID settings. When control returns to a program from a program at a
lower logical level, the EXEC CICS HANDLE AID commands that were active in
the higher-level program before control was transferred from it are reactivated,
and any EXEC CICS HANDLE AID commands activated in the lower-level
program are deactivated.
If an AID covered by the general option ANYKEY is received and there is no
active EXEC CICS HANDLE AID command for the specified AID but there is an
active EXEC CICS HANDLE AID ANYKEY command, control passes to the label
specified in this command. An EXEC CICS HANDLE AID command for an AID
overrides the EXEC CICS HANDLE AID ANYKEY command in relation to that
AID.
Chapter 4. Coding for presentation services
91
The following example shows an EXEC CICS HANDLE AID command that
specifies one label (LAB1) for the PA1 key AID, a second label (LAB2) for the
PA2 and PA3 key attention identifiers, all of the PF key attention identifiers
except PF10, and the CLEAR key AID:
HANDLE AID
PA1(LAB1)
ANYKEY(LAB2)
PF10
You cannot code more than 16 options in a single EXEC CICS HANDLE AID
command.
where mapset is the one to seven character name of the map set.
v A C or C++ program must contain an #include statement for each symbolic
storage definition:
#include mapset1.h
#include mapset2.h
#include mapset3.h
.
.
where mapset is the one to seven character name of the map set.
v A PL/I program must contain a %INCLUDE statement for each symbolic storage
definition:
%include mapset1;
%include mapset2;
%include mapset3;
where mapset is the one to seven character name of the map set.
92
93
Note, however, that output from several instances of your transaction may be
interleaved on the transient data queue. This can be avoided if all the data to be
printed by an instance of your transaction is stored in a single transient data queue
item. Alternatively, each instance of your transaction can get exclusive control of
the transient data queue by ENQ and DEQ commands.
Blank lines and 3270 printers: Every line in a map for a 3270 printer must
contain field data (blanks if necessary), because the 3270 does not print empty lines
(that is, lines of null characters).
Setting the printer page width: BMS builds device-dependent datastreams for
3270 printers by computing set buffer address (SBA) orders based on the page
width specified by the NumColumns attribute in the Terminal Definitions (WD). If
you are using cicstermp, you must set NumColumns to 132, because cicstermp
emulates a 132 column printer.
Form feed characters: You can code an option, called FORMFEED, on the EXEC
CICS SEND MAP and EXEC CICS SEND CONTROL commands. This generates a
form feed character at the start of the datastream. If you code this option for an
emulator that does not support form feed, CICS simply ignores the request.
The form feed character occupies screen position 1 (the top left-hand corner) on a
3270 display or printer. It can be overwritten by other data sent to the emulator, in
which case form feed does not occur.
Be careful when using the FORMFEED option on an EXEC CICS SEND CONTROL
command. The EXEC CICS SEND CONTROL command always generates a
complete blank page. Thus an EXEC CICS SEND CONTROL FORMFEED skips to
a new page and also sends this as a blank page. However, as described earlier,
3270 printers sometimes suppress null lines so that a blank page is printed as a
single line.
See the CICS Application Programming Reference, the CICS Administration Reference,
and the CICS Clients: Administration for related information.
94
95
BMS requires you to do this is when you need to erase a field on the screen that
currently contains data, or to replace it with data shorter than that currently on the
screen, without changing the rest of the screen.
This is because when BMS builds the datastream representing your map, it
includes blanks but omits nulls. This makes the output datastream shorter. BMS
omits any field whose first data character is null, regardless of subsequent
characters in the field.
BMS requires you to initialize to nulls any area to be used to build a map. BMS
uses nulls in attribute positions and in the first position of data to indicate that no
change is to be made to the value in the map. If you are reusing a map area in a
program, you should take special care to clear it in this way.
96
97
98
DFHMDF macro. All field definition macros following a map definition macro
belong to that map. The end of one field definition is indicated by the beginning of
another.
The POS operand specifies the position of the attribute byte of the field even
though subfields of a group (other than the first) do not have attributes. If the
subfields are positioned contiguously with no intervening blanks, the POS operand
of the second and succeeding subfields must specify the position of the last
character of the previous subfield.
99
mapset is optional, but if used it must be the same as that on the DFHMSD macro
that began the map set.
100
This chapter describes how to write application programs that use the CICS data
services. The discussion covers
v Relationship between CICS and file managers discusses the relationship
between CICS and file managers
SFS consistency, isolation, and locking
DB2 concurrency and locking
CICS and SFS performance with large files
v Mixed resource manager applications on page 105 discusses the use of mixed
resource manager applications.
v File services on page 105 discusses how CICS maps VSAM requests onto SFS
files or DB2 tables.
v Queue services on page 130 discusses the use of queues in CICS applications.
v Journal services on page 137 discusses the role journal services plays in CICS
applications.
v SQL restrictions and relational database services on page 142 discusses
relational database issues.
v File processing using EXTFH with non-CICS applications on page 157
discusses file processing using the External File Handler.
101
CICS uses SFS OFD attribute settings for consistency and isolation level differently
based on the value of the Recoverable attribute in the File Definitions (FD):
v If a file is specified as not recoverable, then the following OFD attributes are
requested by CICS:
Consistency : sfs_nonTransactional
Isolation : sfs_nonTranCursorStability
Operations using OFDs specified as not recoverable do not participate in user
transactions. As a result, an EXEC CICS SYNCPOINT ROLLBACK does not
undo changes made with such OFDs. Such changes are immediately visible to
other processes reading such records.
v If a file is specified as recoverable, then the following OFD attributes are
requested by CICS:
Consistency : sfs_Transactional
Isolation : sfs_cursorStability
Operations using OFDs specified as recoverable participate in user transactions.
Changes made via such OFDs do not become visible to other processes until the
transaction reaches EXEC CICS SYNCPOINT. Greater computing resources are
required by operations using OFDs specified as recoverable than for those
operations using OFDs specified as not recoverable.
SFS offers lock modes to use when records are accessed. CICS uses sfs_noLock
mode when reading records and sfs_writeLock mode when reading records to
update them. These modes allow multiple transactions to concurrently read a
record, but prevent simultaneous updates of the record. The lock modes prevent a
transaction from reading data for update that has been written via a recoverable
OFD until an EXEC CICS SYNCPOINT is reached. However, a straight read-only
operation can see the changes prior to the EXEC CICS SYNCPOINT. A record
updated via a recoverable OFD is locked for writing until the transaction is
resolved by reaching an EXEC CICS SYNCPOINT. As a result, greater interprocess
contention occurs when a recoverable OFD is used.
102
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The following command would set the size of the buffer to 70000:
cicsupdateclass -w -c ssd -k "/.;/cics/sfs/myServ" -a BufferPoolSize n 70000
|
|
|
Note that the SFS server name has a semicolon where normally you would use a
colon. Also, the server name must be inside quotes. The server must be warm
started in either case to get the change to take effect.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Note: The svmon -P <pid> command is very useful if you want to monitor the
how much memory the data segment uses. This command shows the total
amount that is allocated (in the InUse column), and also the address
range that is allocated (in the Addr Range column). The data segment
normally grows from both ends. When these ends meet, either an
InitiateBufWrite error, or another memory error occurs.
v Before the I/O buffer is full, the SFS process can continue to run efficiently; that
is, it uses at least 100% of one CPU if the load on the operating system allows it.
The disks show that they are running at 100% capacity. If they are running only
write operations, they are not actually slowing down the SFS process; they are
catching up with the I/O buffer asynchronously. However, when the I/O buffer
is full, the SFS process must wait for the data to be written, and it must reread
data from disk because it cannot hold it all in the buffer at the same time. At
this point, many read operations occur on the data disk, the CPU uses SFS less,
and the loading rate decreases greatly.
v To help ensure that your disk write operations are the fastest possible, you can
add extra data volumes to an SFS server. Although the basic CICS SSD
definitions define only one data volume for an SFS server, you can add more
after the initial cold start of the server. To add more data volume, type the
following:
|
|
where sfs_newVol is the AIX logical volume name that was already defined
through the normal AIX facilities (for example, smitty). For this action to be
Chapter 5. Coding for data services
103
effective, assign the AIX logical volume to a different physical disk from the disk
that contains the first data volume for the SFS server. By using different physical
disks, you allow write operations to run in parallel. You can then assign the
secondary indexes for a file to volumes that are separate from the actual data
and primary index (which always stay together). For example:
|
|
|
|
|
|
|
|
|
|
If you ever cold start the SFS server, you must rerun the lvol commands to add
the extra volumes.
v If the primary index has already put into sequence the input data for a
particular file, and no secondary indexes are active, that file should load quickly.
SFS slows if it has to recalculate unsequenced indexes.
v To flush the I/O buffer to disk, type:
|
|
|
|
|
This command flushes all data volumes for the server. You can specify which
data volume is to be flushed, if you have more than one.
When a log volume becomes almost full, SFS tries to compress it. This operation
can take a long time, and does not necessarily create enough free space. In this
condition, you might find the tkadmin force checkpoint command useful. Use it
between sfsadmin and cicssdt commands if the log volume is likely to become
full. This command completely clears the log file only if all data has been
flushed to disk.
v To determine how many pages to allocate in the SFS Server, you can use the
rough formulas for size estimating. For example:
If number of records to store is N, the width of the record is w, and the width of
an Index is x:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104
The I/O buffer that is possible with the 256 MB data segment cannot hold all
the pages of SFS files that are in frequent use.
Multiple SFS servers can together provide more than 256 MB of data segments,
and they hold more data in memory that they do on disk
|
|
|
|
File services
File services commands perform the functions needed to read, update, add, delete,
and browse data in local or remote files.
When used locally, these commands provide access to files managed on either an
SFS or a DB2 database. Used remotely, the commands provide access to the
underlying file manager of the remote system. CICS provides an interface to a
generic record-oriented file manager, regardless of the file manager, the type of file,
or its physical organization.
105
106
(The ESDS file type is discussed in Entry-sequenced data set (ESDS) on page
108.) An attempted read on the same deleted record via the RBA results in the
condition ILLOGIC.
A separate FD entry is needed for each index by which you access a file. So in the
example above, you would have one entry for access by the primary index using
the employee number, and a second entry for access by the alternate index using
the employee name.
CICS treats an alternate index as though it were a KSDS, although the keys need
not uniquely identify the record. Whenever you update a record, all keys in
alternate indexes are automatically updated; primary keys cannot be altered.
A CICS application program disregards whether it is accessing a file by its primary
or alternate key.
See the CICS Administration Guide and the CICS Application Programming Reference
for related information.
107
Even when using generic keys, always use a storage area for the RIDFLD equal in
length to the length of the complete key. During a browse operation, after
retrieving a record, CICS copies the actual identifier of the record retrieved into the
RIDFLD area. CICS returns a complete key to your application, even when you
specified a generic key on the command. For example, a generic browse through a
KSDS returns the complete key to your application on each EXEC CICS
READNEXT and EXEC CICS READPREV command.
108
Clustered files
Entry-sequenced files
Relative files
VSAM emulation of KSDS files by SFS: SFS clustered files are used to emulate
KSDS access to VSAM data. All segments of keys should be defined as being in
ascending sequence. The primary key should not allow duplicate key values.
SFS allows keys to be segmented, that is, made up from two or more fields in any
position in the record. You can use segmented keys in TXSeries CICS where file
services are provided by SFS. However, you should not do so if you intend to
migrate your CICS applications to regions where files services are provided by
DB2, or to a CICS product that does not support segmented keys.
Defining keys affects the order of presentation of records in the following ways:
v If keys are defined using fields that are not byte arrays, then the order of
presentation of records is that which SFS uses.
v If some segments of a key are defined as being in descending sequence, the
order of presentation of records is affected.
v The GTEQ option associated with CICS commands is interpreted in the context
of the ordering of the records used by SFS.
These factors affect CICS behavior when performing EXEC CICS READ and EXEC
CICS STARTBR operations. For example, consider a request from an EXEC CICS
READ command using a GTEQ option for a record with a key of ZZZZ. This
request could yield a record whose key is actually AAAA because of how order
of presentation is handled by SFS.
VSAM-based CICS and distributed CICS interpret the EXEC CICS STARTBR
command differently due to the SFS-imposed record ordering used by distributed
CICS. Under VSAM-based CICS, an EXEC CICS STARTBR command that specifies
a key GTEQ low values begins the search with the first or last records in the file.
Distributed CICS always interprets an EXEC CICS STARTBR request specifying a
key GTEQ low values as a request to start at the first record in a file. Similarly, a
request for a key of high values is always interpreted as a request for the last
record in the file. The record ordering imposed by SFS has precedence irrespective
of where a high values or a low values key might be positioned in the file.
These potential misinterpretations can be avoided by using the sfs_byteArray field
type.
CICS allows the use of files that have a primary index that is not unique. It also
allows the use of files where the alternate indexes have duplicates. When files
having these conditions are used, CICS limits the operations which you can
perform. This limit occurs because all EXEC CICS READ and EXEC CICS READ
UPDATE requests can access only the first of a set of duplicate records. This can be
useful in accessing data prepared by a non-CICS application.
VSAM emulation of ESDS files by SFS: TXSeries CICS emulate ESDS using the
SFS entry-sequenced file organization. The RBA is mapped onto the SFS implicit
primary index for the file. This implicit primary file index is known as an entry
sequence number (ESN). This is not necessarily the actual physical position of the
record in the file, but it does identify the record as unique. The RBA returned to a
CICS application is a four-byte unsigned quantity. This is derived from the
eight-byte SFS entry sequence number. No meaning should be attached to the
actual numeric value of the RBA. These RBA values should be treated as unique
identifiers assigned in an ascending sequence.
109
CICS permits access to files containing records whose ESNs cannot be packed into
a 32 bit RBA. However, records with such ESNs cannot be read, nor can new
records be added to such files because, in each case, no RBA can be returned to the
application.
VSAM emulation of RRDS files by SFS: SFS relative files are used to emulate
RRDS files. SFS requires that the records contain one field to hold the RRN and a
number of other fixed-length fields. For VSAM emulation, ensure that all fields
other than the RRN field be of type sfs_byteArray.
The RRN is mapped onto the SFS relative slot number (RSN). CICS ensures that
data seen by CICS applications does not include the RRN field.
Do not specify any secondary (alternate) indexes for these files.
RRDS files with alternate indexes can be accessed with their RRNs but not with
their alternate indexes. If such files are used, the DUPREC condition occurs if an
insertion or an updates would violate uniqueness constraints.
VSAM alternate index emulation by SFS: Alternate indexes are emulated using
SFS secondary (alternate) indexes, which, like that primary key (index) can be
segmented. Although SFS allows relative files to have secondary (alternate)
indexes, CICS does not support this.
VSAM record emulation by SFS: When defining files to SFS, you must specify
the fields that make up the record. For portable CICS family applications, use only
sfs_byteArray and sfs_varLenByteArray type fields. Use of other data types is
discussed in Functionality differences with SFS on page 112.
The CICS API does not permit records greater than 32 KB in length to be
manipulated. Therefore, the total length of all the fields in your records must be
less than or equal to 32 KB.
Fixed-length records: Fixed-length records must consist of one or more sfs_byteArray
fields, the sum of their lengths equal to the required record length. You need a
separate field for each index to the file, and a sufficient number of other fields to
define the remainder of the record.
For example, Figure 5 on page 111 illustrates a VSAM file having the following
characteristics:
v Record length is 20 bytes
v Primary index has a key that is five bytes long and begins at offset four
v Secondary (alternate) index has a key that is seven bytes long and begins at
offset eleven.
110
To emulate this VSAM file to SFS, you would define five sfs_byteArray fields to SFS
of lengths three, five, two, seven, and three respectively.
Variable-length records: To define a VSAM file that holds variable-length records to
SFS:
1. Specify a number of sfs_byteArray fields for the portion of the record holding
any key fields.
2. Specify one sfs_varLenByteArray type field. Define the length of this field so that
the total record length is the maximum length you need.
3. The variable-length field must be the last field in the record.
Note: The size of the variable-length field is recorded in a four-byte header to the
field by SFS. However, the data that is visible to the CICS application does
not include this four-byte header.
For example, Figure 6 on page 112 shows a VSAM file having a variable-length
record of maximum length of 1000 bytes. The keys for this record are in the same
positions as the keys for the record discussed in Figure 5:
111
To emulate this VSAM file with its variable-length record, you define five
sfs_byteArray fields to SFS of lengths three, five, two, seven, and three respectively,
and one sfs_varLenByteArray of maximum length 979; and again define suitable
indexes.
Note that although SFSs four-byte header to a variable-length field is invisible to
CICS, a CICS application can make use of the field to convey information to the
SFS. A CICS application can write a 40-byte record to SFS with a command such
as:
EXEC CICS WRITE(FILE) FROM(buffer) LENGTH(40)
CICS arranged that the actual record written to SFS has the length of the variable
field of the record (twenty bytes) placed in the field header.
Functionality differences with SFS: The following behavior differences are
important to understand when emulating VSAM files in SFS:
v CICS does not allow simultaneous access to SFS files.
Security facilities are provided to configure SFS and CICS so that simultaneous
access is restricted or prohibited.
v CICS can access SFS records containing data types other than the various byte
arrays. To do this, you must be aware of the restrictions imposed by SFS on
manipulations of these data types.
Numeric data types: SFS does not accept or return partial fields of numeric
types such as sfs_integer. Ensure that applications that access records
containing such fields do not attempt such operations. Examples of how such
requests occur are:
EXEC CICS READ INTO() LENGTH() ...
where the specified length encompasses only part of a numeric field, and:
EXEC CICS READ INTO() LENGTH()
RIDFLD() GENERIC KEYLENGTH()
112
where the generic key specified includes only part of an integer field.
String data types: SFS requires that strings be null terminated. If data is
supplied which is not null terminated, an SFS error can occur, and CICS
raises an ILLOGIC condition.
v CICS does not permit access to files whose records contain more than one
variable-length field. It refuses to open such files.
v SFS permits records to be deleted from Entry Sequenced files. CICS does not
support this function. However, non-CICS processes can delete records from
such files; this means that there is no guarantee that the first record in an ESDS
file has an RBA of zero.
v In general, the use of native SFS calls is not supported. The following conditions
describe the exceptions to this rule:
When XA resource managers are not used, SFS native calls are supported. XA
resource managers are defined with Product Definitions (XAD) entries.
SFS native calls are supported when recoverable use of CICS file services or
CICS queues is simple and does not require the use of EXEC CICS
SYNCPOINT commands.
See the CICS Administration Guide and the CICS Intercommunication Guide for related
information.
113
If the record is defined as fixed-length, then a DB2 table definition can be created
using a series of CHAR columns. One CHAR column is required for each key field.
Additionally, each section of the record that lies before, between, and after the keys
must have a CHAR column to define it. No section can be longer that 254
characters.
Table 17. Fixed-length KSDS with no overlapping alternate index fields emulated in DB2
DB2 columns
PART1
PKEY
PART2
ALTKEY1
PART3
ALTKEY2
PART4
PART5
CHAR(1)
CHAR(5)
CHAR(18)
CHAR(4)
CHAR(16)
CHAR(20)
CHAR(254)
CHAR(182)
NOT
NOT
NOT
NOT
NOT
NOT
NOT
NOT
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
FOR
FOR
FOR
FOR
FOR
FOR
FOR
FOR
BIT
BIT
BIT
BIT
BIT
BIT
BIT
BIT
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
Variable-length KSDS with no overlapping alternate index fields: Table 18 on page 115
and Table 19 on page 115 compare the procedures for creating variable-length
KSDS records in VSAM and for emulating them in DB2:
114
Table 18. Variable-length KSDS with no overlapping alternate index fields in VSAM
KSDS definition
Primary key (offset length) 1
5
Alt key 1 (offset length)
24
4
Alt Key 2 (offset length)
44 20
Record size (avg max)
200 200
CHAR(1)
CHAR(5)
CHAR(18)
CHAR(4)
CHAR(16)
CHAR(20)
VARCHAR(436)
NOT
NOT
NOT
NOT
NOT
NOT
NOT
NULL
NULL
NULL
NULL
NULL
NULL
NULL
FOR
FOR
FOR
FOR
FOR
FOR
FOR
BIT
BIT
BIT
BIT
BIT
BIT
BIT
DATA
DATA
DATA
DATA
DATA
DATA
DATA
Variable-length KSDS with overlapping alternate index fields: Table 20 and Table 21
compare the procedures for creating variable-length KSDS records in VSAM and
for emulating them in DB2. These examples illustrate the handling of overlapping
alternate index fields:
Table 20. Variable-length KSDS with overlapping alternate index fields in VSAM
KSDS definition
Primary key (offset length) 1
5
Alt key 1 (offset length)
24
4
Alt Key 2 (offset length)
44 20
Record size (avg max)
200 200
In this example, the first index comprises columns ALTKEY1A and ALTKEY1B,
while the second index comprises columns ALTKEY1B and ALTKEY2B.
While DB2 allows keys to be segmented, that is made up from one or more fields
in any position in the record, it does not allow you to utilize segmented keys in
CICS on Open Systems where file services are provided by DB2.
Table 21. Variable-length KSDS with overlapping alternate index fields emulated in DB2
DB2 columns
PART1
PKEY
PART2
ALTKEY1A
ALTKEY1B
ALTKEY2B
PART4
CHAR(1)
CHAR(5)
CHAR(18)
CHAR(2)
CHAR(2)
CHAR(18)
VARCHAR(454)
NOT
NOT
NOT
NOT
NOT
NOT
NOT
NULL
NULL
NULL
NULL
NULL
NULL
NULL
FOR
FOR
FOR
FOR
FOR
FOR
FOR
BIT
BIT
BIT
BIT
BIT
BIT
BIT
DATA
DATA
DATA
DATA
DATA
DATA
DATA
115
Data associated with a coded character set: Defining keys affects the order of
presentation of records in the following ways:
v If keys are defined using fields that are not defined as FOR BIT DATA, the order
of presentation of records is that which DB2 uses. This is dependent on the
database code page and the collation sequence specified when the database is
created.
v The GTEQ option associated with CICS commands is interpreted in the context
of the ordering of the records used by DB2.
This impacts CICS behavior when performing EXEC CICS READ and EXEC CICS
STARTBR operations. For example, consider a request from an EXEC CICS READ
command using a GTEQ option for a record with a key of ZZZZ. This request
could yield a record whose key is actually AAAA because of how order of
presentation is handled by DB2.
VSAM-based CICS and distributed CICS interpret the EXEC CICS STARTBR
commands differently due to the DB2imposed record ordering used by CICS.
Under VSAM-based CICS, an EXEC CICS STARTBR command that specifies a key
GTEQ low values begins the search at the first or last records in the file.
Distributed CICS always interprets an EXEC CICS STARTBR request specifying a
key GTEQ low values as a request to start at the first record in a file. Similarly, a
request for a key of high values is always interpreted as a request for the last
record in the file. The record ordering imposed by DB2 has precedence irrespective
of where a high values or a low values key might be positioned in the file.
These potential misinterpretations can be avoided by using the FOR BIT DATA
column types when defining DB2 tables.
VSAM emulation of ESDS files by DB2: CICS emulates ESDS files using a
special 32-bit RBA column. In addition, a sufficient number of other columns is
required define the ESDS record. One column must be defined for each and every
index against the file. Furthermore, a sufficient number of additional columns must
be defined to encompass the remainder of the record. These columns cannot be
associated with a coded character set.
CICS processing ensures that data seen by the CICS application does not include
the RBA column. When a CICS facility, such as cicsddt, is used for DB2 table
creation, an RBA column for a file of type ESDS is automatically generated.
However, if you are using native SQL interfaces to create a table to emulate an
ESDS file, then you must ensure that the first column in the table is named RBA.
Furthermore, this column must be defined as CHAR(4) NOT NULL FOR BIT
DATA.
Tables that emulate ESDS files should be created with a unique primary index
against the RBA column. For performance reasons, it is recommended that you also
create a corresponding index with inverted ordering. For instance, if you create an
ESDS table named ESDSTAB, a primary index could be defined as follows:
CREATE UNIQUE INDEX CICS.ESDSTAB0 ON CICS.ESDSTAB(RBA)
116
No meaning can be attached to the actual numeric value of the RBA. These RBA
values are treated as unique identifiers assigned in an ascending sequence.
This process of creating a unique primary index and a corresponding index having
an inverted order applies to table definitions in the following situations:
v Fixed-length ESDS with no overlapping alternate index fields
v Variable-length ESDS with no overlapping alternate index fields
v Variable-length ESDS with overlapping alternate index fields.
The following sections compare the procedures for creating table definitions for
each of these situations in VSAM and in DB2 emulation. The ESDS table
representation closely follows the equivalent KSDS case.
Fixed-length ESDS with no overlapping alternate index fields: Table 22 and Table 23
illustrate the procedures for creating fixed-length ESDS records in VSAM and for
emulating them in DB2:
Table 22. Fixed-length ESDS with no overlapping alternate index fields in VSAM
ESDS definition
Alt key 1 (offset length)
Alt Key 2 (offset length)
Record size (avg max)
24
4
44 20
500 500
Table 23. Fixed-length ESDS with no overlapping alternate index fields emulated in DB2
DB2 columns
RBA
PART1
ALTKEY1
PART2
ALTKEY2
PART3
PART4
CHAR(4)
CHAR(24)
CHAR(4)
CHAR(16)
CHAR(20)
CHAR(254)
CHAR(182)
NOT
NOT
NOT
NOT
NOT
NOT
NOT
NULL
NULL
NULL
NULL
NULL
NULL
NULL
FOR
FOR
FOR
FOR
FOR
FOR
FOR
BIT
BIT
BIT
BIT
BIT
BIT
BIT
DATA
DATA
DATA
DATA
DATA
DATA
DATA
Variable-length ESDS with no overlapping alternate index fields: Table 24 and Table 25
illustrate the procedures for creating variable-length ESDS records in VSAM and
for emulating them in DB2:
Table 24. Variable-length ESDS with no overlapping alternate index fields in VSAM
ESDS definition
Alt key 1 (offset length)
Alt Key 2 (offset length)
Record size (avg max)
24
4
44 20
200 500
Table 25. Variable-length ESDS with no overlapping alternate index fields emulated in DB2
DB2 columns
RBA
PART1
ALTKEY1
PART2
ALTKEY2
PART3
CHAR(4)
CHAR(24)
CHAR(4)
CHAR(16)
CHAR(20)
VARCHAR(436)
NOT
NOT
NOT
NOT
NOT
NOT
NULL
NULL
NULL
NULL
NULL
NULL
FOR
FOR
FOR
FOR
FOR
FOR
BIT
BIT
BIT
BIT
BIT
BIT
DATA
DATA
DATA
DATA
DATA
DATA
117
Variable-length ESDS with overlapping alternate index fields: Table 26 and Table 27
illustrate the procedures for creating variable-length ESDS records in VSAM and
for emulating them in DB2. These examples illustrate the handling of overlapping
alternate index fields:
Table 26. Variable-length ESDS with overlapping alternate index fields in VSAM
ESDS definition
Alt key 1 (offset length)
Alt Key 2 (offset length)
Record size (avg max)
24
4
44 20
200 500
Table 27. Variable-length ESDS with overlapping alternate index fields emulated in DB2
DB2 columns
RBA
PART1
ALTKEY1A
PART2
ALTKEY1B
ALTKEY2B
PART4
CHAR(4)
CHAR(24)
CHAR(2)
CHAR(18)
CHAR(2)
CHAR(18)
VARCHAR(454)
NOT
NOT
NOT
NOT
NOT
NOT
NOT
NULL
NULL
NULL
NULL
NULL
NULL
NULL
FOR
FOR
FOR
FOR
FOR
FOR
FOR
BIT
BIT
BIT
BIT
BIT
BIT
BIT
DATA
DATA
DATA
DATA
DATA
DATA
DATA
VSAM emulation of RRDS files by DB2: CICS emulates RRDS files using a
special 32-bit RRN column. In addition, a sufficient number of additional columns
must be defined to encompass the remainder of the record. These columns cannot
be associated with a coded character set.
CICS processing ensures that data seen by the CICS application does not include
the RRN column. When a CICS facility, such as cicsddt, is used for DB2 table
creation, an RRN column for a file of type RRDS is automatically generated.
However, if you are using native SQL interfaces to create a table to emulate an
RRDS file, then you must ensure that the first column in the table is named RRN.
Furthermore, this column must be defined as CHAR(4) NOT NULL FOR BIT
DATA.
Tables that emulate RRDS files should be created with a unique primary index
against the RRN column. For performance reasons, it is recommended that you
also create a corresponding index with inverted ordering. For instance, if you
create an RRDS table named RRDSTAB, a primary index could be defined as
follows:
CREATE UNIQUE INDEX CICS.RRDSTAB0 ON CICS.RRDSTAB(RRN)
Do not specify alternate indexes for RRDS files. RRDS files with alternate indexes
can be accessed with their RRNs but not with their alternate indexes. If such files
are used, then DUPREC conditions can occur if insertions or updates would violate
uniqueness constraints.
Table 28 on page 119 and Table 29 on page 119 illustrate the procedures for creating
RRDS files in VSAM and for emulating them in DB2:
118
500 500
CHAR(4)
CHAR(24)
CHAR(2)
CHAR(18)
CHAR(2)
CHAR(18)
VARCHAR(454)
NOT
NOT
NOT
NOT
NOT
NOT
NOT
NULL
NULL
NULL
NULL
NULL
NULL
NULL
FOR
FOR
FOR
FOR
FOR
FOR
FOR
BIT
BIT
BIT
BIT
BIT
BIT
BIT
DATA
DATA
DATA
DATA
DATA
DATA
DATA
VSAM alternate index emulation by DB2: Alternate indexes are emulated using
DB2 secondary indexes. Although DB2 allows relative files to have secondary
indexes, CICS does not support this.
VSAM record emulation by DB2: The CICS API does not permit records greater
the 32 KB in length to be manipulated. Therefore, the total length of all the fields
in your records must be less than or equal to 32 KB.
The size of a variable-length field in DB2 is recorded in a prepended header to the
field. However, the data visible to the CICS application does not include this
header.
Functionality differences with DB2: The following behavior differences are
important to understand when emulating VSAM files in DB2:
v CICS allows simultaneous access to DB2 files, either by two CICS regions, or by
a CICS region and a non-CICS application. Applications need to be designed to
account for this possibility.
Security facilities provided to configure DB2 and CICS can be used to restricted
or prohibited simultaneous access.
v The Numeric and Datetime DB2 data types are not supported by CICS and
cannot be accessed by CICS applications.
v CICS allows the use of files whose primary index is not unique. It also allows
the use of files where the alternate indexes have duplicates. When files with
these conditions are used, CICS limits the operations which you can perform.
This limit occurs because all EXEC CICS READ and EXEC CICS READ UPDATE
requests can access only the first of a set of duplicate records. This can be useful
in accessing data prepared by some non-CICS application.
v CICS does not permit access to files whose records contain more than one
variable-length field. It refuses to open such files.
v DB2 permits records to be deleted from entry sequenced files. CICS does not
support an interface to this. However, non-CICS processes can delete records
from such files; this means that there is no guarantee that the first record in an
ESDS file has an RBA of zero.
See the CICS Administration Guideand the CICS Intercommunication Guide for related
information.
119
Reading records
There are several methods of reading records, including:
v Direct reading
v Sequential reading (browsing)
v Skip-sequential browsing
If the file contains fixed-length records, and if the application program provides an
area into which the record is to be read, that area must be of the defined length. If
the file contains variable-length records, the command must also specify the
maximum length of the area provided to hold the records.
For fixed-length records and for records retrieved into CICS-provided SET storage,
no length argument needs to be specified. However, a specified length argument is
helpful when reading fixed-length records without using a SET command. The
specified length argument ensures that the record being read is not too long for the
available data area. If you provide the length argument, CICS uses the length field
to return the actual length of the record retrieved.
120
Direct reading: The EXEC CICS READ command reads records in a file. The
command must identify the record you want, and it must indicate whether the
record is to be read into an area of storage provided by your application program
(EXEC CICS READ INTO), or into CICS SET storage acquired by file control
(EXEC CICS READ SET). If area is to be CICS SET storage, the address of the data
in the CICS SET storage is returned to your program.
The length of time that the CICS SET storage remains valid depends on whether
the EXEC CICS READ command is issued for UPDATE or read-only access. The
SET storage for a non-update EXEC CICS READ command survives until another
non-update or UPDATE READ command (either INTO or SET) is encountered for
the same CICS file. The SET storage for an EXEC CICS READ UPDATE command
survives until the next EXEC CICS REWRITE, EXEC CICS UNLOCK, EXEC CICS
DELETE (without RIDFLD) or EXEC CICS SYNCPOINT, whichever is encountered
first.
For both UPDATE and non-update commands, you must identify the record to be
retrieved by the record identification field specified in the RIDFLD option.
Immediately upon completion of an EXEC CICS READ UPDATE command, the
RIDFLD data area is available for reuse by the application program.
To support application portability to VSAM environments, you can only specify
one UPDATE operation for each file within a transaction at any given time. Your
next command to the file should be an EXEC CICS REWRITE, EXEC CICS
DELETE without the RIDFLD option, or EXEC CICS UNLOCK.
Direct reading from a KSDS: When reading from a KSDS, you identify the record
you want by specifying its full key. However, if the key is not unique, the
DUPREC condition occurs.
You can also specify a partial (generic) key. When you specify a partial key, both
SFS and DB2 retrieve the first record whose leftmost characters match the partial
key. Additionally, you can retrieve the record in the file whose key is greater than
or equal to the full key provided with the command. Finally, you can also identify
the record you want by providing a generic key together with the greater than or
equal option (GTEQ) .
An EXEC CICS READ command raises the NOTFND condition if no record with
the key specified is found. Also, the NOTFND condition is raised if no record is
found with a key greater than or equal to the specified key when the GTEQ option
is used. Either the GTEQ option or the EQUAL option can be specified. The
EQUAL option requests a record having an exact match with the specified key. The
GTEQ option requests a record with the first key greater than or equal to the
specified key.
Direct reading from an ESDS: When reading from an ESDS, you identify the record
you want by an RBA. Because the RBA of a ESDS record cannot change (unless the
file is reorganized), your application program can keep track of the values of the
RBAs corresponding to the records it wants to access. An access to an ESDS
specifying an incorrect RBA, or an RBA where there is no record, returns the
ILLOGIC condition.
Direct reading from an RRDS: When reading from an RRDS, you identify the record
you want by its relative record number. Again, the application program must know
the RRN values of the records it wants. For records not present in the file, the
NOTFND condition is returned.
Chapter 5. Coding for data services
121
Direct reading by way of a path: If a KSDS or an ESDS has an alternate index and
an appropriate entry in the File Definition, you can retrieve a record in the file by
using the alternate key that you set up in the alternate index. The generic option
and the greater than or equal option still work in the same way as for a read from
a KSDS using the primary key.
If the alternate key in an EXEC CICS READ command is not unique, the first
record in the file with that key is read, and you get the DUPKEY condition. To
retrieve other records with the same alternate key, you have to start a browse
operation at this point.
Sequential reading (browsing): The EXEC CICS STARTBR command begins the
browse function. You must identify a particular record in the same way for a
browse function as for a direct read function. However, EXEC CICS STARTBR only
identifies the starting position for the browse; it does not retrieve a record.
You can reset a browse at any time using the EXEC CICS RESETBR command. Use
EXEC CICS RESETBR to define a new starting position for the browse, or to
change the type of search argument used.
The EXEC CICS READNEXT command reads records sequentially from the file; its
starting point is set by the EXEC CICS STARTBR command. Each time an EXEC
CICS READNEXT command is processed, CICS updates the field specified in the
RIDFLD option with the complete key, relative byte address, or relative record
number of the record retrieved.
The record can be read into an area of storage supplied by the application program
(EXEC CICS READNEXT INTO), or into CICS-provided SET storage (EXEC CICS
READNEXT SET). In the latter case, the CICS SET storage remains valid until the
next EXEC CICS ENDBR for this REQID, or EXEC CICS SYNCPOINT, whichever
is encountered first.
The EXEC CICS READPREV command performs the inverse process to the
READNEXT command; it reads the records sequentially backwards from the
starting point set by the EXEC CICS STARTBR command.
If your file supports unique keys only and you change from EXEC CICS
READNEXT to EXEC CICS READPREV (or the converse), then the same record is
retrieved twice. It is first retrieved by the EXEC CICS READNEXT command, and
then on the READPREV command.
For browsing (and for direct read), if the file contains fixed-length records, and if
the application program provides an area into which the record is to be read, that
area must be of the defined length. If the file contains variable-length records, the
command must also specify the maximum length of the area provided to hold the
records.
Browsing through a KSDS: You can use a generic key on the EXEC CICS STARTBR
command when browsing through a KSDS. However, the browse can only
continue forward through the file. If you process an EXEC CICS READPREV
during a generic key browse, you get the INVREQ condition.
You can use the options EQUAL and GTEQ on the EXEC CICS STARTBR
command. The default is GTEQ option. If no record matches the key specified with
the EXEC CICS STARTBR command, you get the NOTFND condition.
122
123
Skip-sequential browsing: For direct access to records quickly, you can browse
using skip-sequential processing. This type of browsing reduces index search time.
To use skip-sequential processing, you change the key, RBA, or RRN in the
RIDFLD option of the EXEC CICS READNEXT or READPREV command to point
to the next record you want. You can even do this on the first EXEC CICS
READNEXT command or the first EXEC CICS READPREV command after an
EXEC CICS STARTBR or EXEC CICS RESETBR command.
Note: The RIDFLD option on the EXEC CICS READNEXT or READPREV
command must be in the same form (key, RBA or RRN) as that used in the
EXEC CICS STARTBR command or last EXEC CICS RESETBR command. If
you use generic keys on a forward browse, the new RIDFLD must also be a
generic key, although the length can be different.
Specifying a different keylength in the KEYLENGTH option of an EXEC CICS
READNEXT command has the same effect as an EXEC CICS RESETBR command.
To continue browsing from this new point, remove the KEYLENGTH option from
subsequent EXEC CICS READNEXT commands.
If a key equal to search is specified on an EXEC CICS STARTBR command, or an
EXEC CICS RESETBR command, a EXEC CICS READNEXT command using
skip-sequential processing can give a NOTFND condition. It is not possible to
obtain the last record on the file by specifying a complete key of X'FF's during skip
sequential processing. You must use EXEC CICS RESETBR to specify the key in
this form.
Updating records
To update a record, you must first retrieve it using an EXEC CICS READ
command with the UPDATE option. The record is identified in exactly the same
way as for a direct read. After modification by the application program, the record
is written back to the file using the EXEC CICS REWRITE command. In a KSDS or
ESDS, the record can (as with a direct read) be accessed through either the primary
key or any alternate key.
The EXEC CICS REWRITE command cannot identify the record being rewritten. In
any one transaction, CICS allows only a single update to a given file to be in
progress at any time. Therefore, the record being rewritten is identified by the
previous EXEC CICS READ UPDATE command.
A record retrieved as part of a browse operation can not be updated during the
browse. The application program must end the browse; read the desired record
with an EXEC CICS READ UPDATE, and perform the update. Failure to do this
can cause a deadlock.
The record to be updated can (as in the case of a direct read) be read into an area
of storage supplied by the application program or into CICS-provided SET storage.
If the record is read into CICS SET storage, it should normally be copied into
application program storage and rewritten from that storage. For an EXEC CICS
READ UPDATE command, CICS SET storage remains valid until the next EXEC
CICS REWRITE, EXEC CICS UNLOCK, EXEC CICS DELETE (without RIDFLD) or
EXEC CICS SYNCPOINT, whichever is encountered first.
For a KSDS, the primary key in the record must not be altered when the record is
modified. Similarly, if the update is being made by way of an alternate index, the
124
alternate key used to identify the record must not be altered either, although other
alternate keys can be altered. If the file allows variable-length records, the length of
the record can be changed.
Specifying record length: When rewriting a fixed-length record, do not include
the length with the command. If the length is specified, and does not agree with
that defined to SFS or DB2, then the record is not written.
For variable-length records, you must specify the length with both the EXEC CICS
READ and the EXEC CICS REWRITE commands. The length specified must be less
than, or equal to, the keyspan of the underlying SFS file (including alternate
indexes). If the length specified is greater than the maximum defined to SFS or
DB2, then a record is truncated.
Note that the length of records read from an ESDS cannot be changed.
Deleting records
CICS does not allow records to be deleted from an ESDS.
You can delete a record in a KSDS or RRDS by first retrieving it for update, and
then issuing an EXEC CICS DELETE command. You can also delete a record in a
single operation, again using the EXEC CICS DELETE command. In this case, you
must identify the record to be deleted as part of the command by specifying the
RIDFLD option. For a KSDS or RRDS, instead of rewriting the record, the
application program can issue an EXEC CICS DELETE command to erase it from
the file. As in the case of the EXEC CICS REWRITE command, the record to be
deleted must not be identified within the EXEC CICS DELETE command, but is,
by default, the record most recently read for update. When an EXEC CICS
DELETE command follows a EXEC CICS READ UPDATE, it must not include the
RIDFLD option. If RIDFLD is included, an INVREQ condition is returned to the
application program.
If a full key is provided with the EXEC CICS DELETE command, a single record
with that key is deleted. So, if the file is being accessed by way of an alternate
index path that allows non-unique alternate keys, only the first record with that
key is deleted. After the deletion, you know if further records exist with the same
alternate key, because you get the DUPKEY condition if they do.
Unlocking: Use the EXEC CICS UNLOCK command to release a lock held by an
EXEC CICS READ UPDATE command without rewriting or deleting the record.
EXEC CICS UNLOCK releases any CICS storage acquired for the EXEC CICS
READ and releases SFS resources held by the EXEC CICS READ.
Deleting groups of records (generic delete): You can use a generic key with the
EXEC CICS DELETE command. Then, instead of deleting a single record, all the
records in the file whose keys match the generic key are deleted with the single
command. The number of records deleted is returned to the application program if
the NUMREC option is included with the command. If access is by way of an
alternate index path, the records deleted are those whose alternate keys match the
generic key.
Adding records
You can add new records to a file with the EXEC CICS WRITE command. They
must always be written from an area provided by the application program.
125
Adding to a KSDS: When a record is being added to a KSDS, the primary key of
the record identifies the position in the file where the record is to be inserted. The
application program must specify the key using the RIDFLD option on the EXEC
CICS WRITE command, even though the key is part of the record.
A record added to a KSDS by way of an alternate index is also inserted into the
file in the position determined by the primary key. However, in this case the
RIDFLD option must be used to specify the alternate key.
Adding to an ESDS: A record added to an ESDS is always added to the end of
the file. You cannot insert a record in an ESDS between existing records. After the
operation is completed, the relative byte address (RBA) identifying the record is
returned to the application program.
When adding a record to an ESDS by way of an alternate index path, the record is
also placed at the end of the file. The command must include the alternate index
key in the same way as for a KSDS path. The commands are the same whether
you are using an ESDS or a KSDS so the application program is not affected by
which type of file is in use.
Adding to an RRDS: To add a record to an RRDS, include the relative record
number (RRN) as a record identifier on the EXEC CICS WRITE command. The
record is then stored in the file in the position corresponding to the RRN.
Specifying record length: When writing to a fixed-length file, do not include the
length with the command. If the length is specified, and does not agree with that
defined to SFS or DB2, then the record is not written.
If the file is defined as containing variable-length records, the command must
always include the length of the record. The length specified must be less than, or
equal to, the keyspan of the underlying SFS or DB2 file (including alternate
indexes). If the length specified is greater than the maximum defined to SFS or
DB2, then a truncated record is written.
See the CICS Administration Reference and the CICS Application Programming
Reference for related information.
126
identifier of the record retrieved. (You can alter the RIDFLD value to set a new
position from which to continue the browse.)
The RIDFLD option identifies a field containing the record identification
appropriate to the access method and the type of file being accessed. By itself, the
RIDFLD option usually is not enough to identify a specific record in the file. In
addition, one or both of the options GTEQ and GENERIC can be used with your
command. You use the GTEQ option to search for the first key that is greater than
or equal to the key specified in RIDFLD. The GENERIC option is available if you
are specifying an imprecise or partial key. These rules apply in the following
circumstances:
v When any record retrieval is done from a KSDS
v When an alternate index path is used from a KSDS or ESDS
v When setting a starting position for a browse in a KSDS or ESDS
Indexing and the RIDFLD option: An index can contain multiple fields. When you
create a schema (see the CICS Administration Reference), the index is made up of the
fields listed in the Field Names for Primary Index or Secondary Index - Field
Names fields. This list is separated by spaces, as shown in these example fields
for an address record: number street state zip. However, the fields are not separated
by spaces when you pass the field names with the RIDFLD option, for example:
numberstreetstatezip). When passed by the RIDFLD option, these fields are
concatenated together in the same order in which the fields are defined in the
schema file definitions. This is not necessarily the same as the order in which the
fields appear in each file record.
Using our address record field example, you can assume that the file definition
consists of 4 fields, all of which are byteArrays of 1 byte each. If an index file were
made up of field 2 and field 4, then the RIDFLD for record numberstreetstatezip
would be streetzip. The command would be specified as:
EXEC CICS WRITE FILE() FROM("numberstreetstatezip") RIDFLD("streetzip")
This means that any field in an index can be sorted in any order. If we use the
address record example, the file contains house numbers, street name, states and
zip codes. This file can be sorted on states, and a alternate index can sort on zip
codes. An index on the street name field allows a search for all entries matching
the street name Maple. Alternate indexes allow search criteria to be combined to
yield a more narrow match, for example, a search for all entries matching the street
name Maple and matching the state Maine.
Any field in an index can be sorted in ascending or descending order. And any
field can be unique or non-unique. This explanation applies only to KSDS files, or
a KSDS path over an ESDS file.
Combining the KEYLENGTH and RIDFLD options: In general, file services
commands need the RIDFLD and KEYLENGTH options. The KEYLENGTH option
can be specified explicitly in the command, or determined implicitly from the SFS
file definition.
For remote files (that is, those for which the SYSID option has been specified), the
KEYLENGTH option must be specified if RIDFLD holds a key.
Chapter 5. Coding for data services
127
When accessing remote files, refer to the documentation for the underlying file
manager for any restrictions in specifying CICS file services commands.
See the CICS Intercommunication Guide and the CICS Application Programming
Reference for related information.
Using the INTO and SET options: With the EXEC CICS READ, EXEC CICS
READNEXT, or EXEC CICS READPREV commands, the record is retrieved and
put in main storage according to the INTO and SET options.
v The INTO option specifies the main storage area into which the record is to be
put.
For fixed-length records, do not include the LENGTH option. If you do, the
length specified must exactly match the defined length, or you get the
LENGERR condition.
For variable-length records, always specify (in the LENGTH option) the longest
record your application program accepts. (This value is likely to correspond with
the value defined to SFS as the maximum record size when the file was created.)
If you do not specify the LENGHTH option, you get the LENGERR condition.
The LENGERR condition occurs if the record exceeds this maximum length, and
the record is then truncated to that length. After the record retrieval, if you
include the LENGTH option, the data area specified in it is set to the actual
record length (before any truncation occurs).
v The SET option specifies a pointer to the address that holds the record. This
address, which is acquired by CICS, points to the buffer in main storage that
holds the record. When using the SET option, do not include the LENGTH
option. If you do include it, the data area specified is set to the actual record
length after the record has been retrieved.
Using the FROM option: When you add records (using the EXEC CICS WRITE
command), or update records (using the EXEC CICS REWRITE command), the
record that is to be written is specified with the FROM option.
The FROM option specifies the main storage area that contains the record to be
written. In general, this area is part of the storage owned by your application
program. With the EXEC CICS REWRITE command, the storage area indicated by
the FROM option is usually (but not necessarily) the same area as the
corresponding area indicated by the INTO option on the EXEC CICS READ
UPDATE command. The length of the record can be changed when rewriting to a
variable-length KSDS.
Always include the LENGTH option when writing to a variable-length file. If the
value specified exceeds the maximum allowed in the SFS definition, The
LENGERR condition is raised when the command is executed, and a truncated
record is written. The LENGERR condition is also raised if the length option is
omitted when accessing a variable-length file.
When writing to a fixed-length file, CICS uses the length specified in the SFS file
definition as the length of the record to be written. So, the LENGTH option is not
needed. If you do use the LENGTH option, its value is checked against the defined
value, and you get the LENGERR condition if the values do not match.
See the CICS Administration Reference and the CICS Application Programming
Reference for related information.
128
---> record 1
---> record 2
---> record 2
---> record 1
---> record 1
Transaction A has acquired the record lock for record 1. Transaction B has similarly
acquired the record lock for record 2. The transactions are then deadlocked because
each wants to acquire the lock held by the other.
A transaction can have to wait for a resource while executing file control
commands for several reasons:
v For SFS files, any record that is being modified is held in exclusive control for
the duration of the request.
v If a transaction has modified a record in a recoverable file, SFS locks out access
to that record by all transactions except the transaction that made the
modification. This lock continues even after the request that performed the
change has completed. This allows that transaction to continue to access and
modify the same record. Other transactions must wait until the initial transaction
releases the lock. The release occurs in either of two ways: by terminating the
transaction or by issuing a syncpoint request.
Whether a deadlock actually occurs depends on the relative timing of the
acquisition and release of the resources by different concurrent transactions.
Application programs can continue to be used for some time before meeting
circumstances that cause a deadlock; so it is important to recognize and allow for
the possibility of deadlock early in the application program design stages.
Using the INVREQ condition to avoid deadlocks: CICS recognizes specific
situations that can lead to a deadlock and stops them by returning the INVREQ
condition to your application. For example, CICS does not allow a transaction to
issue an EXEC CICS READ UPDATE, EXEC CICS WRITE, or EXEC CICS DELETE
with RIDFLD request to a particular file if the transaction issued a previous EXEC
CICS READ UPDATE to the same file, and the request has not yet been completed
by an EXEC CICS REWRITE, EXEC CICS DELETE, or EXEC CICS UNLOCK
command.
Tips to avoid deadlocks: CICS does not detect every situation that might cause a
deadlock. You can avoid deadlocks by following these rules:
129
Queue services
Queues are sequential storage facilities that are global resources within either a
single CICS region or a system of interconnected CICS regions. That is, queues, like
files and databases, are not associated with a particular task. Any task can read,
write or delete queues, and the pointers associated with a queue are shared across
all tasks.
Two types of queues are provided by CICS: transient data queues and temporary
storage queues. Although these names imply impermanence, CICS queues are
permanent storage. Except for temporary storage queues kept in main storage,
CICS queues persist across executions of CICS, unless explicitly discarded in a cold
start. Both of these queue types are discussed and compared in the following
sections.
Intrapartition destinations
Intrapartition destinations are data queues that are located on direct-access storage
devices. These destinations are available for use with one or more programs
running as separate tasks within the CICS region. Data directed to or from these
internal destinations is called intrapartition data. Intrapartition transient data
queues are efficient, but they must be created and processed entirely within CICS.
Typical uses of intrapartition data include:
v Message switching
v Broadcasting
v Database access
v Routing of output to several terminals (for example, for order distribution)
v Queuing of data (for example, for assignment of order numbers or priority by
arrival)
v Data collection
130
Extrapartition destinations
Extrapartition destinations are queues (files) residing on any file system resource
(disk, tape, printer, and so on) that are accessible by programs outside (or inside)
the region. In general, sequential extrapartition destinations are used for storing
and retrieving data outside the region. For example, one task can read data from a
remote terminal, edit the data, and write the results to a file for subsequent
processing in another region. Logging data, statistics, and transaction error
messages are examples of data that can be written to extrapartition destinations. In
general, extrapartition data created by CICS is intended for subsequent input to
non-CICS programs. Data can also be routed to an output device such as a line
printer.
CICS uses extrapartition transient data queues to handle standard system files.
Any system file can be processed sequentially with CICS extrapartition transient
data. Extrapartition transient data files are not recoverable.
Data directed to or from an external destination is called extrapartition data and
consists of sequential records that are fixed-length or variable-length. The record
format for an extrapartition destination must be defined in the TDD. (Refer to the
CICS Administration Reference for details.)
You cannot delete an extrapartition queue.
CICS provides three different logical organizations for the byte-stream data stored
in extrapartition queue data files:
v Fixed-length records
v Variable records
v Terminated records, which subdivide into:
Line-oriented records
Null-terminated records
Byte-terminated records
Fixed-length record files: Fixed-length record files partition the byte stream into
adjacent, nonoverlapping blocks of bytes, all of the same length. The size of the
block for a given queue can take any value between 1 and the maximum permitted
record size (32767), but must remain fixed for all records in the file. Users must
supply records of the chosen length in an EXEC CICS WRITEQ TD call and expect
to receive a record of that length when performing an EXEC CICS READQ TD call.
Files whose length is not a multiple of the chosen record size are regarded as
incorrectly formatted and can lead to IOERR conditions being raised if a task
attempts to operate on the corresponding queue.
Variable-length record files: Variable-length record files partition the file byte
stream into adjacent, nonoverlapping blocks of bytes of varying length, each of
which is preceded by a two-byte length count used to determine the length of the
following record. The record can be of any length between 1 and the maximum
permitted record size. Users should not supply the length bytes in the record
passed to an EXEC CICS WRITEQ TD call as it is written to the file by CICS. The
record returned on an EXEC CICS READQ TD call does not contain the length
bytes. Refer to the TDD RecordLen attribute description in the CICS Administration
Reference for information on how the permitted record size is established.
The length count is stored in the file high byte first. Applications reading a file
written by CICS determine the record length by reading the first byte, multiplying
it by 256 and then adding the second byte. This should generate a value between 1
Chapter 5. Coding for data services
131
and the maximum permitted record size, giving the size of the following record in
bytes. The next record can be obtained by reading this number of bytes from the
file. If another record is stored in the file (end of file is not reached), the same
procedure can be repeated to obtain subsequent records.
Files with negative or zero record lengths and files whose last record falls short of
the last record length are regarded as incorrectly formatted and can lead to IOERR
conditions being raised if a task attempts to operate on the corresponding queue.
Terminated record files: Terminated record files partition the file byte stream into
adjacent, nonoverlapping blocks of bytes of varying length, each of which ends
with a common terminating byte. The three subcategories correspond to different
choices for this terminating byte:
v Line-oriented record files employ X'10', the ASCII newline character, as a
terminator. (This is particularly useful as a format for queues containing
readable text because it allows the file to be viewed/written using conventional
text editors).
v Null-terminated record files employ X'00', the ASCII null character, as a
terminator.
v Byte-terminated record files employ a user-defined byte in the range 0 to 255 as
a terminator. (This actually subsumes the preceding categories; they are merely
provided as convenience interfaces to support commonly employed formats).
Users should not append the terminator byte to the record passed to an EXEC
CICS WRITEQ TD call as it is written to the file by CICS. The record returned on
an EXEC CICS READQ TD call does not contain the terminator byte.
Normally, the terminator byte should not appear embedded anywhere in the
record supplied in an EXEC CICS WRITEQ TD call. Any program which
subsequently reads the file is not able to distinguish such embedded terminator
bytes from the byte appended by the EXEC CICS WRITEQ TD call. (This applies in
particular when the file is to be reused as the source for an input TD queue.) The
result of embedding terminator bytes in the record data is an apparent
fragmentation of the record into separate sub-records. In the case where a
line-oriented queue is employed to write readable text, this can not be a restriction.
Indirect destinations
Intrapartition and extrapartition destinations can be used as indirect destinations.
Indirect destinations provide some flexibility in program maintenance by allowing
data to be routed to one of several destinations with changes being required only
in the TDD, not in the program.
When the TDD has been changed, application programs continue to route data to
the destination using the original symbolic name; however, this name is now an
indirect destination that refers to the new symbolic name. Because indirect
destinations are established by means of TDD entries, you do not need to be
concerned with how this is done.
132
133
In general, use temporary storage queues of more than one record only when
direct access or repeated access to records is necessary. For sequential files, use
transient data queues.
Some uses of temporary storage queues follow:
v A suspend file. Assume a data collection task is in progress at a terminal. The
task reads one or more units of input and then allows the terminal operator to
interrupt the process by some kind of coded input. If not interrupted, the task
repeats the data collection process. If interrupted, the task writes its incomplete
data to temporary storage and terminates. The terminal is now free to process a
different transaction (perhaps a high-priority inquiry). When the terminal is
available to continue data collection, the operator initiates the task in a resume
mode, causing the task to recall its suspended data from temporary storage and
continue as though it had not been interrupted.
v Preprinted forms. An application program can accept data to be written as
output on a preprinted form. This data can be stored in temporary storage as it
arrives. When all the data has been stored, it can first be validated and then
transmitted in the order required by the format of the preprinted form.
v Data sharing. Temporary storage is most suited to the task of data sharing
because there is no need to predefine the facility (as is necessary for file usage).
This is particularly true for scratchpad data.
v Paging through large quantities of data. You can read from a file in sections (for
example, 10K), and put the sections into a temporary storage queue. This
approach allows the display of only as much data as the screen can hold, and
permits paging up and down. This approach is quicker than successive file
access, especially if the data is being accessed remotely. This approach is not
recommended if an update to the file is required.
134
having a name that exactly matches an eight character TSD name, the TSD
entry becomes a temporary storage queue.
Temporary storage queue names are byte strings, not character strings. They can be
made up from any bytes including binary zeros, and are not null terminated.
The CECI transaction pads names that are shorter than eight bytes with spaces
when reading from or writing to a temporary storage queue. The name is not null
terminated (unlike other names in CICS). The name has pattern matching rules
associated with it that vary depending on whether the queue is local or remote.
This is explained in the CICS Administration Reference.
If you write to a temporary storage queue from a transaction using a queue name
that is less than eight characters, CICS reads eight bytes from the start of the queue
name. This results in unexpected characters at the end of the queue name.
Therefore, it is recommended that you always allocate eight bytes for the
temporary storage queue name.
Temporary data can be retrieved by the originating task or by any other task using
the symbolic name assigned to it. Specific items (logical records) within a queue
are referred to by relative position numbers. To avoid conflicts caused by duplicate
names, establish a naming convention. For example, the user identifier, terminal
identifier, or transaction identifier could be used as a prefix or suffix to each
programmer-supplied symbolic name.
The TSD entries can resolve to remote temporary storage queue templates, by
entering values for the RemoteSysId and the RemoteName attributes in the TSD.
Enter the sysid (up to four ASCII characters) of the remote region on which the
queue is to reside in the RemoteSysId and the Communications Definitions (CD),
and the name of the temporary storage template on that remote region in the
RemoteName. The local temporary storage queue template name and the remote
TSD entry name must be the same length. If you write to a queue that matches the
local template, CICS replaces the template name at the start of the queue with the
remote template name.
For example, you could have a local TSD entry with the name LOCALQ, defined
with RemoteName=REMOTQ and with a RemoteSysid specified. If you write to a
queue called LOCALQXX locally, the queue that is written to on the remote region
is called REMOTQXX.
135
In the special case where a template name is exactly eight characters long, and the
TSD entry becomes a temporary storage queue, you must use EXEC CICS
DELETEQ TS to delete all items from the queue before you delete this TSD entry
using cicsdelete.
Queue aging
Temporary storage has a queue aging facility that automatically deletes queues that
have not been accessed for a specified number of days. The number of days are
defined with the Region Definitions (RD) TSQAgeLimit attribute. The storage
occupied by these queues is freed and becomes available to temporary storage
once again.
This feature is useful for temporary storage where queues are created dynamically
when required. It is not needed for files or transient data queues that must be
predefined before use.
Queue attributes
Temporary storage queues are created when the first write command is issued to
them. Attributes (such as RemoteSysId, RemoteName, and RecoverFlag) are
inherited from the longest matching queue template found in the TSD.
To use main storage for a queue, use the MAIN option on the EXEC CICS
WRITEQ TS command that writes the first item to the queue. Temporary storage
queues use auxiliary storage by default.
See the CICS Application Programming Referenceand the CICS Administration Reference
for related information.
136
number). They can be read any number of times and are never removed from
the queue until the entire queue is purged.
These differences make transient data queues inappropriate for scratchpad data,
but suitable for queued data, such as audit trails and output to be printed. In fact,
for data that is read sequentially once, transient data queues are preferable to
temporary storage for the following reasons:
v Items in a temporary storage queue can be changed; items in transient data
queues cannot.
v Transient data queues are always written to a file. (There is no form of transient
data queue that corresponds to main temporary storage.)
v You can define transient data queues so that writing items to the queue causes a
specific transaction to be initiated (for example, to process the queue).
Temporary storage queues have nothing that corresponds to this trigger
mechanism, although you are able to use a START command to perform a
similar function.
v Transient data queues have more varied recovery options than temporary
storage queues. They can be physically or logically recoverable.
v Because the commands for intrapartition and extrapartition transient data are
identical, you can switch easily between the internal CICS facility (intrapartition)
and an external data set. To do this, you need only change the TDD, not your
application programs. Temporary storage queues have no corresponding
function of this kind.
Journal services
CICS provides facilities for creating and managing journals during CICS
processing. A journal is a set of special-purpose sequential files. Journals can
contain any and all data the user needs to facilitate subsequent reconstruction of
events or data changes. For example, a journal might act as an audit trail, a
change-file of database updates and additions, or a record of transactions passing
through the system (often called a log). Each journal can be written from any task.
CICS journals provide an alternative to extrapartition transient data queues,
although only for output files. Each journal command specifies operation
characteristics (for example, synchronous or asynchronous), whereas extrapartition
operations are governed entirely by the Transient Data Definitions (TDD). CICS
journals have slightly higher overhead than extrapartition transient data queues.
Journal services commands are provided to allow the application programmer to:
v Create a journal record (JOURNAL)
v Synchronize with (wait for completion of) journal output (WAIT JOURNAL).
The responses of a journal control command to conditions that occur during
execution are discussed in Error-handling services on page 233.
137
CICS journaling
Journals are fundamental to the recoverability of transactions. In particular, CICS
uses the system journal to log transaction commit processing and syncpoint data so
that CICS can recover all necessary recoverable resources in the event of a CICS or
a transaction failure.
Before considering journaling in detail, we need to review the different facets of
CICS logging and recovery in order to clarify the reasons for logging.
CICS journaling
CICS provides the following journaling facilities:
v A system journal
v User journals numbered 1 through 99
At startup CICS initializes the CICS system journal followed by any user journals.
CICS abnormally terminates if any of the following conditions occur:
v It cannot open the system journal
v It cannot write to the system journal
v It cannot open a crucial user journal
During a system shutdown, the output from all journals is synchronized, and they
are then closed.
You use the EXEC CICS JOURNAL and EXEC CICS WAIT JOURNAL commands
in your application to write to a journal and to synchronize the journals you are
using.
138
See the CICS Administration Guide, the CICS Administration Reference, and the CICS
Application Programming Reference for related information.
Journal records
Data can be written to any journal specified in the Journal Definitions (JD), which
define the journals available during a particular CICS execution. Each journal is
identified by a number known as the journal identifier. This number can range
from 1 through 99.
Journal 1 is used as the system log on other CICS products. Therefore, consider
starting from journal 2 for applications that are possibly used on other CICS
products.
When a journal record is built, the data is moved to the journal buffer area. All
buffer space and other work areas needed for journal operations are acquired and
managed by CICS. The user task supplies only the data to be written to the
journal.
Journal records are written in a special format. Each record has a system prefix, an
optional user-built prefix, and a variable record length. Journals are normally
opened for output; in this mode, many users can share the journal. CICS serializes
the writes and helps ensure data integrity.
CICS does not provide online facilities for reading journals.
Each journal record begins with a standard length field, a user-specified identifier,
and a system-supplied prefix. This data is followed in the journal record by any
user-supplied prefix data (optional), and finally by the user-specified data. Journal
control services are designed so that the application programmer requesting output
services need not be concerned further with the detailed layout and precise
contents of journal records. The programmer needs to know only which journal to
use, what user data to specify, and what user-identifier to supply.
Journal records are written to extrapartition TD queues in variable-length record
format. The format of the journal records is specified below in order to allow you
to read and process them in user recovery routines.
Table 30. Journal record format
Byte
Offset
Length
Format
Description
integer
integer
Journal ID
integer
integer
integer
10
integer
12
integer
14
integer
16
string
18
integer
20
integer
139
Length
Format
Description
22
bytes
22+n
bytes
User data
Note: The implementation of journal records in IBM CICS for Windows and CICS
on Open Systems as extrapartition TD queues is not the same as in other
CICS platforms. This does not affect the API. However, you can see transient
data messages, abend codes, and symrecs when using journal records.
See the CICS Application Programming Reference, the CICS Administration Reference,
and the CICS Administration Guide for related information.
140
v File system buffers are flushed (this takes place periodically and when file
system buffer shortages occur).
When any one of these occurs, all journal records present in the buffer, including
any deferred output resulting from asynchronous requests, are written to auxiliary
storage as one block.
The advantages that can be gained by deferring journal output are:
v Transactions can get better response times by waiting less
v The load of physical I/O requests on the host system can be reduced
However, these advantages are achievable only at the cost of more buffer space
and greater programming complexity. It is necessary to plan and program to
control synchronizing with journal output. Additional decisions that depend on the
data content of the journal record and how it is to be used must be made in the
application program. In any case, the full benefit of deferring journal output is
obtained only when the load on the journal is high.
The STARTIO option is used in EXEC CICS JOURNAL commands to request that
the journal output operation be initiated immediately. This is the default behavior
for CICS, as a write operation to filesystem buffers is always performed
immediately, regardless of the presence or absence of the STARTIO option. Control
is returned to the requesting program immediately after the record is buffered,
unless the WAIT option is used, in which case the return is delayed until after the
journal record has become permanent. The WAIT option should not be used
unnecessarily because, if every journal request uses WAIT, no improvement over
synchronous output requests (in terms of reducing the number of physical I/O
operations) is possible.
If there is insufficient file system space available to write the journal record at the
time of the request, the NOJBUFSP condition occurs. If no HANDLE CONDITION
request is active for this condition, the requesting task loses control and is
suspended until space becomes available again and the journal record has been
written to the journal.
If the requesting task is not willing to lose control (for example, if some
housekeeping must be performed before other tasks get control), a HANDLE
CONDITION command should be issued. If the NOJBUFSP condition occurs, no
journal record is built for the request, and control is returned directly to the
requesting program at the location provided in the HANDLE CONDITION
request. The requesting program can perform any housekeeping needed before
reissuing the journal output request.
When using journal 1, which is the system journal on other CICS systems, it is
advisable to specify a journal type identifier (JTYPEID) to distinguish between user
journal record types and system journal record types.
See the CICS Administration Reference and the CICS Application Programming
Reference for related information.
141
Note: TXSeries CICS on Windows allows access to Microsoft SQL server that
provides a programmable interface through ODBC API in C, IBM VisualAge
COBOL programs.
|
|
|
If the relational database management system (RDBMS) you are using is not
compliant with the X/Open XA standard, or you are not accessing that RDBMS
with the XA interface, you cannot use two-phase commit between the resources
that are coordinated by CICS.
Note: Some databases mentioned in this section are possibly not supported by
your CICS product. Refer to the information about supported products in
the Release Notes.
In this example, MYTABLE is the object that is being accessed by CICS. This object
resides outside of the CICS schema in a schema named NOTCICS.
Do not use the EXEC SQL SET CURRENT PACKAGESET NOTCICS command to
enable access to this object without the schema name identifier. Using this
approach causes all access to the database to default to the new schema name,
even access to the TS or TD queues if DB2 was being used as the file control for
the CICS region. The PACKAGESET identifier MUST then be reset back to CICS
before you access any TS or TD queues.
Therefore, it is recommended that you avoid the use of the SQL SET CURRENT
PACKAGESET call. Instead, qualify the object to be accessed with the schema
name when the object resides outside the CICS schema.
DB2 allows a CICS transaction to CONNECT to any database that has been
defined as an XA resource in the Product Definitions (XAD). If you have only one
database defined, then CICS establishes implicit connections to the database with
the XA interface. For further information on using CONNECT in an XA
environment with DB2, see the appropriate documentation for your version of
DB2.
142
With the exception of DB2, do not use any relational database commands to
connect to or to disconnect from the database. CICS establishes implicit
connections to the database via the XA interface.
Do not use the Microsoft SQL Server CONNECT statement in an XA enabled CICS
environment. The set of all possible Microsoft SQL Server SQL connections to be
used from CICS applications in a specific region should be defined in the Product
Definitions (XAD) stanza for that region. CICS establishes long running
connections to the Microsoft SQL Server during application initialization. Each
connection should be identified by a unique connection name defined in the XAD
XAOpen string. You can switch between connections in your application by using
the following call:
EXEC SQL SET CONNECTION name
143
SQL
SQL
SQL
SQL
ROLLBACK WORK
CONNECT RESET
ROLLBACK
DISCONNECT
If you are coding in C, ensure that all EXEC CICS ABEND calls are preceded by
RDBMS calls to free the database. For example, the following would be included
before each EXEC CICS ABEND call for DB2 non-XA programs:
EXEC SQL ROLLBACK WORK
EXEC SQL CONNECT RESET
144
For Oracle:
EXEC SQL ROLLBACK
EXEC CICS RELEASE
For DB2:
EXEC
EXEC
EXEC
EXEC
SQL
SQL
SQL
SQL
ROLLBACK WORK
CONNECT RESET
ROLLBACK
DISCONNECT
If you are coding in C, ensure that all EXEC CICS ABEND calls are preceded by
RDBMS calls to free the database. For example, the following would be included
before each EXEC CICS ABEND call:
For Informix non-XA C programs:
EXEC SQL ROLLBACK WORK;
EXEC SQL CLOSE DATABASE;
sqlexit();
Note: Refer to xii for a description of how prodDir is used to represent the product
pathname.
See the following for more details on how to configure, build, and install the
transaction:
prodDir/src/examples/xa/uxa1.README
Supplier
Supplier Address
Order
Quantity
stilton
Northern Dairies
Richmond (Yorks)
23
145
Supplier
Supplier Address
Order
Quantity
wensleydale
Northern Dairies
Richmond (Yorks)
14
cheddar
Gorge Supplies
Wells (Somerset)
10
brie
La Rochelle Importers
Dover (Kent)
45
camembert
La Rochelle Importers
Dover (Kent)
33
edam
Felixstowe
(Suffolk)
43
cheshire
Manchester Dairies
Manchester
18
gouda
Felixstowe
(Suffolk)
44
red leicester
Midlands Dairies
Leicester (Leics)
34
boursin
La Rochelle Importers
Dover (Kent)
53
This sample transaction comprises 4 panels. These four panels are used to:
v View a cheese order (see panels 1 and 2)
v Update a cheese order (see panel 3)
v Review cheese order messages (see panel 4)
These panels are described in the BMS map source in:
$CICS/src/examples/xa/uxa1.bms
The following transaction, UXA1, allows the user to query the number of cheeses
of a particular type that have been ordered, and to update this number if required.
Messages are displayed on the fourth panel. Refer to the table that follows the
example for a description of the code.
The following example code has been written to support Oracle. It is necessary to
define the particular database against which the transaction runs (see line 16).
Other than line 16, the source is identical.
Refer to the uxa1.README file for the actual name of this example. Refer to
Table 32 on page 149 for a description of this program:
1 /*
2 * Transaction: UXA1
3 * Program:
UXA1PROG
4 * Mapset:
UXA1
5 */
6
7 #include <stdio.h>
8 #include <cics_packon.h>
9 #include "uxa1.h"
10 #include <cics_packoff.h>
11
12 #define NOCHEESE "There is no such cheese in the table"
13 #define UPDATECHEESE "The cheese table was successfully updated"
14
15 /* define either ORA7 or INF5 here */
16 #define ORA7
17
18 #ifdef ORA7
19 #define SQLNOTFOUND 1403
20 #endif
21
146
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
147
88
89
90
91
92
93
EXEC CICS SEND CONTROL FREEKB;
94
EXEC CICS RETURN;
95
}
96
97 /* Fill in and send the second map */
98
99 #ifdef ORA7
100
sprintf(panel2.panel2o.nameo, "%s", name.arr);
101 #endif
102 #ifdef INF5
103
sprintf(panel2.panel2o.nameo, "%s", name);
104 #endif
105
sprintf(panel2.panel2o.supplo, "%s",supplier);
106
sprintf(panel2.panel2o.addresso, "%s", supplier_address);
107
sprintf(panel2.panel2o.ordero, "%d", order_quantity);
108
109
EXEC CICS SEND MAP("PANEL2") MAPSET("UXA1") FREEKB ERASE RESP(rcode);
110
if (rcode != DFHRESP(NORMAL))
111
EXEC CICS ABEND ABCODE("X003");
112
113
/* Receive the response */
114
115
EXEC CICS RECEIVE MAP("PANEL2") MAPSET("UXA1") RESP(rcode);
116
if (rcode != DFHRESP(NORMAL))
117
EXEC CICS ABEND ABCODE("X004");
118
119
if (panel2.panel2i.questi == y)
120
{
121
122
/* Send the third map */
123
124
EXEC CICS SEND MAP("PANEL3") MAPSET("UXA1") FREEKB ERASE \
RESP(rcode);
125
if (rcode != DFHRESP(NORMAL))
126
EXEC CICS ABEND ABCODE("X005");
127
128
/* Receive the response */
129
130
EXEC CICS RECEIVE MAP("PANEL3") MAPSET("UXA1") RESP(rcode);
131
if (rcode != DFHRESP(NORMAL))
132
EXEC CICS ABEND ABCODE("X006");
133
134
/* Update the Database */
135
136
order_quantity = atoi(panel3.panel3i.newordi);
137
138
EXEC SQL UPDATE cheese
139
set order_quantity = :order_quantity
140
where name = :name;
141
142
/* Write a record to the temporary queue */
143
144
sprintf(qmsg, "%s", "The cheese table was updated");
145
mlen = strlen(qmsg);
146
EXEC CICS WRITEQ TS QUEUE("TEMPXAQ1") FROM(qmsg) LENGTH(mlen) \
RESP(rcode);
147
if (rcode != DFHRESP(NORMAL))
148
EXEC CICS ABEND ABCODE("X010");
149
150
}
151
else
148
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
{
/* The user does not wish to update so free the keybd & return */
EXEC CICS SEND CONTROL ERASE FREEKB;
EXEC CICS RETURN;
}
/* Commit the update */
EXEC CICS SYNCPOINT RESP(rcode);
if (rcode != DFHRESP(NORMAL))
EXEC CICS ABEND ABCODE("X011");
/* Send the fourth map confirming successful update */
sprintf(panel4.panel4o.messageo, UPDATECHEESE);
EXEC CICS SEND MAP("PANEL4") MAPSET("UXA1") FREEKB ERASE RESP(rcode);
if (rcode != DFHRESP(NORMAL))
EXEC CICS ABEND ABCODE("X007");
/* free the keybd & return */
EXEC CICS SEND CONTROL FREEKB;
EXEC CICS RETURN;
errexit:
/* Handle general errors */
EXEC SQL WHENEVER SQLERROR CONTINUE;
#ifdef ORA7
sprintf(errmsg, "%.60s\n", sqlca.sqlerrm.sqlerrmc);
#endif
#ifdef INF5
rgetmsg(sqlca.sqlcode, errmsg, sizeof(errmsg));
#endif
strncpy(panel4.panel4o.messageo, errmsg, 60);
sprintf(panel4.panel4o.codeo, "%d", sqlca.sqlcode);
197
198
199
200
201
202
203
204
205 }
Description
1 to 34
35 to 46
149
Description
47 to 66
67 to 83
A SELECT is done against the database using the name of the cheese
input by the user in the WHERE clause.
84 to 96
This section manages the situation where the SELECT fails to find any
rows that match the name of the cheese input by the user.
97 to 121
The second panel is filled using data returned by the SELECT and is
sent to the user. The user responds by keying y if he wishes to
update the record displayed.
122 to 133
The third panel is sent to the user querying the new order quantity
needed for the particular cheese.
134 to 150
151 to 160
This section handles the case where the user has chosen not to update
the database.
161 to 166
167 to 173
The fourth panel is sent to the user to confirm that the database has
been successfully updated.
174 to 178
179 to 205
150
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Prerequisite tasks and conditions: If you want to use Microsoft SQL Server, CICS
for Windows requires MS SQL Workstation or Server to be installed and
configured according to your Microsoft SQL documentation. When installing MS
SQL, ensure that Distributed Transaction Coordinator (DTC) support is included.
|
|
|
|
|
For more information refer to the CICS Administration Guide for Windows Systems.
|
|
|
|
|
|
|
|
|
CICS applications can access the list of ODBC connection handles through a
CICS-supplied API. The syntax of that API is:
This procedure describes how to use the ODBC API under an XA environment to
write CICS application programs that can access data that resides in a Microsoft
SQL Server database.
151
|
|
Refer to the CICS Application Programming Reference for more information about this
API.
|
|
|
|
Using a sample CICS C application: The source, map, makefile, and README
file for the example are shipped in this directory of your CICS development
environment:
|
|
|
|
|
|
|
In the following example, ODBC APIs have been used to write the source files in
C. Application programmers can refer to these files to determine how to use ODBC
APIs to write application programs and also to determine how to use the EXEC
CICS ASSIGN ODBCHNDLLIST API to obtain ODBC connection handles.
v cheese_mssql.ccs(source file)
v cheese_mssql.mk (Makefile to compile the source)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This portion of the cheese sample source file that is written in C shows how to use
EXEC CICS ASSIGN ODBCHNDLLIST API to obtain a list of ODBC connection
handles.
ProdDir/src/examples/xa
hstmt;
ODBCHandle;
CId,ret,retcode;
errmsg[400];
mlen,Length;
name[15];
CheeseTbl *CheeseData=NULL;
order_quantity;
*UPDATECHEESE,*NOCHEESE,*ODBCCON=NULL;
CId=1;
memset(Buffer,NULL,MAX_ENTRIES*sizeof(struct ODBC_ConArray));
EXEC CICS ASSIGN ODBCHNDLLIST(Buffer) ODBCLISTLEN(Length);
ODBCHandle = GetODBCHandleFromList(Buffer,CId);
if(ODBCHandle == 0)
{
ODBCCON="Fetching Connection Handle Failed";
EXEC CICS SEND TEXT FROM(ODBCCON) LENGTH(37);
EXEC CICS RETURN;
}
SQLHDBC GetODBCHandleFromList(struct ODBC_ConArray Buffer[],int ConId)
{
int i=0;
if(Buffer[i].ConId != 0)
{
for(i=0;Buffer[i].ConId != 0;i++)
{
152
|
|
|
|
|
|
|
|
|
|
|
|
In this portion of the example code, the EXEC CICS ASSIGN ODBCHNDLLIST
API fills the buffer that is passed by the program. It fills the buffer with an array
of structures that contains the List of ODBCHandles, Type of the each
ODBCHandle, and the ConnectID.
|
|
|
|
The ConnectID member identifies the database to which the connection handle
refers. The user sets this ConnectID in the XAOpen string of XAD.stanza for the
XAD product definition. Users use this ConnectID in the application, to obtain the
ODBC connection handle for each database that they want to access.
|
|
For more information about the ODBC_ConnArray structure, refer to the header
file cics_odbc.h, which you can see in the directory Drive:\opt\cics\include.
|
|
|
|
|
|
|
|
|
Prerequisite tasks and conditions: If you want to use Microsoft SQL Server, CICS
for Windows requires MS SQL Workstation or Server to be installed and
configured according to your Microsoft SQL documentation. When installing MS
SQL, ensure that Distributed Transaction Coordinator (DTC) support is included.
|
|
|
|
|
For more information refer to the CICS Administration Guide for Windows Systems.
|
|
|
|
|
|
|
|
|
|
CICS applications can access the list of ODBC connection handles through a
CICS-supplied API. The syntax of that API is:
|
|
Refer to the CICS Application Programming Reference for more information about this
API.
if(Buffer[i].ConId == ConId)
{
return (SQLHDBC)Buffer[i].DBHandle;
}
}
}
return 0;
This procedure describes how use ODBC API(IBM VisualAge COBOL) under an
XA environment to write CICS application programs that can access data that
resides in a Microsoft SQL Server database.
153
|
|
|
|
Using a sample CICS IBM VisualAge COBOL application: The source, map,
makefile, and README file for the example are shipped in this directory of your
CICS development environment:
|
|
|
|
|
|
|
|
|
In the following example, ODBC APIs have been used to write the source files in
IBM VisualAge COBOL. Application programmers can refer to these files to
determine how to use ODBC APIs to write application programs and also to
determine how to use the EXEC CICS ASSIGN ODBCHNDLLIST API to obtain
ODBC connection handles.
v chzvacob_mssql.ccp(source file)
v chzvacob_mssql.cpy (copy file)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This portion of the cheese sample source file that is written in IBM VisualAge
COBOL shows how to use EXEC CICS ASSIGN ODBCHNDLLIST API to obtain a
list of ODBC connection handles.
ProdDir/src/examples/xa
******************************************************************
* CHZVACOB_MSSQL.CBL
*
******************************************************************
IDENTIFICATION DIVISION.
PROGRAM-ID. "CHZVACOB_MSSQL".
DATA DIVISION.
WORKING-STORAGE SECTION.
* copy ODBC API constant definitions
COPY "odbc3.cpy" SUPPRESS.
COPY "uxa1.cpy" SUPPRESS.
* ODBC Handles
01 Henv
01 Hdbc
01 Hstmt
* Arguments used for GetDiagRec
01 DiagHandleType
01 DiagHandle
01 DiagRecNumber
01 DiagRecNumber-Index
-
POINTER
POINTER
POINTER
VALUE NULL.
VALUE NULL.
VALUE NULL.
calls
COMP-5 PIC 9(4).
POINTER.
COMP-5 PIC 9(4).
COMP-5 PIC 9(4).
BUFLENGTH
CONNID
INDEX1
ODBCLEN
01 ODBCCONLIST.
02 ODBCLIST OCCURS 20 TIMES.
03 ConId
03 HNDLTYPE
03 DBHANDLE
LINKAGE SECTION.
PROCEDURE DIVISION.
154
COMP-5
COMP-5
COMP-5
COMP-5
PIC
PIC
PIC
PIC
S9(9).
S9(4).
S9(9) VALUE 1.
s9(9).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MOVE
MOVE
MOVE
MOVE
LOW-VALUES
LOW-VALUES
LOW-VALUES
LOW-VALUES
TO
TO
TO
TO
PANEL1O.
PANEL2O.
PANEL3O.
PANEL4O.
The below portion of the code can be seen in the file chzvacob_mssql.cpy .
** SETDBHANDLEFROMLIST SECTION ************************************
SETDBHANDLEFROMLIST
PERFORM VARYING
UNTIL ConId
IF ConId OF
SET Hdbc TO
END-IF
END-PERFORM.
SECTION.
INDEX1 FROM 1 BY 1
OF ODBCLIST(INDEX1) = 0
ODBCLIST(INDEX1) = CONNID
DBHANDLE OF ODBCLIST(INDEX1)
In this portion of the example code, the EXEC CICS ASSIGN ODBCHNDLLIST
API fills the buffer that is passed by the program. It fills the buffer with an array
of structures that contains the List of ODBCHandles, Type of the each
ODBCHandle, and the ConnectID.
155
|
|
|
|
The ConnectID member identifies the database to which the connection handle
refers. The user sets this ConnectID in the XAOpen string of XAD.stanza for the
XAD product definition. Users use this ConnectID in the application, to obtain the
ODBC connection handle for each database that they want to access.
|
|
For more information about the ODBC_ConnArray structure, refer to the header
file cics_odbc.h, which you can see in the directory Drive:\opt\cics\include.
|
|
|
|
|
|
|
|
|
Prerequisite tasks and conditions: If you want to use Microsoft SQL Server, CICS
for Windows requires MS SQL Workstation or Server to be installed and
configured according to your Microsoft SQL documentation. When installing MS
SQL, ensure that Distributed Transaction Coordinator (DTC) support is included.
|
|
|
|
|
For more information refer to the CICS Administration Guide for Windows Systems.
|
|
|
|
|
Note: To write CICS ODBC applications in Micro Focus NetExpress COBOL, you
must use an Embedded SQL API. Micro FocusNetExpress provides an
ODBC converter that converts Embedded SQL APIs to ODBC during
compilation. Applications can, therefore, access the database through the
ODBC driver.
|
|
|
|
|
|
|
|
Using a sample CICS Micro Focus NetEXpress COBOL application: The source,
map, makefile, and README file for the example are shipped in this directory of
your CICS development environment:
|
|
|
In the following example, ODBC APIs have been used to write the source files in
Micro Focus NetExpress COBOL. Application programmers can refer to these files
to determine how to use ODBC APIs to write application programs.
v chzmfcob_mssql.cpp (source file)
v uxa1_mscob.bms (map file)
v chzmfcob_mssql.mk (makefile)
This procedure describes how use E-SQL API/ODBC Library (Micro Focus
NetExpress COBOL) under an XA environment to write CICS application programs
that can access data that resides in a Microsoft SQL Server database.
ProdDir/src/examples/xa
|
|
|
This portion of the cheese sample source file that is written in Micro Focus
NetExpress COBOL shows how to use an Embedded SQL API to set the
connection.
|
|
|
|
|
|
IDENTIFICATION DIVISION.
PROGRAM-ID.
AUTHOR.
156
UXA1.
A SAMPLE.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DATE-WRITTEN.
18/10/96.
DATE-COMPILED.
***************************************************************
ENVIRONMENT DIVISION.
***************************************************************
DATA DIVISION.
WORKING-STORAGE SECTION.
COPY UXA1.
PROCEDURE DIVISION.
RESIDENT SECTION 1.
***************************************************************
MAIN.
***************************************************************
*
* Initialise the maps
*
MOVE
MOVE
MOVE
MOVE
*
LOW-VALUES
LOW-VALUES
LOW-VALUES
LOW-VALUES
TO
TO
TO
TO
PANEL1O.
PANEL2O.
PANEL3O.
PANEL4O.
Table 33. Support required for updating files from non-CICS applications
Compiler
Files on SFS
Files on DB2
Files on Oracle
|
|
|
|
C and C++
No additional support is
required. Refer to the SFS
application programming
information.
No additional support is
required. Refer to the DB2
application programming
information.
No additional support is
required.
|
|
IBM PL/I
|
|
|
|
|
IBM COBOL
157
Table 33. Support required for updating files from non-CICS applications (continued)
Compiler
Files on SFS
Files on DB2
Files on Oracle
|
|
|
|
|
|
|
Micro Focus
Server Express
COBOL on
UNIX
|
|
|
Micro Focus
Indicators to two COBOL
Net Express on libraries must be modified in
Windows
two COBOL system files.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Table 33 on page 157 shows the support requirements that are needed by CICS to
enable processing of SFS, DB2, or Oracle files when each of the different language
compilers is used. When SFS, DB2, or Oracle files are processed with either the C
or the C++ compiler, no extra capability is required. These languages already
contain what is needed to access SFS, DB2, or Oracle files. With PL/I compilers, no
extra capability is required for SFS access, but DB2 and Oracle file access is not
supported. With IBM COBOL compilers, DB2 and Oracle file access is not
supported. However, SFS file access is possible when specific naming conventions
are employed, and the following environment variables are set:
v ENCINA_EXTFH_VOL specifies the name of the SFS logical volume that was
specified when the server was started, <shortname>.
v ENCINA_CDS_ROOT set to /.:/cics
|
|
|
Note, however, that when the Micro Focus Server Express COBOL compiler (on
Open Systems) or Micro Focus Net Express compiler (on Windows systems) is
used, extra capability is needed for access to SFS, DB2, or Oracle files.
|
|
|
|
|
|
|
|
|
|
This extra capability that is needed by Micro Focus Server Express COBOL or Net
Express is provided through the External File Handler (EXTFH) function. The
EXTFH is a package that allows COBOL applications transparently to use SFS,
DB2, or Oracle files for record storage. When the UNIX and the Windows
environment has been prepared to use the EXTFH function, the routines to access
data are the same. The COBOL programmer sees no apparent difference between a
standard COBOL I/O and an I/O to an SFS file, DB2 file, or Oracle file that is
using EXTFH. The EXTFH is supported in the Micro Focus Server Express COBOL
and Net Express software and also by EXTFH code on the DB2, SFS, and Oracle
file system managers.
The program is built into an executable by using cob, and is run independently.
The EXTFH interface automatically creates output files if they do not exist. If you
open an existing file for output, its contents are erased unless you open it in
extended mode.
In order to use EXTFH, you must use COBOL and the X/Open TX routines. You
cannot use EXTFH and Transactional-C together.
The following sections cover these topics:
158
v Using DB2 EXTFH with Micro Focus Server Express COBOL and Net Express
v Using SFS EXTFH with Micro Focus Server Express COBOL and Net Express
v LIBPATH is set to
/usr/lpp/cics/lib:/usr/lpp/encina/lib:/opt/dcelocal/lib:$DB2DIR/lib
v NLSPATH is set to
NLSPATH:/usr/lpp/cics/msg/%L/%N/:/usr/lpp/cics/msg/C/%N
v DB2DBDFT is set to the name of any DB2 database
v DB2DIR=<DB2productDirectory>
v DB2INSTANCE=<instanceName>
2. Export DCELIBS=-ldce lc_r ldcepthreads lpthreads
To build a Micro Focus Server Express COBOL application, follow the instructions
for using DB2 EXTFH with an MF COBOL runtime. In addition, you must specify
extra parameters on the command-line to the cob command, as shown in the
following example for clustered files:
Using Micro Focus Net Express COBOL runtime with DB2 EXTFH
on Windows
The steps required to enable DB2 EXTFH functionality on the Windows platform
are:
1. Ensure COBOL environment file settings.
a. Ensure prodDir\bin is in the %PATH% environment setting.
b. Ensure prodDir\lib is in the %LIB% environment setting.
Chapter 5. Coding for data services
159
Table 34. Environment variables used with the DB2 EXTFH on Windows
Environment variable
Description
|
|
|
|
$CICS_XFH_LOGFILE or
%CICS_XFH_LOGFILE%
|
|
|
|
|
|
|
|
$CICS_XFH_DBNAME or
%CICS_XFH_DBNAME%
|
|
|
|
|
|
|
$CICS_XFH_USERNAME,
$CICS_XFH_USERPASS
or
%CICS_XFH_USERNAME%,
% CICS_XFH_USERPASS%
Tools that are supplied with the database are usually used
to regulate who can access the data. However, the
external file handler accesses the database as the user who
is running the COBOL application. In addition, the access
ID can be changed by using these two environment
variables to define the user name and password that are
to be used to connect to the database.
|
|
|
|
$CICS_XFH_TRANMODE
or
%CICS_XFH_TRANMODE%
File and record locking behavior when DB2 EXTFH is used with
Micro Focus Server Express COBOL on UNIX and Net Express
on Windows
Micro Focus Server Express COBOL, Net Express, and the DB2 EXTFH support file
and record locking in the following ways:
v Files opened for output or append can take a file lock.
v To take a file lock on files opened for read only, either of the following settings
must be specified:
the WITH LOCK phrase must be specified on the OPEN statement, or
the LOCK MODE IS EXCLUSIVE phrase must be specified on the SELECT
statement.
160
Without these specified settings, files opened for read only can take no locks,
and the WITH LOCK clause has no effect on a read statement (standard Micro
Focus Server Express COBOL or Net Express operation).
v The DB2 EXTFH only supports automatic record locking. Files opened with
manual record locking will default to automatic record locking and the locking
schematics used will be that of LOCK MODE IS AUTOMATIC WITH LOCK
ON MULTIPLE RECORD.
Non-transactional access mode
With non-transactional access, changes are immediately committed to the
database. The DB2 EXTFH performs a COMMIT immediately after any
database update operation.
With files opened for input and output in non-transactional access mode, a
lock is taken on any record read and then released on the next file
operation on that file or when the application ends. If the WITH LOCK
phrase is specified on the open statement or LOCK MODE IS
EXCLUSIVE is specified on the SELECT statement, then a file lock is
taken.
When a ROLLBACK is performed, the file lock is temporarily released
before being retaken. In this situation, the application receives an error
from the ROLLBACK command and a message is logged.
Transactional access mode
When using transactional access, it is up to the application to:
v Make the changes permanent (COMMIT)
v Disregard the changes (ROLLBACK)
Because some COBOL file operations do not map to single SQL commands,
an automatic rollback does not necessarily occur if errors are encountered.
For example, during a file create, if the database table is created
successfully but the indices are not, the DB2 EXTFH does not perform a
rollback of the table creation. This results in a error when the application
attempts to open the file. Therefore, you should program the application to
handle the error and explicitly perform the rollback.
With files opened for input and output in transactional access mode, a lock
is taken on any record read and then released on the next file operation on
that file except when that record is updated. When a file is updated, the
lock is retained until a COMMIT or ROLLBACK is performed or the
application ends. Therefore, you should program the application to handle
the error and explicitly perform the rollback.
|
|
|
|
|
|
|
|
|
161
|
|
|
|
To enable Oracle EXTFH functions with the Micro Focus Server Express COBOL
runtime on the UNIX platform:
1. Verify that the environment is set up as is shown in the following AIX example:
v PATH is set to the following:
|
|
|
|
|
|
$PATH:/usr/lpp/cics/bin:/usr/lpp/encina/bin:/opt/dcelocal/bin
:$ORACLE_HOME/bin
|
|
|
|
|
NLSPATH:/usr/lpp/cics/msg/%L/%N/:/usr/lpp/cics/msg/C/%N
|
|
v ORACLE_SID is set
v CICS_XFH_USERPASS is set
v CICS_XFH_USERNAME is set
2. Export DCELIBS=-ldce lc_r ldcepthreads lpthreads
|
|
|
|
|
|
|
|
|
|
|
To build a Micro Focus Server Express COBOL application, follow the instructions
for using Oracle EXTFH with an MF COBOL runtime. In addition, you must
specify extra parameters on the command-line to the cob command, as shown in
the following example for clustered files:
|
|
|
|
|
|
|
|
|
|
|
|
Notes:
1. The variable $COBDIR resolves to the COBOL installation directory. For Solaris
and HP-UX, $COBDIR resolves to /opt/cobol/. For AIX, $COBDIR resolves to
/usr/lib/cobol/.
2. ORA_PRECOMP resolves to ${ORACLE_HOME}/precomp/lib for Oracle 8.1.7
or Oracle 9i 32-bit installation, or to ${ORACLE_HOME}/precomp/lib32 for
Oracle 9i 64-bit installation.
3. ORA_LIBP = ${ORACLE_HOME}/lib for Oracle 8.1.7 or Oracle 9i 32-bit
installation, or to ${ORACLE_HOME}/lib32 for Oracle 9i 64-bit installation.
4. EXTFH_LIBNAME=xfhorasa (provided by CICS).
|
|
|
|
|
|
162
|
|
|
|
|
|
|
|
|
|
All COBOL file operations are then redirected to the Oracle EXTFH.
3. Execute the runtime unit.
When the COBOL application is run, the application must be able to find and
load the library cics_xfh.dll, which is in the directory prodDir\bin.
Table 35. Environment variables used with the Oracle EXTFH on Windows
Environment variable
Description
|
|
|
|
$CICS_XFH_LOGFILE or
%CICS_XFH_LOGFILE%
|
|
|
|
|
|
|
|
$CICS_XFH_DBNAME or
%CICS_XFH_DBNAME%
|
|
|
|
|
|
|
$CICS_XFH_USERNAME,
$CICS_XFH_USERPASS
or
%CICS_XFH_USERNAME%,
% CICS_XFH_USERPASS%
Tools that are supplied with the database are usually used
to regulate who can access the data. However, the
external file handler accesses the database as the user who
is running the COBOL application. In addition, the access
ID can be changed by using these two environment
variables to define the user name and password that is to
be used to connect to the database.
|
|
|
|
$CICS_XFH_TRANMODE
or
%CICS_XFH_TRANMODE%
|
|
|
|
|
|
|
|
|
|
Micro Focus Server Express COBOL, Net Express, and the Oracle EXTFH support
file and record locking in the following ways:
v Files that are opened for output or append can take a file lock.
v To take a file lock on files that are opened for read only, you must specify either
of the following settings:
Specify the WITH LOCK phrase on the OPEN statement, or
Specify the LOCK MODE IS EXCLUSIVE phrase on the SELECT statement.
163
|
|
|
|
Without these specified settings, files that are opened for read only can take no
locks, and the WITH LOCK clause has no effect on a read statement (standard
Micro Focus Server Express COBOL or Net Express operation).
v The Oracle EXTFH supports only automatic record locking. Files that are opened
with manual record locking default to automatic record locking. The locking
schematics that are used are LOCK MODE IS AUTOMATIC WITH LOCK ON
MULTIPLE RECORD.
|
|
|
|
|
|
|
|
|
With files are opened for input and output in nontransactional access
mode, a lock is taken on any record read, then released on the next file
operation on that file or when the application ends. If the WITH LOCK
phrase is specified on the open statement, or LOCK MODE IS
EXCLUSIVE is specified on the SELECT statement, a file lock is taken.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Because some COBOL file operations do not map to single SQL commands,
an automatic rollback does not necessarily occur if errors are found. For
example, during a file create, if the database table is created successfully
but the indices are not, the Oracle EXTFH does not perform a rollback of
the table creation. This results in an error when the application attempts to
open the file. Therefore, you should program the application to handle the
error and explicitly perform the rollback.
|
|
|
|
|
|
With files are opened for input and output in transactional access mode, a
lock is taken on any record read, then released on the next file operation
on that file, except when that record is updated. When a file is updated,
the lock is retained until a COMMIT or ROLLBACK is performed or the
application ends. Therefore, program the application to handle the error
and explicitly perform the rollback.
164
Note: The Encina build_rts32 script used to create the MF COBOL runtime
links the required libraries.
5. If DCE authentication is used for the SFS, log in to DCE.
6. Prepare an EXTFH COBOL runtime
Follow the instructions for your version of Encina:
165
On AIX
a. Ensure that the COBDIR environment variable is set to the COBOL
directory (for example /usr/lib/cobol).
b. Use the following command:
/usr/lpp/encina/etc/build_rts32 -o rtssfs -d .
On HP-UX
a. Ensure that the COBDIR environment variable is set to the COBOL
directory (for example, /opt/cobol/cobdir).
b. Ensure that the LPATH environment variable includes the
/opt/encina/lib directory. For example,
export LPATH=/opt/encina/lib
On Solaris
a. Ensure that the COBDIR environment variable is set to the COBOL
directory (for example /opt/lib/cobol).
b. Use the following command:
/opt/encina/etc/build_rts32 -o rtssfs -d .cob -u ExtFHClust.cbl
166
where testsfs.cbl is the name of the COBOL source file, v specifies that messages
be sent to the screen as this file is processed, and u requests an unlinked
version of the output (.gnt) for use with the runtime. The filenames
ExtFHClust.cbl, ExtFHRel.cbl, and ExtFHSeq.cbl refer to clustered, relative or
sequential files compiled for the application.
8. Execute your program
Use the following command to execute your COBOL programs.
dce_login principal password
export ENCINA_SFS_SERVER=/.:/cics/sfs/serverName
export ENCINA_CDS_ROOT=/.:/cics
export ENCINA_EXTFH_VOL=<SFSlogVol shortname>
export ENCINA_EXTFH_SFS=serverName
./rtssfs testsfs
where:
v principal is the DCE principal.
v password is the password for the DCE principal.
v SFSlogVol shortName is the name of the SFS logical volume.
v serverName is the name of the SFS, for example /.:/cics/sfs/HostA.
A DCE login is required to access an SFS file (this is discussed in detail later in
this document).
testsfs is the COBOL executable module that was prepared using this
procedure. ./rtssfs testsfs causes the runtime to execute the program.
167
-m
-m
-m
rm
ixfile=cobol_Extfh -m ixfilev=cobol_Extfh
rlfile=cobol_Extfh -m rlfilev=cobol_Extfh
sqfile=cobol_Extfh -m sqfilev=cobol_Extfh
*.int *.o
where:
v principal is the DCE principal.
v password is the password for the DCE principal.
v SFSlogVol is the name of the SFS logical volume.
v serverName is the name of the SFS, for example /.:/cics/sfs/HostA.
A DCE login is required to access an SFS file (this is discussed in detail later in
this document).
testsfs is the COBOL executable module that was prepared using this
procedure. ./rtssfs testsfs causes the runtime to execute the program.
Using SFS EXTFH with Micro Focus Net Express COBOL runtime
on Windows
To use your Micro Focus Net Express COBOL programs to access SFS files:
1. Verify that the environment is set up to enable command access, library access,
and locale access to CICS, Encina, and DCE commands by taking the following
steps:
v Ensure that all applications that use EXTFH are linked to the libEncExtfh.lib
library by using the /CALLFH compiler option.
v Ensure that the LIB environment variable includes the name of the directory
that contains the libEncExtfh.lib library (by default, C:\opt\encina\lib).
v Ensure that the PATH environment variable includes the Encina binary
directory (by default, C:\opt\encina\bin).
2. Prepare the environment for EXTFH use
Do this by defining files, setting environment variables, and assigning the
appropriate permissions.
EXTFH uses environment variables to determine which SFS server and volume
to use:
v ENCINA_SFS_SERVER specifies which server to use. This must be set to
the fully qualified name of the SFS (for example, /.:/cics/sfs/sfs1.
v ENCINA_EXTFH_SFS specifies which server to use. This must be set to
the fully qualified name of the SFS (for example, /.:/cics/sfs/sfs1.
v ENCINA_EXTFH_VOL specifies the name of the SFS logical volume
specified when the server was started, <shortname> (for example, sfs_Ssfs1).
v ENCINA_CDS_ROOT set to the fully qualified name for the DCE cell
(for example, /.:/cics/sfs/sfs1.
168
The server is used for all SFS file operations. The volume is used when a new
file has to be created. The environment variables are checked when the file is
opened. These variables can be set or changed using the following calls:
v TR_SET_SFS_SERVER serverName nameSize. The call takes two options: a
string variable containing the fully qualified server name and a numeric
variable giving the length of the string in the serverName option.
v TR_SET_SFS_VOLUME volumeName nameSize. The call takes two options: a
string variable containing the name of the volume and a numeric variable
giving the length of the string in the volume_name option.
3. Export the SFS EXTFH librarys using the following command:
Set ENCLIBS="-lEncSfsExtfhWrap -lEncSfsExtfh -lEncSfs -lEncina"
Note: The Encina build_rts32 script used to create the COBOL runtime links
the required libraries.
5. If DCE authentication is used for the SFS, log in to DCE.
6. Prepare an EXTFH COBOL runtime
Follow the instructions for your version of Encina.
At this point you have a COBOL runtime (named rtssfs located in the
directory you specified with the -d option) that includes the Encina-provided
routines to access SFS.
7. Compile your program
You may use the following command to compile your COBOL programs.
Depending on your program, you may need to indicate compiler directives;
refer to the COBOL documentation for details.
C: > cob -uv testsfs.cbl
cob -u ExtFHClust.cbl
cob -u ExtFHRel.cbl
cob -u ExtfhSeq.cbl
rm *.int *.o
where testsfs.cbl is the name of the COBOL source file on the Windows
platform, v specifies that messages be sent to the screen as this file is processed,
Chapter 5. Coding for data services
169
and u requests an unlinked version of the output (.gnt) for use with the
runtime. The filenames ExtFHClust.cbl, ExtFHRel.cbl, and ExtFHSeq.cbl refer to
clustered, relative or sequential files compiled for the application.
8. Execute your program
Use the following command to execute your COBOL programs.
dce_login principal password
SET ENCINA_SFS_SERVER=/.:/cics/sfs/serverName
Set ENCINA_CDS_ROOT=/.:/cics
Set ENCINA_EXTFH_VOL=<SFSlogVol shortname>
Set ENCINA_EXTFH_SFS=serverName
./rtssfs testsfs
where:
v principal is the DCE principal.
v password is the password for the DCE principal.
v SFSlogVol shortName is the name of the SFS logical volume.
v serverName is the name of the SFS, for example /.:/cics/sfs/HostA.
A DCE login is required to access an SFS file (this is discussed in detail later in
this document).
testsfs is the COBOL executable module that was prepared using this
procedure. ./rtssfs testsfs causes the runtime to execute the program.
Line-sequential
Record-sequential
Entry-sequenced
Indexed
Clustered
Relative
Relative
170
Table 37. Environment Variables for Accessing SFS Features from EXTFH Applications
Environment
Variable
Description
Possible Values
Call
ENCINA_EXTFH_
AUTO_FLUSH
0 = do not use
operational force.
Any other value
means use
operational force.
DEFAULT = 0.
TR_EXTFH_SET_
AUTO_FLUSH
ENCINA_EXTFH_
SLOT_CHOICE
Controls where
inserts occur in
relative files.
TR_EXTFH_SET_
SLOT_CHOICE
ENCINA_EXTFH_
DUP_DETECTION
Controls whether
The string NONE
duplicate detection is disables duplicate
enabled for a file.
detection. ALL
enables duplicate
detection. DEFAULT
= ALL.
TR_EXTFH_SET_
DUP_DETECT
ENCINA_EXTFH_
OP_TIMEOUT
The number of
seconds to wait for
an SFS operation to
complete. DEFAULT
= 60 seconds.
TR_EXTFH_SET_
OP_TIMEOUT
ENCINA_EXTFH_
OPEN_TIMEOUT
The number of
seconds to wait for
an open file call to
complete. DEFAULT
= 60 seconds.
TR_EXTFH_
SETOPEN
_TIMEOUT
ENCINA_EXTFH_
CACHE
171
172
Task initiation
Tasks can be initiated in two ways:
|
|
|
|
173
|
|
|
|
|
|
|
|
|
|
|
174
175
|
|
The invoked program receives the data as a parameter. In COBOL, the program
must contain a definition of a data area to allow access to the passed data.
In a receiving COBOL program, you must give the data area the name
DFHCOMMAREA. A program passes a COMMAREA as part of an EXEC CICS
LINK, EXEC CICS XCTL, or EXEC CICS RETURN command; either the working
storage or the linkage section can contain the data area. A program receiving a
COMMAREA should specify the data in the linkage section. This applies when the
program is one of the following:
v The receiving program during an EXEC CICS LINK or EXEC CICS XCTL
command where a COMMAREA is passed
v The initial program where the EXEC CICS RETURN command of a previously
called task specified a COMMAREA and TRANSID
A C or C++ program issues an EXEC CICS ADDRESS COMMAREA command to
obtain the address of the communication area. The program must pass the address
of a pointer as a parameter to the EXEC CICS ADDRESS COMMAREA command.
This pointer will then be set to point to the passed data.
The receiving data area need not be of the same length as the original
communication area; if access is required only to the first part of the data, the new
data area can be shorter. However, it must not be longer than the length of the
communication area being passed, because if it is, your transaction may
inadvertently read data outside the area that has been passed. This data is outside
the area you can safely access, and may cause your transaction to have
unpredictable results. It may also overwrite data outside the area, which could
cause CICS to abend your transaction.
To avoid this happening, your program can access the EIBCALEN field in the EIB
of the task to check that the length of the communication area passed to it is as
expected. If no communication area has been passed, the value of EIBCALEN is
zero; otherwise, EIBCALEN always contains the value specified in the LENGTH
option of the EXEC CICS LINK, EXEC CICS XCTL, or EXEC CICS RETURN
command, regardless of the size of the data area in the invoked program. You
should check that the value in EIBCALEN matches the value expected by your
program, and make sure that your transaction is accessing data within that area.
You might also want to consider adding an identifier to COMMAREA as an
additional check on the data that is being passed. This identifier is sent with the
sending transaction and checked for by the receiving transaction.
176
When a communication area is passed using an EXEC CICS LINK command, the
invoked program is passed a pointer to the communication area itself. Any
changes made to the contents of the data area in the invoked program are available
to the invoking program, when control returns to it; to access any such changes,
the program names the data area specified in the original COMMAREA option.
When a communication area is passed using an EXEC CICS XCTL command, a
copy of that area is made unless the area to be passed has the same address and
length as the area that was passed to the program issuing the command. For
example, if program PROGA issues an EXEC CICS LINK command to program
PROGB that, in turn, issues an EXEC CICS XCTL command to program PROGC,
and if PROGB passes to PROGC the same communication area that PROGA passed
to PROGB, program PROGC will be passed addressability to the communication
area that belongs to A (not a copy of it) and any changes made by PROGC will be
available to PROGA when control returns to it.
|
|
When a lower-level program, which is a linked-to program, issues the EXEC CICS
RETURN command, control passes back to the level one logical level higher than
the program returning control. If the task is associated with a terminal, the
TRANSID option can be used at the lower level to specify the transaction identifier
for the next transaction that is to be associated with that terminal. The transaction
identifier comes into use only after the highest logical level has relinquished
control to CICS by using the EXEC CICS RETURN command, and input is
received from the terminal. Any input that is entered from the terminal is
interpreted wholly as data. If the IMMEDIATE option is specified, the input from
the terminal is not required to start the transaction. You can use TRANSID without
COMMAREA when returning from any link level, but be aware that it might be
overridden on a later EXEC CICS RETURN command. Also, you can only specify
the COMMAREA option at the highest level, otherwise you will get an INVREQ.
In addition, the COMMAREA option can be used to pass data to the new task that
is to be started.
The invoked program can access field EIBFN in the EIB to determine which type of
command invoked the program. The field must be tested before CICS commands
are issued. If an EXEC CICS LINK or EXEC CICS XCTL invoked the program, the
appropriate code is found in the field; if EXEC CICS RETURN is used and no CICS
commands are issued in the task, the field will contain zeros.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The INPUTMSG option of the LINK, XCTL, and RETURN commands provides
another way of specifying the name of a data area that is to be passed to the
program that is being invoked. In this case, the invoked program gets the data by
processing a RECEIVE command. This option enables you to invoke (front-end)
application programs to obtain initial terminal input. These application programs
are written to be invoked directly from a terminal, and contain RECEIVE
commands.
177
|
|
|
|
|
|
Transaction
input from
terminal
CICS
invokes
application
RECEIVE input from terminal
Program
B
Program
D
LINK to C
Program
C
|
|
|
|
|
|
|
|
|
|
|
If program A wants only to pass on the unmodified terminal input that it received,
it can use the same named data area for the INPUTMSG option that it used for the
RECEIVE command. For example:
|
|
|
|
When one program in a LINK chain issues a RECEIVE command, the INPUTMSG
data becomes no longer available to any later RECEIVE command. For example, in
Figure 8, if program B issues a RECEIVE request before linking to program C, the
INPUTMSG data area is not available for program C.
178
|
|
|
|
This method of sending data from one program to another can be used for any
kind of data. The data does not have to originate from a user terminal. In Figure 8
on page 178, program A could move any data into the named data area, and
invoke program B with INPUTMSG referencing the data.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If you specify INPUTMSG with TRANSID some time after a SEND command, the
SEND message is immediately flushed out to the terminal. INPUTMSG on a
RETURN command without the TRANSID option is intended for use with a
dynamic transaction routing program.
To pass data to the next transaction specified, you can specify INPUTMSG on a
RETURN command with the TRANSID option. To do this, you must issue
RETURN at the highest logical level to return control to CICS, and you must also
specify the IMMEDIATE option. If you specify INPUTMSG with TRANSID, and do
not also specify IMMEDIATE, the next real input from the terminal overrides the
INPUTMSG data, which is therefore lost. See the CICS Application Programming
Reference manual for programming information about the RETURN command.
Timer services
CICS timer services, in conjunction with the time-of-day clock maintained by the
operating system, provide commands that can be performed at a specific time.
Using these commands you can:
v Ask for the time (EXEC CICS ASKTIME)
v Delay the processing of a task (EXEC CICS DELAY)
v Start a task and store data for the task (EXEC CICS START)
179
v Retrieve data stored (by an EXEC CICS START command) for a task (EXEC
CICS RETRIEVE)
v Cancel the effect of a previous EXEC CICS DELAY or EXEC CICS START
command (EXEC CICS CANCEL)
v Suspend the task (EXEC CICS SUSPEND)
Expiration times
The time at which a timer service is to be started is called the expiration time. You
can specify expiration times absolutely, as a time of day (using the TIME option),
or as an interval that is to elapse before the function is to be performed (using the
INTERVAL option).
Expiration times cannot be defined using TIME or INTERVAL options in C. When
using the EXEC CICS DELAY command, you can use the FOR and UNTIL options,
and for the EXEC CICS START command, you can use the AFTER and AT options.
Use INTERVAL to start a transaction after a specified number of hours, minutes,
and seconds (expressed as hhmmss) have elapsed from the current time. INTERVAL
always specifies a time in the future: the current time plus the interval you specify,
assuming you specify a nonzero interval.
Use TIME to start a transaction at a specific time; again using hours, minutes, and
seconds (expressed as hhmmss). An absolute time is measured relative to midnight
before the current time and may therefore be earlier than the current time. TIME
may be either in the future or the past relative to the time at which the command
is executed. For example, to start a transaction at 1530 hours, you would use EXEC
CICS START TIME(153000). The following rules apply:
v If you specify a task to start at any time within the previous six hours, it will
start immediately, unless the start time is before midnight (past) of the day on
which you specify it. For example, the following command issued at 0500 or
0700 hours on Monday expires at 1230 hours on the same day.:
EXEC CICS START TIME(123000)
Note that the TIME given is never taken to be before midnight of the current
day.
v If you specify a time with an hours component that is greater than 23, you are
specifying a time on a day following the current one. For example, a time of
250000 means 0100 hours on the day following the current one, and 490000
means 0100 hours on the day after that.
If you do not specify either INTERVAL, TIME, FOR or UNTIL on the EXEC
CICS DELAY command, or INTERVAL, TIME, AFTER or AT on the EXEC CICS
START command, INTERVAL(0) is assumed, which means immediately.
The started interval control element (ICE) will be recovered only if it has been
started with the PROTECT option specified. For example, if an EXEC CICS START
command for a transaction to be started at 0700 hours is issued at 0600 hours with
180
the PROTECT option, and CICS fails at 0630 hours and is warm started at 0800
hours, the started transaction will immediately run.
Because each end of an intersystem link may be in a different time zone, you
should use an interval if the transaction to be started is in a remote system. An
absolute time is always relative to the local system and converted into an interval
before shipping.
The interval to delay the EXEC CICS START request applies from the time of
delivery to the remote system. Therefore, if the request is locally queued because
the remote system was unavailable, the EXEC CICS START request may be
delayed longer than expected.
If the system fails, the EXEC CICS START requests you have made that have not
expired are recovered.
Request identifiers
As a means of identifying the request and any data associated with it, a unique
request identifier is assigned by CICS to each EXEC CICS DELAY or EXEC CICS
START command. You can specify your own request identifier by means of the
REQID option; if you do not, CICS assigns (EXEC CICS START only) a unique
request identifier and places it in field EIBREQID in the EXEC interface block
(EIB). Specify a request identifier if you want the request to be canceled at some
later time by an EXEC CICS CANCEL command.
Synchronization services
The CICS synchronization services allow you to serialize access to critical
resources. You do this using the EXEC CICS ENQ and EXEC CICS DEQ
commands. Each task that is to use the resource issues an EXEC CICS ENQ
command. The first task to do so has use of the resource immediately, but
Chapter 6. Coding for business logic
181
subsequent EXEC CICS ENQ commands for the resource, issued by other tasks,
result in those tasks being suspended until the resource is available. You can
override the suspension of a resource by issuing a EXEC CICS HANDLE
CONDITION ENQBUSY.
Each task using a resource should issue a EXEC CICS DEQ command when it has
finished with the resource. A task must issue the same number of EXEC CICS DEQ
commands as the number of successful EXEC CICS ENQ commands, in order to
free the resource for other tasks.
The name passed to the EXEC CICS ENQ is purely symbolic: no physical entity is
locked. It is up to application designers to agree standards to be followed in using
EXEC CICS ENQ commands, and to ensure that all programs follow the chosen
rules.
For example, suppose that Program 1 issues the following command, where
phonenum is a data area containing a character string containing a phone number:
EXEC CICS ENQ RESOURCE(phonenum) LENGTH(12)
Program 2 then issues the same command. Because each EXEC CICS ENQ
command specifies the same character string contents, synchronization occurs and
Program 2 waits until Program 1 issues the command:
EXEC CICS DEQ RESOURCE(phonenum) LENGTH(12)
It is the matching character strings that cause the synchronization. The same effect
would be achieved by different RESOURCE option values, provided that the
contents of the string at each location match. For example:
EXEC CICS ENQ RESOURCE(areaone) LENGTH(12)
EXEC CICS ENQ RESOURCE(areatwo) LENGTH(12)
Similarly, you can enqueue on the address of a data area. For example, if two
programs both issue the following command:
EXEC CICS ENQ RESOURCE(resname)
The two programs enqueue on the same location and synchronize, even though the
contents are not locked in any way. However, if two tasks are waiting for the same
resource, which one gets the enqueue, when available, is dependent on the
priorities on the two tasks; the enqueue goes to the task scheduled first.
See the CICS Application Programming Reference for related information.
Storage services
CICS storage services provide several commands and storage areas for your
applications to use. Broadly, there are two types of storage available to application
programs:
v Task-private storage, obtained for the sole use of the currently running
transaction.
v Task-shared storage, to be shared in an application-dependent manner between
transactions.
In addition, CICS has its own private shared storage.
182
Task-private storage
Task-private storage is private to the task and cannot be addressed by any other
CICS task in the system. If you need working storage in addition to that provided
automatically by the COBOL, C, C++, and PL/I languages, you can use the
following commands. You can initialize each byte of the acquired storage to any bit
configuration, for example to zeros or blanks. You can get and initialize main
storage by using the EXEC CICS GETMAIN comand. You can release main storage
when you are done using it by using the EXEC CICS FREEMAIN command.
CICS releases all task-private storage associated with a task when the task is ended
normally or abnormally. This includes any EXEC CICS GETMAIN storage
acquired, and not subsequently freed, by your program. CICS also provides your
program with these named task-private storage areas:
v The EXEC Interface Block (EIB) holds information about the last command that
CICS executed for your program. For further information, see EXEC interface
block (EIB) on page 187.
v The COMMAREA is a communication area that you can use to pass information
between one program and the next in the same task. For further details, see
Passing data to other programs on page 175.
v The Transaction Work Area (TWA) is an area that you can use within the
transaction. For further information, see Transaction work area (TWA) on page
26.
Task-shared storage
Task-shared storage, also known as the task-shared pool, is shared between all CICS
tasks. As such, all synchronization to these areas is the responsibility of the
applications that wish to use them. You can:
v Allocate an area of shared storage (EXEC CICS GETMAIN SHARED)
v Release the allocated shared area (EXEC CICS FREEMAIN)
v Load a map set or data table (EXEC CICS LOAD)
v Release a map set or data table (EXEC CICS RELEASE)
Note: Data tables can be used to load an operating system file into CICS storage
for manipulation by an application. The files are loaded (by the EXEC CICS
LOAD command) and the address of the storage is passed to the
application. This is useful as transactions can be written to take data and
place it into either SFS or a database, or can use it directly in a transaction.
The ProgType attribute (described in the CICS Administration Reference)
specifies whether the item is a program, a map set, or a data table.
The SHARED option of the EXEC CICS GETMAIN command can be used to
acquire storage that is shareable between transactions. When you issue an EXEC
CICS GETMAIN SHARED command, you can pass the address of that area of
storage to another transaction in three ways:
v Using the common work area (CWA)
v Using a shared CICS area
v Using a shared operating system area
It is also possible to pass the address from one task to the next at the same
terminal using the COMMAREA.
It is the responsibility of application programmers to keep track of storage area
addresses allocated by EXEC CICS GETMAIN SHARED. Unlike ordinary EXEC
CICS GETMAIN storage there is no implicit means of freeing it. Such storage areas
Chapter 6. Coding for business logic
183
184
using the EXEC CICS SYNCPOINT command to split the program into logically
separate sections termed logical units of work (LUWs); the end of an LUW is called a
synchronization point (syncpoint).
If failure occurs after a syncpoint but before the task has been completed, only
changes made after the syncpoint are backed out.
LUWs should be entirely logically independent, not merely with regard to
protected resources, but also with regard to execution flow. Typically, an LUW
comprises a complete conversational operation bounded by EXEC CICS SEND and
EXEC CICS RECEIVE commands. A BROWSE is another example of an LUW. An
EXEC CICS ENDBR command must therefore precede the syncpoint.
TASK B
.
Lock resource 1
.
.
.
.
Request resource 2
.
.
.
Lock resource 2
.
.
Request resource 1
DEADLOCK
WAIT
WAIT
If transaction deadlock occurs, one task may be abnormally terminated and the
other is allowed to proceed.
If both resources are CICS resources, the task whose deadlock timeout period
elapses first is abnormally terminated and its CICS resources are released. (It is
possible for both tasks to time out simultaneously.) If neither task has a
DeadLockTimeout attribute value in the Transaction Definitions (TD), they will both
remain suspended indefinitely, unless one of them is abnormally terminated.
CICS then backs out the abnormally terminated task.
185
Configuration services
CICS provides a number of facilities that enable applications to find out
information about the environment in which they are running:
v The EXEC CICS ADDRESS and EXEC CICS ASSIGN commands provide
information about fields in CICS control blocks.
v The INQUIRE and SET commands provide information about and control of
resources.
v The EXEC Interface Block (EIB) provides information about task-related control
blocks.
186
187
188
Refer to...
189
190
What is migration?
Migrating your existing CICS system to TXSeries CICS means moving your
existing applications in such a way as to achieve the same level of functionality
that you were using on your existing CICS system. Migration does not involve
adding new functionality through new system features.
The information describing the migration process outlines the functionality of
TXSeries CICS, so that you can compare it to your existing system, and identify
any inconsistencies. Other CICS systems are described in general terms, without
discussing the particular features of any one family member.
The amount of work required to migrate your CICS system depends on what you
have done to your system in the past. If you use TXSeries CICS without much
customization, and if your programs are written to conform to the supported
external interfaces, much of the work of migrating is quite straightforward. You
need to check your use of CICS functions against the changes, and then make any
necessary adjustments to your programs and operating procedures.
If you have customized TXSeries CICS, or written system programs using
unsupported interfaces, internal control blocks, and so on, you will need to
reassess the way you use CICS and redesign your code to conform to supported
interfaces.
When you consider migrating from an existing CICS system to TXSeries CICS, you
should remember that it may not be necessary, or possible, to migrate all of your
existing applications. Under these circumstances, you may consider continuing to
run your existing CICS system as well as TXSeries CICS, and allowing
communication between the two. This is known as coexistence.
191
192
v Estimating and planning the machine resources required for the migration, for
example disk space, terminals and machine time for installation, development
and testing.
v Determining which resources (tables, programs, and so on) need to be frozen
during the migration process.
v Determining where you may require programming changes and planning the
necessary coding and testing.
v Planning to update your programming standards and the supporting
documentation.
v Planning the installation of TXSeries CICS.
v Considering the actions required by any associated products that have been
added to TXSeries CICS.
v Planning conversion steps, such as changes to tables that are not to be frozen
during the migration process, and installation of resources.
v Determining your testing criteria.
v Planning the cutover phases.
v Determining the best methods of keeping users informed of any changes to
functions or services that might affect them.
v Planning to update your problem determination procedures and the supporting
documentation.
v Considering any issues raised by your existing CICS system and TXSeries CICS
in parallel.
The end product of the planning phase should be a formally documented plan that
you can use for project management and control.
193
also assumes that you have recoded your programs to comply with the TXSeries
CICS API and removed dependency on MRO. Remember that the objective of the
migration exercise is to migrate CICS applications and their supporting
environment to TXSeries CICS, it should not be an objective of the migration
exercise to increase the functionality of the migrated applications. Attempting to
combine the two objectives is liable to result in an overly complex project that may
be difficult to control and support.
Wherever possible, it is advisable to operate both your existing TXSeries CICS and
other CICS systems in parallel until you can prove that your applications are
operating correctly; as a minimum you should ensure that you have an adequate
fallback position if the migration is not successful.
Single-region systems: A single-region system contains all the programs,
definitions and data that you require to operate your application and can be the
most difficult systems to migrate because of the possibility of having to make large
numbers of changes to your applications and user environment.
Multi-region systems: A multiregion system is, for example, a system that
separates the region that contains your application from the region that contains
the data with the two regions using communications to provide a seamless
interface to the end user. TXSeries CICS has all the same communication facilities
as other CICS systems (except MRO) so that you may choose to migrate one or
both halves of the application. The ability to migrate the constituent parts of your
application only when you deem it necessary or practical may reduce the amount
of conversion effort that you have to expend, and consequently the amount of
direct support to your users.
Non-migrated regions or applications: You may choose not to migrate some
applications that TXSeries CICS does not support, for instance macro-level
applications, but to leave them on your existing CICS system.
v If you consider that an application is going to become obsolete in the foreseeable
future, it may not be cost effective converting it.
v If the cost to convert an application or its data is high, it may not be cost
effective converting them.
In these cases you can leave the application and its associated data on the existing
CICS system and access them through CICS Intercommunication facilities. In brief,
plan to convert only those of your applications not supported by TXSeries CICS
where it is economic to do so.
Coexistence strategies
It can be impossible to migrate all of your existing CICS production regions to
TXSeries CICS without substantial effort. For example, you may have some
macro-level applications that are not supported in TXSeries CICS. In these
instances, you must devise a strategy for migrating some applications to TXSeries
CICS, leaving behind those applications that you cannot cost effectively migrate or
convert. This information outlines how your existing CICS system can coexist with
a TXSeries CICS system using intersystem communication (ISC). ISC is used in all
CICS products to provide communication between CICS systems on separate
processors across a network.
If you are running a CICS system that has elements that you cannot migrate to
TXSeries CICS, you may need to consider adopting an ISC solution that enables
194
you to transaction route between your existing CICS system and TXSeries CICS.
For example, your system may comprise some or all of the following components:
VTAM and BTAM terminals
These are not supported in TXSeries CICS (except as remote terminals for
ISC purposes), and you cannot install them on TXSeries CICS systems. To
support transaction routing from the CICS system that owns the terminals,
you should either ensure that the terminal definitions on the existing CICS
system are marked shippable, or on TXSeries CICS, generate Terminal
Definitions (WD) entries that specify the terminals as remote terminals.
Note that if the system to which your VTAM or BTAM terminal is
connected has a telnet client, then you may be able to use this to gain
access to a region using the cicsteld client.
Note: VTAM refers to Virtual Telecommunications Access Method, a set of
programs that maintain control of the communication between
terminals and application programs. BTAM refers to basic
telecommunications access method, an access method that permits read
and write communication with remote devices.
Command-level applications
You can migrate command-level applications provided they conform to the
TXSeries CICS program compatibility rules.
Files
If the migrated applications access files that remain on your existing CICS
system, you need to define the files as remote resources in TXSeries CICS.
You can access the files by function shipping the file requests.
If you decide to use ISC, you will have to specify resource definitions that define
connections between CICS systems.
When you have migrated the appropriate elements of your old system, there are
several points to consider.
v To access migrated applications from your original terminals you must define
the transactions as remote transactions on your existing CICS system and define
the terminal as remote in the Terminal Definitions (WD) on TXSeries CICS.
v To access applications that you have not migrated to TXSeries CICS, from an
existing CICS terminal, define the transactions as remote in the Transaction
Definitions (TD) on TXSeries CICS. You need to define the terminal as remote to
TXSeries CICS.
Note: There is an alternative to the creation of a remote definition of a terminal
in any remote system to which it wants to direct a transaction routing
request. This is to make the terminals local definition in the terminal
owning region shippable with the Terminal Definitions (WD) IsShippable
attribute. If a terminal definition is shippable, sufficient data is passed
with a transaction routing request to enable the remote system to
dynamically install the necessary remote terminal definition. For further
information about shippable terminals, refer to the CICS Administration
Reference .
195
Migrating data
TXSeries CICS provides the CALF transaction (Convert and Load File) to enable
you to migrate data to your region. This transaction allows you to transfer any file
for which you can create a File Definitions (FD) entry. In this way, data on remote
VSAM files can be migrated. CALF works with function shipping.
CALF accepts the following three filetypes:
v Key sequenced data set (KSDS)
v Entry sequenced data set (ESDS)
196
197
198
TXSeries CICS does not support application programs written in source languages
other than COBOL, C, C++, or PL/I. This means that if you do not discard existing
application programs written in other languages you must recode them, or you
must maintain your existing CICS system and run it in coexistence with the
TXSeries CICS region.
Before you recompile any application programs in COBOL, C or C++ that you
intend to migrate to TXSeries CICS, you must process the application program
with the CICS translator. (Described in Chapter 8, Translating, compiling, and
link-editing CICS application programs, on page 213.) The compilation process
highlights, as errors, any language syntax that is not supported.
Macro-level applications
TXSeries CICS does not support macro-level application programs. If your existing
CICS system contains macro-level applications which you may not discard, then
you must do one of the following:
v Rewrite the applications to use the API commands that TXSeries CICS supports.
v Allow the applications to coexist with TXSeries CICS by continuing to run them
in your existing CICS system.
199
Database systems
TXSeries CICS supports the inclusion of Structured Query Language (SQL)
statements within application programs but you must separately process the SQL
statements through your database manager. It does not support the data language
1 (DL/I) database access language. If your existing CICS system contains
applications which use DL/I which you may not discard, then you must do one of
the following:
v Rewrite the applications to use the databases that TXSeries CICS supports.
v Allow the applications to coexist with TXSeries CICS by continuing to run them
in your existing CICS system.
Journal post-processors
TXSeries CICS does not provide off-line utilities that format user and system
journals. As the journal records are in a format unique to TXSeries CICS, any
existing formatting programs will not work unless you modify them.
Short-on-storage conditions
The underlying main storage architecture for TXSeries CICS differs from that
provided by other CICS family members in the handling of short-on-storage
conditions. Instead of always suspending a running task (unless you define the
task with NOSUSPEND), TXSeries CICS responds in a number of ways depending
upon the type of storage request made, and whether storage is requested by an
application program or internally by CICS. CICS may:
v Return a CICS condition code to application program.
v Raise a CICS abnormal termination code on the application program, or the
CICS runtime system.
v Suspend the running task pending the acquisition of task shared storage for
loading Basic Mapping Support (BMS) maps and data tables. TXSeries CICS may
subsequently abnormally terminate the application program if storage remains
unavailable for some time.
While application programs that you migrate may translate, compile and link
correctly, TXSeries CICS may raise a number of additional abnormal termination
codes, due to short-on-storage conditions. You may need to change your
application programs to handle such conditions.
200
specific hexadecimal values), you need to change these values to the equivalent
ASCII representations. Alternatively, if you are using Micro Focus Net Express
version 3.0 or later on a Windows platform, you can compile EBCDIC-enabled
COBOL programs that run on a Windows workstation. See Compiling
EBCDIC-enabled COBOL programs on page 57 and Using Micro Focus Net
Express to compile EBCDIC-enabled COBOL programs on page 227 for more
information.
201
202
Notice that the occursd structure is named in both the input map mapnameis and
the output map mapnameos. This enables the structure to be used for both input
and output operations.
Migrating maps from CICS OS/2: When generating BMS maps in C or C++,
CICS OS/2 always assumes the When generating BMS maps in C, CICS OS/2
always assumes the parameter STORAGE=AUTO while TXSeries CICS does not.
To migrate between the two implementations you must either specify
STORAGE=AUTO in the CICS OS/2 map definition or amend the source program
code to refer to the generated pointer rather than the structure.
This also applies if you are migrating maps from CICS for Windows.
Migrating maps from your CICS system to other family members: TXSeries
CICS allows you to include fields with the same name on different maps within a
map set. This is not the case in other CICS products. If you wish to port your map
set from TXSeries CICS to IBM mainframe-based CICS, you should ensure that all
BMS map and field names are unique within a map set.
The cicsmap command checks that the TYPE= operand specifies either MAP,
DSECT, or &SYSPARM. However, the value is ignored by TXSeries CICS. Map
generation is controlled with the -p (physical) and -s (symbolic) cicsmap flags. If
neither flag is specified, both physical and symbolic maps are generated.
Chapter 7. Migrating CICS applications to and from TXSeries CICS
203
204
The XINIT data in a BMS map can be transformed from EBCDIC using the -e
option of cicsmap that interprets the data as EBCDIC and automatically converts it
to ASCII.
Unless you are using extended attributes, all the other sequences may be portably
coded using character values or values from the standard copybook DFHBMSCA.
Hexadecimal values or bit masks are non-portable and will need to be modified
when moving an application from a non-ASCII system.
Special conversions: TXSeries CICS performs special translations on the following
control sequences because they have no standard representation in ASCII
datastreams:
v StartFieldExtended
v SetAttribute
v ModifyField
StartFieldExtended and ModifyField are represented as follows:
Code: NumberOfPairs : AttributeType : AttributeValue : ..
where Code is X'10' for StartFieldExtended, X'1A' for ModifyField, and X'1F' for
SetAttribute.
NumberOfPairs is a hexadecimal value, as is the AttributeType. These will have
the same value on both ASCII and EBCDIC systems.
For all extended attributes, except for Field Validation and Field Outlining, which
TXSeries CICS does not support, the AttributeValue is a graphic character and can
be coded portably as a character value or as a defined value in the DFHBMSCA
copybook.
File services
If you are migrating application programs that use the API file services, be aware
of the following migration concerns:
v EXEC CICS READNEXT and EXEC CICS READPREV with an alternate index
v VSAM emulation
v Exclusive or shared file access permissions
v SFS considerations
v DB2 considerations
EXEC CICS READNEXT and EXEC CICS READPREV with an alternate index:
The behavior of the file control commands EXEC CICS READNEXT and EXEC
CICS READPREV differs between TXSeries CICS and other CICS family members
when dealing with duplicate records in an alternate index. Consider records with
the following keys:
1. AAA
2. BBB
Chapter 7. Migrating CICS applications to and from TXSeries CICS
205
3. BBB
4. BBB
If a sequence of EXEC CICS READNEXT commands obtains records 1 to 4, and an
application issues an EXEC CICS READPREV command, TXSeries CICS returns
record 4, while some other CICS family members return record 2 (this record being
the first of the set of duplicates with the specified key.)
If you call EXEC CICS READNEXT and then EXEC CICS READPREV, TXSeries
CICS attempts to return the same record, but must read an additional record when
it reverses the browse. The extra read call ensures that the DUPKEY condition is
correctly raised in indexes that allow records with duplicate keys. In the following
example, there are five records and the browse is positioned at record 2:
1. AAA
2. BBB
3. BBB
4. CCC
5. DDD
An EXEC CICS READNEXT, EXEC CICS READPREV sequence is carried out.
TXSeries CICS returns record 3 for the EXEC CICS READNEXT. Record 4 is not a
duplicate, so it does not set DUPKEY. To carry out the EXEC CICS READPREV
call, TXSeries CICS reads record 4 (the NEXT record) and then sets the browse in
the new direction. TXSeries CICS reads record 3 (the PREV record) and sets the
DUPKEY because record 2 is a duplicate.
Because EXEC CICS READPREV uses two read calls when it reverses the browse,
it is possible for another process to simultaneously insert records and cause an
unexpected result. For example, a process might insert a record with key BBZ
between the two read calls needed for EXEC CICS READPREV. At the end of the
EXEC CICS READPREV, the browse would be positioned at the new record, not
record 3.
VSAM emulation: TXSeries CICS provides emulation of virtual sequential access
method (VSAM). VSAM is an access method for direct or sequential processing of
fixed- and variable-length records on direct access devices. The records in a VSAM
data set or file can be organized in logical sequence by a key field (key sequence),
in the physical sequence in which they are written on the data set or file
(entry-sequence). or by relative-record number. The VSAM emulation that TXSeries
CICS provides is through the use of the SFS, but differs in some areas of detailed
implementation:
File access
If IBM mainframe-based CICS opens a VSAM file, setting the attribute for
exclusive access, any CICS transaction can access the file but the file is
unavailable outside the CICS region. This limitation is because CICS is
responsible for any recovery processing of the file. TXSeries CICS does not
need to open SFS files for exclusive access as any recovery processing is
performed by SFS.
Record locking
An application requesting a record for update causes VSAM to lock the
complete control interval. The same request using SFS causes only the
requested record to be locked.
Updating alternate keys
Unlike VSAM, SFS allows you to update alternate key values when
206
207
In CICS/MVS, the CICS region manages the LUWs for VSAM operations, and
CICS only distributes work when the region either performs some ISC
operation with another CICS region, or when a recoverable resource manager,
such as a relational database, is used.
TXSeries CICS has a client/server relationship with SFS, with each SFS being a
recoverable resource. In consequence all CICS operations that utilize SFS (those
concerned with file control, temporary storage queues, transient data queues,
and the local queueing of function shipping requests) cooperate with SFS in the
management of each LUW. Hence, transactions that are entirely local under
CICS/MVS, are effectively distributed under TXSeries CICS.
This difference between the way that CICS/MVS and TXSeries CICS distribute
responsibility for an LUW, and its resolution, underlies some differences in
behavior between CICS family members.
Consider the following sequence, and the effect of a request by some other
transaction to EXEC CICS READ RECORD A, which might occur at any of the
5 indicated points in the sequence. As CICS typically allows locked records to
be read, the results at the 5 points are as shown.
1
2
3
4
5
READ
READ
READ
READ
READ
RECORD
RECORD
RECORD
RECORD
RECORD
A
A
A
A
A
=>
=>
=>
=>
=>
NOTFND
SUCCESS
SUCCESS
NOTFND
???????
WRITE RECORD A
SYNCPOINT
DELETE RECORD A
ROLLBACK
READ
READ
READ
READ
READ
READ
READ
RECORD
RECORD
RECORD
RECORD
RECORD
RECORD
RECORD
A
A
A
A
A
A
A
=>
=>
=>
=>
=>
=>
=>
NOTFND
SUCCESS
SUCCESS
NOTFND
NOTFND
NOTFND
SUCCESS
WRITE RECORD A
SYNCPOINT
DELETE RECORD A
ROLLBACK
(SFS starts ROLLBACK)
(SFS completes ROLLBACK)
If the read being attempted involves taking a lock, then the reads at points 2, 4,
5 and 6 wait for the transaction resolution, or timeout with an AKCS abnormal
termination. Do not view these scenarios as two separate transactions, but a
single transaction that performs the following sequence:
WRITE RECORD A
SYNCPOINT
DELETE RECORD A
ROLLBACK
READ RECORD A
Queue services
If you are migrating application programs that use the API queue services, you
need to be aware of the following migration concerns:
208
Transient data queue trigger levels: When a transient data queue reaches its
trigger level for automatic transaction initiation (ATI), and all servers are utilized,
TXSeries CICS postpones the ATI until a further transient data queue record is
written. Thus, TXSeries CICS does not necessarily initiate a task when the trigger
level is reached, but when the trigger level is exceeded. In TXSeries CICS, the ATI
takes place as soon as a server becomes available.
Extrapartition transient data queue considerations: Unlike some CICS systems,
TXSeries CICS opens extrapartition transient data queues whenever CICS runs a
transaction that requires access to an extrapartition transient data queue.
Conversely the application server closes the extrapartition transient data queue
when CICS finishes running the transaction.
209
210
Refer to...
211
212
The combination of the -brtl flag and the -bnortllib flag is used only to
build executable files; it is not used to build libraries.
213
$CICS/lib
prodDir\lib
$CICS/include
prodDir\include
Prerequisite Tasks
v Invoke the cicsmap command for any map sets that your application program
uses. (See cicsmap - generate BMS map files on page 276.)
v If you have COBOL copybooks that contain EXEC CICS statements, use cicstran
to translate them (see Pre-translating COBOL copybooks on page 218).
If necessary, set compile and link options. These are not normally required, since
cicstcl attempts to supply sensible defaults but, if needed, they are supplied as
shown in Table 41 and Table 42 on page 215. The values listed are the environment
variables from which the cicstcl command obtains the flags and directories it uses
when compiling and linking programs. For more information on these flags, see
the sections in this chapter on the language you are using.
Table 41. Setting compile and link options for cicstcl (CICS on Open Systems).
214
Compiler
Compile flags
Linker flags
Libraries to
link
C/C++
CCFLAGS
LDFLAGS
USERLIB
IBM COBOL
CICS_IBMCOB_
FLAGS
LDFLAGS
USERLIB
Include
directories
SYSLIB
Table 41. Setting compile and link options for cicstcl (CICS on Open Systems) (continued).
Compiler
Compile flags
MF COBOL
COBOPTS
IBM PL/I
CICS_IBMPLI_
FLAGS
Linker flags
Libraries to
link
Include
directories
COBCPY
LDFLAGS
USERLIB
Table 42. Setting compile and link options for cicstcl (CICS for Windows).
Compiler
Compile flags
Linker flags
Libraries to
link
IBM C/C++
CICS_IBMC_
FLAGS
ILINK
USERLIB
IBM COBOL
CICS_IBMCOB_
FLAGS
USERLIB
USERLIB
CICS_MSC_FLAGS
IBM PL/I
CICS_IBMPLI_
FLAGS
Include
directories
COBCPY
LINK
USERLIB
Note: If you have both IBM VisualAge C++ and IBM VisualAge COBOL installed,
the COBOL directories must be in the PATH system environment variable
before the C++ directories.
Procedure
Invoke the cicstcl command to translate, compile, and link edit your application
program. If the translation is successful, cicstcl compiles the program, and if the
compilation is successful, link-edits it. (See cicstcl - translate, compile, and link
on page 281.)
CICS writes errors, warnings and informational messages to the operating system
file stream, stderr.
Note: When compiling with cicstcl, you can use the -a option to retain the
intermediate file. On CICS for Windows, this is required if you are using the
program debugging tools.
215
COBOL
file.ccp
file.cbl
file.ccs
file.c
C++
file.ccs
file.C
If your program includes map sets, then you will also use the cicsmap command.
This command takes source files containing Basic Mapping Support (BMS) macros
and generates symbolic and physical maps. They must be generated before
translation.
216
A similar Micro Focus Server Express COBOL command gives the same
translation:
EXEC CICS RECEIVE MAP(A) END-EXEC.
217
The CICS translator only recognizes copybooks included in the main program by
the COBOL copy statement.
Note: Micro Focus Server Express and Net Express default to uppercase so the
single quotes are essential.
Prerequisite task
Invoke the cicsmap command for any map sets that your application program
uses. (See cicsmap - generate BMS map files on page 276.)
Procedure
1. If you have COBOL copybooks that contain EXEC CICS statements, use
cicstran to translate them (see Pre-translating COBOL copybooks).
2. Use cicstran to translate your COBOL, C, or C++ program. Your program is
now ready to be compiled and link edited. Refer to Requirements for
compiling CICS application programs.
CICS writes errors, warnings and informational messages to stderr.
Note: The advantage of using cicstcl to translate your program is that it uses the
proper compile parameters required by CICS.
218
Native
C
Native
C++
Micro Focus
IBM
COBOL
IBM
PL/I
AIX
Yes
Yes
Yes
Server Express
Yes
Yes
HP-UX
Yes
No
Server Express
No
No
Solaris
Yes
Yes
Yes
Server Express
No
No
Windows
Yes
Yes
Yes
Net Express
Yes
Yes
IBM C
MICROSOFT C
Compiler
icc
cl
219
Requirement
IBM C
MICROSOFT C
prodDir\lib\cicsprC.lib
prodDir\lib\cicsprC.lib
Include path
prodDir\include
prodDir\include
Note: The entry point main must be exported and this can be done by declaring it
as:
_declspec(dllexport) void main ....
220
221
To use the library, set the LDFLAGS environment variable to point to the library.
For example:
LDFLAGS=-L/libpath -l fred
On HP-UX, you must set the LDFLAGS environment variable to include this
library. For example, using libpath to represent the path to the library, set the
LDFLAGS environment variables as follows:
LDFLAGS="-Llibpath -lfred"
On HP-UX, you must also set the SHLIB_PATH environment variable to include
this library. Then translate, compile, and link your program as normal.
222
Requirement
IBM C++
MICROSOFT C++
Compiler
icc
cl
prodDir\lib\cicsprCpp.lib
prodDir\lib\cicsprCpp.lib
Include path
prodDir\include
prodDir\include
Note: It is necessary to export _main for CICS transaction programs built with the
IBM compiler. This can be achieved with a definition file with the following
two lines:
EXPORTS
_main
Note: The entry point main must be exported and this can be done by declaring it
as:
_declspec(dllexport) void main ....
223
It is necessary to export _main for CICS transaction programs built with the IBM
compiler, which can be done in a definition file containing the following two lines:
EXPORTS
_main
Do not use the LIBRARY keyword in the definition, because this causes problems
when the program is linked.
If it does not already exist, the definition file is created automatically by cicstcl.
These compiler options are described briefly below. Refer to the compiler
documentation for further information. Some options, for example, -Tp, are
positionally dependent and must come immediately before the source file.
-Mt
-Ge-
-Gd+
-Tp
gi
It can also be necessary to use the -Ft- option if you are using class templates.
Note: If you wish to change the default linkage to _cdecl, use the -Mc option
instead of -Mt.
224
-LD
Build DLL.
-GX
-Tp
Note: If you wish to change the default linkage to _cdecl, use the -Gd option
instead of -Gz.
For Micro Focus Server Express COBOL, use the compiler COBCPY environment
variable for the copybook path. The copybook path is:
$CICS/include
Chapter 8. Translating, compiling, and link-editing CICS application programs
225
If you compile without Animator, the command produces the following file:
filename.gnt
Note: Do not use the file name extensions for the PathName. For example, if the
program fred.int is installed at:
/usr/mydirectory/fred.int
If you have compiled the file with Animator, you must install the .idy file and the
.int file as described in Using the debugging tool integrated with Micro Focus
Server Express COBOL on CICS on Open Systems (Animator) on page 269.
Install the .gnt file according to the PathName attribute in the Program Definitions
(PD) for the required transaction.
Note: To avoid losing leading digits, use NOTRUNC if values greater than 9999
are assigned to COMP items.
226
v The following example shows how to use the cicstcl command to compile the
file myprog.ccp. (This command can be used to produce only .cbmfnt files.)
cicstcl myprog.ccp
In this example, the cicstran command uses the .ccp file to produce the .cbl file,
which is used by the cobol command. The cobol command produces an .obj
file, which is used by the cbllink command. The cbllink command produces the
.cbmfnt file. The command set is best run from within a Micro Focus Net
Express command window because the environment is already set up. The
semicolon (;) in the compile step is significant because it makes execution faster
by stopping the compiler from prompting you.
If you are using Micro Focus Net Express and want to produce an .int file, you
do not need to run the cbllink command. However, you must specify the
/NOGNT option to the cobol command.
You must either specify myprog in the PROGRAM ID paragraph or use the -M
option to ensure that the program has an entry point matching the source name.
The CICS COPYBOOK files are CICS-API and CICS-EIB.
Then translate the program on the workstation. You can specify the cicscobinsert
utility as a value for the -X parameter of the cicstcl command or use it as a
separate command step after running the cicstran command, but before
performing the actual compilation.
Chapter 8. Translating, compiling, and link-editing CICS application programs
227
v The following example uses the cicstcl command to compile a program called
myprog.ccp as EBCDIC-enabled:
cicstcl -X cicscobinsert myprog.ccp
v The following example uses a separate command step after the cicstran
command to compile a program called myprog.ccp as EBCDIC-enabled:
cicstran -qAPOST myprog.ccp
cicscobinsert myprog.cbl
cobol /DATA-CONTEXT /CALL-RECOVERY /CHARSET(EBCDIC) myprog.cbl;
cbllink -D -Mmyprog -Omyprog.cbmfnt myprog.obj
C:\opt\cics\lib\cicsprCBMFNT.lib
In this example, the cicstran command uses the .ccp file to produce the .cbl file,
which is used by the cicscobinsert and cobol commands. The cobol command
produces the .obj file, which is used by the cbllink command. The cbllink
command produces the .cbmfnt file. The command set is best run from within a
Micro Focus Net Express command window because the environment is already
set up. The semicolon (;) in the compile step is significant because it makes
execution faster by stopping the compiler from prompting you.
You must either specify myprog in the PROGRAM ID paragraph or use the -M
option to ensure that the program has an entry point matching the source name.
See Compiling EBCDIC-enabled COBOL programs on page 57 and cicstcl translate, compile, and link on page 281 for related information.
228
If you are compiling a program that calls a subprogram, you must compiler the
subprogram, then compile the main program. The following example shows the
compilation of mysubprog:
cob2 mysubprog -dll:mysubprog
If the main program is going to dynamically link to the subprogram, you can also
specify the -qthread option. This specifies that the subprogram gets a separate,
initialized working storage area for each program that invokes it. The working
storage exists for the duration of the main program.
If the subprogram is to be statically linked to the main program, the main program
should be translated, compiled, and linked in three separate steps. The steps are
similar to those shown above, but the names of both the main program and the
subprogram should be used in the ilib and ilink statements.
If the subprogram is to be dynamically linked to the main program, you can use
the cicstcl program. Alternatively, you can translate, compile, and link in separate
steps, but specify that the linking is dynamic using the -qDYNAM option to the
compiler.
For more information on statically and dynamically linking subprograms, see the
IBM Visual Age COBOL programming guide.
Use the compiler SYSLIB environment variable or the -l flag for the copybook path.
The copybook path is:
$CICS/include
229
230
Refer to...
231
232
Error-handling services
Every time you process a CICS command in one of your applications, CICS
automatically raises a condition to tell you how the command worked. This
condition (which is usually NORMAL) is passed back by CICS to your application.
If something out of the ordinary happens, you will get an exception condition,
which simply means a condition other than NORMAL. By testing this condition,
you can tell what has happened, and possibly why. Not all conditions mean that
there is an error, even if they are not NORMAL. (For example, if you get an
ENDFILE condition on an EXEC CICS READNEXT during a file browse, it might
be exactly what you expect.) For further information about all possible conditions
and the commands for which they can occur, see the CICS Application Programming
Reference.
233
You can use the EXEC CICS HANDLE ABEND PROGRAM command. In a C++ or
C application, every EXEC CICS command is treated as if it had the NOHANDLE
option specified. This means that the default system-action transaction abends that
result from a condition occurring, but not being handled, is not possible in a C++
or C application. Control always flows to the next instruction, and it is the
responsibility of the application to test for a normal response.
234
In this example, the first thing to do after the EXEC CICS RECEIVE MAP
command is to test the value CICS puts into RESPONSE to check whether it
worked. You start by looking explicitly for condition MAPFAIL because it can
occur without there being any serious error (if, for example, the user presses
CLEAR at this point in the application) and you have to be able to recover:
IF RESPONSE = DFHRESP(MAPFAIL) GO TO NO-MAP
ACCT01 picks up what information it can about what has happened, and then
links to the error-handling program ACCT04, which issues a user abend and
displays a final error message to the user.
Finally, with all condition testing out of the way, you can resume normal
processing:
IF REQML > 0 MOVE REQMI TO REQC.
Chapter 9. Coding for problem determination
235
RESP and RESP2 options: You can use the RESP option with any command, and
RESP2 with INQUIRE and SET, to test whether an exception condition was raised
during its processing.
RESP(xxx)
where xxx is a user-defined 32-bit binary data area. On return from the
command, it contains a value corresponding to the condition that may
have been raised, or to a normal return, that is, xxx=DFHRESP(NORMAL).
You can test this value using DFHRESP, as follows:
EXEC CICS WRITEQ TS FROM(abc)
QUEUE(qname)
RESP(xxx) END-EXEC.
.
.
IF xxx=DFHRESP(NOSPACE) THEN
RESP2(yyy)
where yyy is a 32-bit binary value that further qualifies the response to
INQUIRE and SET commands. RESP2 codes are noted in the command
descriptions. For further information, see the CICS Application Programming
Reference.
Note: Using the C or C++ language or the RESP option implies NOHANDLE, so
be careful when using C or the RESP option with the EXEC CICS RECEIVE
command, because NOHANDLE overrides the EXEC CICS HANDLE AID
236
While a single EXEC CICS command is being processed, it can raise one of several
conditions.
Note: For example, you may have a file control command that is not only invalid
but that also applies to a file that is not defined in the file definitions.
CICS checks for these conditions and passes back to your application program the
first one (and only the first one) encountered.
An EXEC CICS IGNORE CONDITION command for a given condition applies
only to the program you put it in, and it remains active while the program is
running, or until a later EXEC CICS HANDLE CONDITION command naming the
same condition is met, in which case the EXEC CICS IGNORE CONDITION
command is overridden. Also, an EXEC CICS PUSH HANDLE command will
disable an EXEC CICS IGNORE CONDITION until an EXEC CICS POP HANDLE
command is executed.
You can choose an EXEC CICS IGNORE CONDITION command if you have a
program reading records that are sometimes longer than the space you provided,
but you do not consider this an error and do not want anything done about it. You
might, therefore, code EXEC CICS IGNORE CONDITION LENGERR before issuing
your EXEC CICS READ commands.
You can also use an EXEC CICS IGNORE CONDITION ERROR command to catch
any condition considered as an error that has never been handled or ignored.
You cannot code more than 16 conditions in the same command; the conditions
must be separated by at least one space. You must specify additional conditions in
further EXEC CICS IGNORE CONDITION commands.
237
238
INITIALIZE.
TRAP ANY UNEXPECTED ERRORS.
EXEC CICS HANDLE CONDITION ERROR(OTHER-ERRORS) END-EXEC.
239
Normally, when a CICS program calls a subroutine, the program that receives
control inherits the current HANDLE commands. These commands may not be
appropriate within the called program. The called program can use PUSH
HANDLE to suspend existing HANDLE commands.
Use PUSH HANDLE therefore, to save your present set of HANDLE commands
unaltered while you use a new set in the routine. On exit, you can reinstate the
original set of HANDLE commands by using a corresponding POP HANDLE.
You can nest PUSH HANDLE and POP HANDLE command sequences within a
task. Each PUSH HANDLE command stacks a set of specifications; the POP
HANDLE that follows it restores them. The following example illustrates PUSH
HANDLE and POP HANDLE in action:
*
If you choose to include the error lookup and error message display in one of the
other programs, you can link to a separate program and arrive at this code from all
different points in the code. There are several points to note:
v EXEC CICS PUSH HANDLE commands can be nested. EXEC CICS PUSH
HANDLE suspends the current set of HANDLEs (saving them for later use), and
EXEC CICS POP HANDLE restores the most recent set suspended.
v When you link to another program, an EXEC CICS PUSH HANDLE is implied.
That is, an EXEC CICS PUSH HANDLE occurs between the EXEC CICS LINK
command and the first instruction of the linked-to program that begins with the
system defaults. It can possibly do some of its own HANDLE, EXEC CICS
PUSH HANDLE, or EXEC CICS POP HANDLE commands, but afterwards, the
stack is popped back to the point where the EXEC CICS LINK occurred to
restore the HANDLE status of the linking program when control is returned
there. That is, CICS pushes at each EXEC CICS LINK and pops at each EXEC
CICS RETURN.
Note: You cannot use EXEC CICS POP HANDLE on the first command of a
linked-to program to re-instate the linked-from programs EXEC CICS
HANDLE CONDITIONs.
240
v When you EXEC CICS XCTL to another program, the current table of conditions,
EXEC CICS HANDLE AID commands, and EXEC CICS ABEND commands
(except for abend handling programs) are cleared, even though there is no
implicit EXEC CICS PUSH HANDLE and you are staying at the same logical
program level. (See How CICS keeps track of what to do on page 242.)
One flaw in this example, of course, is that you do not know where to go at the
end of the code and you do not need such sophistication if you are not going
back.
(You could have all your HANDLEs sent to different labels, each of which
would consist of PERFORM OTHER-ERRORS, GO TO back, which would be
wherever this particular error occurred. This shows some of the limitations of
HANDLEs, even with EXEC CICS PUSH HANDLE and EXEC CICS POP
HANDLE.)
No
Take system default
action, one of abend
task, suspend, ignore
Yes
Has an EXEC CICS HANDLE/IGNORE
CONDITION been executed for this
condition only?
Yes
Do specific action
for the condition
No
Is default action for condition
to abend?
No
Take specific default
action that is suspend
or ignore
Yes
Has an EXEC CICS HANDLE/IGNORE
CONDITION been executed for the
ERROR condition?
No
Take specific default
action that is abend task
Yes
Do specific action for
ERROR condition?
241
Mixing methods
You can temporarily deactivate the effect of any EXEC CICS HANDLE
CONDITION by using the RESP, RESP2, or NOHANDLE option on a command. If
you do this, you loose the ability to use any system default action for that
command. In other words, you have to do your own catchall error processing.
You can also switch from ignoring a condition to handling it, or to using the
system default action. For example, you can code:
EXEC CICS IGNORE CONDITION LENGERR END-EXEC.
.
.
.
EXEC CICS HANDLE CONDITION DUPREC(DUPRTN)
LENGERR
ERROR(ERRHANDL)
END-EXEC.
242
b. If the default action for this condition is to wait, further action is governed
by item number 3 in this list.
Otherwise CICS scans the condition table to see what to do.
2. If the condition has been handled or ignored, this determines the action.
3. If the condition has never been handled or ignored, and the default action for
this condition is to suspend execution:
a. If the command has the NOSUSPEND or NOQUEUE option, control returns
to the next instruction.
b. Otherwise, the task is suspended.
4. If the condition has never been handled or ignored, and the default action for
this condition is to abend, a second search is made, this time for the ERROR
condition, then:
a. If the ERROR condition has been handled or ignored, then this determines
the action.
b. Otherwise, the task is abended. You can, if you want, handle abends.
The commands EXEC CICS ALLOCATE, EXEC CICS ENQ, EXEC CICS
READQ TD, and EXEC CICS WRITEQ TS can all raise conditions for which the
default action is to suspend your application program until the specified
resource becomes available. So, on these commands, you have the
NOSUSPEND option to inhibit this waiting and return immediately to the next
instruction in your application program.
Some conditions can occur during the execution of a number of unrelated
commands. If you want the same action for all occurrences, code a single EXEC
CICS HANDLE CONDITION command at the start of your program.
243
for ANYKEY. An EXEC CICS HANDLE AID command for an AID overrides the
EXEC CICS HANDLE AID ANYKEY command for that AID.
If a task is initiated from a terminal by use of an AID, the first EXEC CICS
RECEIVE command in the task does not read from the terminal but only copies
the input buffer (even if the length of the data is zero) so that control may be
passed by means of an EXEC CICS HANDLE AID command for that AID.
An EXEC CICS RECEIVE MAP command with the FROM option does not cause a
HANDLE AID command to be invoked because no terminal input is involved.
Note: If you use NOHANDLE (or the RESP option, which invokes NOHANDLE),
it suspends the EXEC CICS HANDLE AID function. If you want to change
the program processing, depending on the attention key pressed, compare
the contents of EIBAID with the fields in the standard attention identifier list
(DFHAID), and then transfer control to the routine needed to perform the
function you want.
Abend handling
A program-level abend exit facility is provided in CICS so that you can write exits
of your own that can be given control during abnormal termination of a task. An
example of a function performed by such an abend exit is the cleanup of a
program that has started but not completed normally.
Abnormal termination can occur because of:
v A user request by, for example:
EXEC CICS ABEND ABCODE(...)
244
245
v The EXEC CICS ABEND command indicates that the task is to be abnormally
terminated with control passed to an abend exit specified for a program on a
higher logical level. EXEC CICS ABEND at the top level terminates the task
abnormally.
v A branch to retry an operation. When you are using this method of retrying an
operation, and you want to reenter the original abend exit routine or program if
a second failure occurs, the abend exit routine or program should issue the
EXEC CICS HANDLE ABEND RESET command before branching. This is
because CICS disables the exit routine or program to prevent it reentering the
abend exit.
246
Debugging services
The CICS API provides services that:
v Allow you to trace the flow of control in your application program and in the
region
v Allow you to dump storage areas
These facilities are described in the following pages.
User trace
User trace allows you to trace the actions of a single task. The output is written to
an operating system file. When this file is formatted by the CICS trace formatter
cicstfmt, you can see the EXEC CICS calls made by the task and any trace entries
that the application makes using EXEC CICS ENTER.
The directory used to write the user trace file is specified by the
UserTraceDirectory attribute in the Region Definitions (RD). The file name used is
specified by the TraceFile attribute in the User Definitions (UD) for the user
running the traced task. If there is no UD for this user, the file name comes from
Chapter 9. Coding for problem determination
247
the PublicUserTraceFile attribute in the RD. So that CICS does not destroy a trace
file that already exists, a sequence number is always added to the file name. CICS
uses the first sequence number available. For example, if the TraceFile attribute
value is mytracefile and this is the first trace file produced, CICS will write user
trace to mytracefile.001. However, even with this protection, you should choose
the file names used for this type of tracing carefully, so that users can easily
identify their trace files.
User trace is enabled by the EXEC CICS TRACE command issued by the traced
application, provided that the master trace flag and the user trace flag have been
correctly set.
System trace
System trace allows you to trace the activities of a region, CICS off-line utilities,
and CICS terminal clients. This includes entry and exit tracing of function calls,
exception and non-exception events, and EXEC CICS interface calls. Because the
volume of trace produced by a region can be very large, you can limit the type of
trace produced and the functional area that is traced. However, you cannot
suppress the generation of the exception event trace that is produced whenever a
symrec is raised.
System trace can be written to up to three destinations depending on whether the
trace is from a region, a CICS terminal client, or a CICS off-line utility:
v Main storage buffer
v Auxiliary trace
v External trace (on CICS for AIX only)
Main storage buffer (region only): The processes that make up a region always
write any system trace they produce to the same cyclical main memory buffer,
which is also called the main storage trace. This buffer appears in a system dump.
Auxiliary trace: A system trace can be written to operating system files. For CICS
on Open Systems clients and off-line utilities, each operating system process that
executes will write to its own file. The path and name of these files is based on the
setting of the environment variable CICSTRACE. For example, if CICSTRACE is
set to mytracefile, then the trace file names used would be mytracefile.001,
mytracefile.002, and so on.
For a region, two files can be specified by the values of the TraceFileA and the
TraceFileB attributes in the RD. These two files are used alternately. You can
switch between them using the command CEMT SET AUXTRACE SWITCH. When
you cold start a region, auxiliary trace is initially set to use the file name in
TraceFileA. When a region is restarted, auxiliary trace is set to use the file that was
not in use at the time of the previous shutdown.
248
External trace (On CICS for AIX only): If you have an event performance trace
facility (EPTF) on your operating system, you can set the ExternalTrace attribute in
the RD to yes to cause any system trace that a region produces to be written to the
EPTF. CICS on Open Systems clients and off-line utilities write to the EPTF if the
environment variable CICSEXTERNALTRACE is set to a value other than null.
249
This records the entry and return of EXEC CICS commands. It is also found in
System trace.
Dump
You can use DUMP to write specified areas of memory to a file, to assist in
debugging an application program or to identify why an abnormal termination or
storage violation occurred. You or the CICS system can initiate and own the
transaction dump. A transaction dump can be generated by:
v EXEC CICS DUMP calls
v EXEC CICS ABEND calls
v Transaction abnormal terminations (including abnormal terminations generating
ASRA and ASRB abnormal termination codes when an exception occurs within
an application program belonging to that transaction).
CICS system dumps can be generated by:
v CICS system abnormal terminations
v CICS system shutdowns
v CEMT PERFORM SNAP commands
v The transaction abnormal termination code ASRA when an exception occurs in
an application program
v The transaction abnormal termination code ASRB when a system call is made
incorrectly in an application program.
v EXEC CICS PERFORM SNAP Application Programming Interface.
The dump facility uses the dump sequence number to give each dump file a
unique name. CICS increments the dump sequence number each time a valid
request to dump occurs. CICS records the number of dumps taken and the number
of dump write errors as they occur. You can request and output dump statistics
whenever you require. You can disable some types of dump. For example, you can
disable all dumps except for those produced as a result of an EXEC CICS DUMP
command.
Also, the dump facility uses a number of directories to write the dump data. These
directories are sub-directories of the dump directory. The dump sub-directories can
be symbolically linked to directories on different physical devices, which gives you
more space to save dumps in.
You can ask the CICS operator to request a dump when the region is shut down.
Once complete, CICS saves the dump sequence number for the next auto start of
the region.
The CICS Runtime Resource Management (CEMT) transaction allows you to use
CEMT INQUIRE/SET DUMP and CEMT INQUIRE/SET DUMP OPTIONS to
control the dump facility interactively during runtime.
250
identified if that EXEC CICS statement generates an abend. The line number
relates to the CICS source file (filename.ccs or filename.ccp).
(On CICS for AIX only)
v Use the cicstcl option -s for C, C++, or IBM Cobol to obtain assembly listings
and intermediate (compiler source) files. These can be used to identify the failing
line of source code if the application generates an exception, (which results in a
CICS ASRA or ARSB abend) as the offset of the failing instruction may be
shown in the dump.
If the application is compiled with a separate compiler command instead of
cicstcl, or if it is a non-CICS program called from a CICS program, use the
compiler option -qlist to generate these listings.
If an exception occurs in an application program (including a non-CICS
subroutine), the contents of the general purpose registers are also included in the
transaction dump; this information can be used in conjunction with the assembly
listings for debugging the application.
v Use the cicstcl option -s for IBM Cobol applications also to generate a data
map listing. This listing gives the size of all data items and the offsets of data
items within data structures in the working storage area. The working storage
area is included in the transaction dump; to aid location of data structures in
this dumped area it is useful to include unique eyecatchers at the start of such
structures. All data items in these structures can then be located in the dumped
storage (for this reason, it can also be useful to include all data items in
structures where possible).
251
Statistics services
You can use the CICS statistics commands (EXEC CICS COLLECT STATISTICS,
EXEC CICS INQUIRE STATISTICS, EXEC CICS PERFORM STATISTICS, and EXEC
CICS SET STATISTICS) to produce region-wide information on resource utilization
and activity. This information may be used in several ways, for example:
Region configuration
You can find out whether or not your attribute values in the Region
Definitions (RD) are correct for your systems usage pattern, by examining
items such as storage usage.
Intersystem activity
You can see how much interaction there is with other systems. This could
be used to show that some functions may be better processed locally rather
than remotely, for example.
Problem determination
You can use the statistics to help track down problems as well as to
provide input to performance tuning.
CICS provides a utility (see the CICS Administration Reference) to help you format
and display the statistics information.
252
|
|
|
|
|
|
|
v Using standard CICS facilities to test your application on page 254 covers
using trace, dump, and journaling to aid in testing and debugging.
v Using CICS-supplied transactions to test your application on page 255 details
using Temporary Storage Browse (CEBR), Command Level Interpreter (CECI) ,
Syntax Checker (CECS), and Execution Diagnostic Facility (CEDF) for debugging
tasks. In addition, details about how to configure CICS to debug Micro Focus
Server Express COBOL applications with Animator (CADB), Application
Diagnosis Configuration (CDCN), and the IBM Application Debugging Program
(xldb) are included.
v Using a compilers integrated debugging tool to debug CICS applications on
page 263 contains information for debugging with the tools that are integrated
with compilers. For CICS for Windows, the debugging tools for the following
compilers are discussed: IBM VisualAge for C, C++, and COBOL, Microsoft
Visual C++, and Micro Focus Net Express COBOL. For CICS for Open Systems,
the debugging tool with the Micro Focus Server Express COBOL compiler is
discussed.
253
v Use EXEC CICS PERFORM SNAP API to dump the system memory from the
CICS application code for debugging.
v Use the replaceable cicsterm (CICS on Open Systems)process as a vehicle to help
automate tests that involve user input and output.
|
|
For further information about finding a problem, see the CICS Problem
Determination Guide.
|
|
|
|
254
|
|
|
|
|
The following CICS-supplied transactions can be used to help you test and debug
your application programs:
v Temporary Storage Browse (CEBR), which is used to browse and manipulate
temporary storage queues.
v Command Level Interpreter (CECI) and Syntax Checker (CECS), which are used
to test the syntax of EXEC CICS commands.
v Execution Diagnostic Facility (CEDF), which is used to invoke the Execution
Diagnostic Facility (EDF).
v Application Diagnosis Configuration (CDCN), which is used to turn the IBM
Application Debugging tool (xldb) on and off. (This tool is used on CICS for
AIX only.)
v CADB can be used to configure CICS to run Micro Focus Server Express COBOL
applications through Animator. (Animator is the debugger that is supplied with
Micro Focus Server Express COBOL). CADB is supported with CICS on open
systems only. See the CICS Administration Reference for more information about
CADB.
v CJDB, which invokes the Java debugging facilities. See Accessing Java
debugging facilities with the CJDB transaction on page 271 for more
information.
255
CEBR [queuename]
where queuename is the name of the temporary storage queue that you wish to
browse. If you do not specify a queue name, the CEBR transaction generates one
for you. The generated queue name is CEBRname, where name is your terminal
identifier.
256
v When writing application programs, you can check the syntax of the whole CICS
command level application programming interface. If you are using CECI, you
can carry through most of the commands to invocation, and you can request to
see the results of the invocation.
v Using CECI provides a means of interaction with the system. For example, you
can correct a file control record that has been overwritten with invalid data,
create or delete a temporary storage queue, and so on. CECI provides a useful
extension to the facilities provided by the runtime resource management
transaction, CEMT.
To run the command interpreter and syntax checker, you must have a transaction
security level (TSL) key that matches the transaction security key defined in the
Transaction Definitions (TD).
The TD entry for the CECI transaction specifies, by default, that resource level
security checking is required for any resources referenced with the interpreter. This
checking applies to files, transient data queues, temporary storage queues,
programs, transaction identifiers of the EXEC CICS START command, and journal
file identifiers.
To use CECI or CECS, enter:
{CECI | CECS} command
where command is the CICS API command whose syntax you wish to check, or that
you wish to interpret.
Note: If the resource security level (RSL) key specified in the appropriate resource
definition is not matched by RSL keys of the user that is signed on, the
resource security check fails, and the response to the command is the
NOTAUTH condition.
For more information, see the CICS Administration Reference.
257
not running and most of the time does not appear on INQ TASK displays). On
CICS, both terminals are under control of a single task (the user task), which is
effectively debugging itself and sending the output to the terminal running under
CEDF.
On the Windows platform, you cannot use CEDF to debug a transaction on a
remote CICS system. This is only possible if EDF can be used in single screen
mode on the remote system. You would need to run the CRTE transaction first, to
establish a routing session to the remote system; then, you could transaction route
CEDF to that system.
Similarly, you cannot use CEDF to debug a transaction on a remote terminal.
You can use EDF to test user transactions (application programs) and the function
shipping mirror transaction supplied by CICS. You cannot use it for any other
transaction provided by CICS.
To use CEDF, enter:
CEDF { termid | sysid } [,ON | ,OFF ]
where termid is the four-character identifier of the terminal (termid) on which the
transaction to be tested is being run and sysid is the four-character identifier of the
remote region (sysid) when you want to test inbound transactions from a different
region. The transaction must be defined in the Terminal Definitions (WD), unless it
is generated from a terminal autoinstall. The remote region must be defined in the
Communications Definitions (CD).
The ON setting specifies that the EDF session is to be started, and the OFF setting
specifies that the EDF session is to be ended.
For more information, see the CICS Administration Reference.
4. Run CDCN to turn on the debugging tool. (See the CICS Administration
Reference for related information.)
5. Run the transaction.
Note: Refer to the documentation provided with the IBM Application Debugging
Program for information on installing product.
Only programs compiled for debug will produce symbolic output from the IBM
Application Debugging Program when run under control of the IBM Application
Debugging Program. If the IBM Application Debugging Program is triggered for a
258
program that has not been compiled for debug, the IBM Application Debugging
Program displays the program as assembler statements.
|
|
|
|
|
|
Note: While the IBM Application Debugging Program is active, do not use the
CICS CEMT command PERFORM SNAP DUMP and run applications that
are coded with EXEC CICS PERFORM SNAP API . When CICS takes a snap
dump, it dumps out to all the application servers. If the IBM Application
Debugging Program is running, CICS does not have control of the
application servers, and the dump cannot complete.
Note:
Configuring CDCN
To ensure that the IBM Application Debugging Program functions with minimal
disruption to CICS, or any other software, two preparation steps are required:
v Resource settings must be indicated for the use of the IBM Application
Debugging Program
v Development conventions must be observed in regard to the use of the IBM
Application Debugging Program.
Required resource settings for the IBM Application Debugging Program
discusses the settings that must be made. Development conventions required for
effective use of the IBM Application Debugging Program on page 261 discusses
the conventions required to ensure proper functioning of the IBM Application
Debugging Program.
Required resource settings for the IBM Application Debugging Program: Some
of the information used to run the IBM Application Debugging Program is
obtained from the .Xdefaults file. This file determines the defaults for fonts, colors,
and the location of the program source. CICS determines the location of the
.Xdefaults file from the value of the variable XENVIRONMENT. The following
lines must be included in the .Xdefaults file:
xldb.sourceSearchPath: /var/cics_regions/regionName/bin . [directoryNames]
xldb.automaticBreakpoints: NO
xldb.ignoreSignals: USR2
xldb.multiprocessDebug: false
xldb.specialLayout: true
xldb.ThreadsScrollbars: both
xldb.ThreadsGeometry: 760x300+40+100
In this example, regionName is the name of the region, the period represents the
current directory, and directoryNames are the names of other directories in which
the IBM Application Debugging Program should search for source code.
Each of the resource settings included in the .Xdefaults file are discussed in detail
in the following sections.
The automaticBreakpoints resource setting: The automaticBreakpoints setting
prevents breakpointing on system calls. However, it also prevents automatic
breakpointing on application calls to other programs. Therefore, you must ensure
that breakpoints are explicitly set at the start of all application programs that are to
be debugged.
Note: The IBM Application Debugging Program sets the default value for the
automaticBreakpoints resource to yes. It is important that you explicitly set
this value to no.
Chapter 10. Testing and debugging your application
259
260
2. Cold start CICS. All users of the region will then share the same IBM
Application Debugging Program settings.
v To configure an environment where individual users in a region have
individually-defined IBM Application Debugging Program settings:
1. Add the following line to a file envFile in your personal storage:
XENVIRONMENT=XdefaultsPathname
3. In addition, you can avoid the need to enter the DISPLAY= parameter when
you run the CDCN transaction by including the following line in your
envFile:
DISPLAY=XserverName:displayNumber
261
v Never use the IBM Application Debugging Program within a production CICS
Region.
v Always ensure that the values detailed in Required resource settings for the
IBM Application Debugging Program on page 259 are set for the IBM
Application Debugging Program.
v Set a label for the user application thread, as described in The
ThreadsScrollbars and ThreadsGeometry resource settings on page 260.
v When running an the IBM Application Debugging Program session, ANY signal
that is received during the session MUST be passed on to the application. Select
Signal from the Commands window to pass a signal to the application.
v Avoid having either CICS trace or CICS dump enabled while running an IBM
Application Debugging Program session. The trace and dump facilities lock and
wait for common buffers, and this can cause a CICS region to run slowly, or
even to halt, in response to other processes queueing to the resources.
v Do not use the CICS CEMT command PERFORM SNAP DUMP while the IBM
Application Debugging Program is active. When CICS takes a snap dump, it
dumps out to all of the application servers. If the IBM Application Debugging
Program is running, CICS does not have control of the application servers, and
the dump cannot complete.
Terminal (termid)
System (sysid)
Transaction
(transid)
Program (progid)
Each trigger resource can have just one session of the IBM Application Debugging
Program started for it. Control of the debugging session by the trigger resource
adheres to the following order of precedence:
1. Terminal (termid)
2. System (sysid)
3. Transaction (tranid)
4. Program (progid)
To illustrate this order of precedence, consider the following example:
You turn on debugging for both a terminal, identified as AR01, and for a
transaction, identified as ALAN. You run transaction ALAN on terminal AR01. In
this scenario, only one session of the IBM Application Debugging Program is
262
started the session associated with terminal AR01. This single debug session
occurs because two debug sessions cannot debug the same physical copy of the
code, and the terminal trigger takes precedence over the transaction trigger.
It is possible to have multiple copies of the same program code being debugged at
the same time. A second invocation of ALAN that is run from a different terminal
will start a second session of the IBM Application Debugging Program. This
second debug session is associated with transaction ALAN.
For more information, see the CICS Administration Reference.
Compiler
Debugger
idebug
C++
idebug
IBM COBOL
idebug
windbg/msdev
C++
windbg/msdev
COBOL
Animator
263
v Use the debugging tools integrated with each language compiler. If you are
building the application in separate steps, each individual compiler has
debugging options which can be switched on. These options are discussed for
each compiler in the following sections.
Description
-O-
-Oi-
-Ti+
-DE
2. Ensure that the PATH system environment variable includes the directory that
contains your dynamic link library (DLL).
3. Create a new system environment variable DEBUG_PATH that is set to the
directory path containing the source file (progname.c) for your DLL.
4. For C++, make a copy of the progname.ibmcpp program and name it
progname.dll. Place this file in a directory that is before the progname.ibmcpp copy
in the PATH environment variable, but not where CICS will use it in preference
to the progname.ibmcpp file.
The following example explains this:
PATH=d:\prog_dir;e:\var\cics_regions\alex1\bin.
PathName=progname is in the PD definition.
The file progname.dll is in the d:\prog_dir directory.
The file progname.ibmcpp is in the e:\var\cics_regions\alex1\bin dir
Note: If you have both IBM VisualAge C++ (Windows only) and IBM VisualAge
COBOL installed, the COBOL directories must be in the PATH system
environment variable before the C++ directories.
Procedure for using the debugging tool integrated with IBM VisualAge C/C++:
Perform the following steps to set breakpoints, to step through the program, and to
look at storage for the purpose of debugging your program.
1. Start CICS and install a terminal.
2. Use the idebug command from the command-line to start the IBM VisualAge
Debugger.
3. Select the Process list button from the Debug Session Control window.
4. Select the CICS Application Server (cicsas) process that will run your
transaction. Click the Attach button, and wait for the debugger to attach to
the cicsas.
5. Select Breakpoints from the Debug Session Control window. Set load
occurrence.
6. Enter your DLL name in the box (eg. progname.dll) and press OK.
7. Enter your transaction ID at the terminal, and press Enter. The transaction
does not start yet because the idebug command has stopped the cicsas
process.
264
8. Select the Run menu from the Debug Session Control window, and click Run.
The process will continue until the DLL is loaded. A message window appears
to confirm this. Click OK.
9. Select Breakpoints from the Debug Session Control window. Enter the
following information; then, click OK:
Set function breakpoint
Executable:progname.dll, Source:progname.c,
Function: main.
10. Select the Run menu from the Debug Session Control window, and click Run.
The process will continue until the application program is about to start.
Ending the debugging session: To end the debugging session, select the File
menu from any of the Debug Session Control windows, and click on Close
Debugger. This shuts down the cicsas that the debugger was attached to, but does
not otherwise affect the region.
The debugger can be restarted and attached to a new cicsas.
Note: Use the CEMT INQUIRE TASK command to identify the process number
being used by a particular cicsas.
Description
-g
/de
Combine with the ilink command to generate line numbers and symbol
table.
or, if performing the link step separately:
-de
2. Ensure that the PATH system environment variable includes the directory that
contains your dynamic link library (DLL), progname.ibmcob.
3. Create a new system environment variable CAT_OVERRIDE that is set to the
directory path containing the source file (progname.cbl) for your DLL.
4. Set MAXSERVER=1 in your Region Definitions (RD). To do this, follow these
steps:
a. Open the IBM TXSeries Administration Tool
b. Highlight your region, and right-click on it
c. Select Properties from the popup menu
d. Select the Tuning tab
e. Change the Maximum Application Servers value to 1.
Note: If you have both IBM VisualAge C++ (Windows only) and IBM VisualAge
COBOL installed, the COBOL directories must be in the PATH system
environment variable before the C++ directories.
Procedure for using the debugging tool integrated with IBM VisualAge for
COBOL: Perform the following steps to set breakpoints, to step through the
program, and to look at storage for the purpose of debugging your program:
1. Start CICS, and install a terminal.
Chapter 10. Testing and debugging your application
265
2. Start the IBM VisualAge Debugger by issuing the idebug command at the
command-line.
3. Select the Process list button from the Debug Session Control window.
4. Select the cicsas process that will run your transaction. (If you set the
MAXSERVER=1, you only have one process called cicsas to select.)
5. Click the Attach button. Wait for the debugger to attach to cicsas.
6. There are two alternative procedures at this step:
a. To debug an individual program, select Breakpoints from the Debug
Session Control window, then:
v Select Entry
v Set Executable:progname.ibmcob
v Set Source: (leave blank)
v Set Entry: PROGNAME (must be in upper case)
v Click Defer Breakpoint
v Click Set
v Click OK
b. To debug all programs compiled for debug in this process, select Options
from the Debug Session Control window, then:
v Debugger settings
v Debugger properties
v Check Set breakpoints at entry points
v Click OK
7. Enter your transaction ID at the terminal and press Enter. The transaction does
not start yet, because the idebug command has stopped the cicsas process.
8. Select the Run menu from the Debug Session Control window, and click on
Run. The process will continue until the entry point of the application program
is reached.
Ending the debugging session: To end the debugging session, select the File
menu from any of the Debug Session Control windows, and click Close Debugger.
This shuts down the cicsas that the debugger was attached to, but does not
otherwise affect the region.
The debugger can be restarted and attached to a new cicsas.
Note: Use the CEMT INQUIRE TASK command to identify the process number
being used by a particular cicsas.
Description
-Zi
-Od
The following options should also be used for the linker: -link -debug:full
-debugtype:cv -PDB:none
266
Procedure for using the debugging tool integrated with Microsoft Visual C/C++
(windbg): Perform the following steps to set breakpoints, to step through the
program, and to look at storage for the purpose of debugging your program:
1. Start CICS and identify the cicsas which will run the application.
Note: The process number being used by a particular cicsas can be identified
by using CEMT INQUIRE TASK.
2. Start windbg, attaching it to the cicsas process using the command:
windbg -p <cicsas pid>
3. In the Windbg main window, select File then Open, and enter the path and
program name of your application source . The source is displayed in a new
window.
4. Place the cursor on the line of source where the first breakpoint is desired and
select DEBUG from the toolbar, then Breakpoints. The Location box displays
the path and name of your program, and an offset for the breakpoint, for
example:
{,E:\var\cics_regions\region1\bin\app1.c,}@17
Enter the name of your DLL after the source name, for example:
{,E:\var\cics_regions\region1\bin\app1.c,app1.dll}@17
Click Add, then OK. If the DLL is not yet loaded, a message appears indicating
that the breakpoint is not instantiated.
5. Enter your transaction ID at the terminal and press Enter. The transaction does
not start yet.
6. From the windbg control window, select the Run menu, and click Go. The
process continues until the breakpoint is reached.
Ending the debugging session: To end debug, select the File menu from any of
the debug windows, and click Exit. This shuts down the CICS application server
that the debugger was attached to, but does not otherwise affect the region.
The debugger can be restarted and attached to a new cicsas.
267
268
|
|
|
|
|
|
Animator enables you to test a Micro Focus Server Express COBOL application
program online without modifying the program. The tool intercepts execution of
the application program at various points before displaying information about the
program. Any screens that the application program sends are displayed by the
tool, so that you can converse with the application program during testing, just as
you would on the production system.
|
|
|
|
|
|
|
CICS supports cross-session debugging with Micro Focus Server Express COBOL.
Cross-session debugging enables the user to use Animator in a different terminal
window from that in which the program to be debugged is running. Animator is
first started in one session and remains in waiting state until it attaches to a Micro
Focus Server Express COBOL program that has been started in another session.
Details of setting up the cross-session debugging are explained below in the setup
procedure.
269
Use the following procedure to configure CICS to run Micro Focus Server Express
COBOL programs with Animator.
1. Set the AllowDebugging attribute in the region definition stanza to yes. This
setting allows you to run CADB in that CICS region.
2. Using the CADB transaction, enable CICS to run Micro Focus Server Express
COBOL programs with Animator. See the CICS Administration Reference for
more information about CADB. You must run CADB before you run the Micro
Focus Server Express COBOL program; otherwise, the program runs to
completion without attaching to the Animator.
3. Compile a Micro Focus Server Express COBOL program. Use the cicstcl
command with the -a flag. For example:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
When you have done these steps, the Animator process waits for the Micro Focus
Server Express COBOL programs to attach. Run the transaction that executes a
Micro Focus Server Express COBOL program.
|
|
|
|
|
|
|
|
|
|
Note: You cannot use Animator to debug Micro Focus Server Express COBOL
programs that are remote to this region. For more information on
cross-session debugging and Animator, refer to Micro Focus Server Express
COBOL documentation.
270
4. Use the cicsadd command to add transaction and program definitions to the
region:
cicsadd -c td txn_name ProgName=program_name RSLKey=public
cicsadd -c pd program_name PathName=program_path
5.
6.
7.
8.
9.
10. Enter the transaction ID, program name, or terminal that serves as input to
the debugger.
271
272
Part 5. Appendixes
273
274
275
cicsmap
Syntax
cicsmap [-a -r ] [ -s | -p] [-e] [-f code_page] {file | file.bms} [-x]
Description
The output physical map file, in the current working directory, is x.map where x is
determined by the SUFFIX and TERM BMS macros. CICS overwrites any previous
physical map file for the same map source file with the newly generated map.
CICS places the symbolic map file in mapset.e for COBOL, mapset.h for C or C++,
mapset.inc for PL/I. CICS produces the symbolic map file in the current working
directory. CICS overwrites any previous symbolic map file for the same map set in
the current working directory with the newly generated map.
CICS does not generate maps if errors are detected in the map source file. The
contents of the map source file determine the operation of the cicsmap command.
The LANG option associated with the map set macro (DFHMSD) determines the
output of cicsmap.
cicsmap produces both the symbolic and physical maps by default or you can use
the -p or -s flags to restrict cicsmap to producing a single map type.
cicsmap ignores TYPE=DSECT, TYPE=MAP, and TYPE=&SYSPARM options. If you
include any other value for TYPE, cicsmap produces an error message. See
Migrating maps from your CICS system to other family members on page 203
for more information.
Errors are written to stderr.
Note: For important information about permissions, refer to Access permissions
for maps and transaction programs on page 37.
Help information is available when an invalid flag or -? is specified.
Options
-a
-e
-f code_set
Code page from which cicsmap is to translate XINIT strings. If you do not
specify this, CICS assumes the users locale.
276
file
Name of the input map source file. You can include an optional pathname
with this name. The source file must either have the extension bms, or
have no extension, in which case cicsmap appends the suffix bms.
-p
cicsmap
-r
-s
-x
Prevents PIC G type COBOL code or GRAPHIC type code from being
generated.
If PS=8 is specified in a named DFHMDF BMS macro of a BMS COBOL or
PL/I map, the cicsmap command generates the PIC G type COBOL code
or GRAPHIC type PL/I code. For example, if LENGTH=12 is specified in
the field BMS macro, PIC G(6) is generated instead of PIC X(12) in a
COBOL map, and GRAPHIC(6) is generated instead of CHARACTER(12)
in a PL/I map. However, the PIC G type is possibly unsupported on your
version of COBOL compiler, or you may wish not to have PIC G or
GRAPHIC types generated. If this is the case, use the -x flag to prevent the
PIC G or GRAPHIC type code from being generated. (Refer to the
documentation for your COBOL compiler to determine if the PIC G type is
supported.)
Restrictions
Standard operating system access permissions for files and directories apply.
Returned Values
cicsmap has the following exit values:
0
cicsmap (-r set) encountered at least one error of moderate severity which
it has written to stderr.
cicsmap (-r set) encountered at least one error of high severity which it has
written to stderr.
Examples
1. To run the command from the current directory to obtain a symbolic map:
cicsmap -s temp.bms
2. The -e option is required where you have converted maps from EBCDIC, for
example from a CICS/MVS system, and the maps contain the XINIT option. So
that cicsmap produces the correct physical map, you need to specify the -e flag.
cicsmap -p -e temp2.bms
277
cicstran
Syntax
Syntax on CICS on Open Systems:
cicstran [-l {COBOL | IBMCOB | C | IBMCPP} | CPP}] [-q] [-s] [-e] [-c number]
[-v] [-d] [-g locale] file
Description
To translate EXEC CICS commands, DFHRESP macros, and DFHVALUE macros
within an application program into source language statements that interface with
the CICS runtime environment, invoke the CICS command language translator
cicstran from an operating system shell. A C application source file of the name
file.ccs produces a C source file in the current working directory with the name
file.c. A C++ application source file of the name file.ccs produces a C++ source file
in the current working directory with the name File.C. A COBOL source file is
produced in the current working directory, with the name file.cbl from an
application source file of the name file.ccp. Errors, warnings, and information
messages are written to the operating system file stream stderr.
You must invoke the translator process prior to the compilation and link-edit steps
when generating program executable code.
You specify options for the command language translation process on the
command-line.
For important information about permissions, refer to Access permissions for
maps and transaction programs on page 37.
Help information is available when an invalid flag or -? is specified.
Options
-c number
Specifies the number of lines to be included in each page of the translator
listing, including heading and blank lines, of the output file created with
the -v and -s flags. number must be an integer in the range 7 through 255.
If 7 or less, the heading and one line of listing is included on each page.
The default is 60.
Note: This option is null when it is not used with the -v or -s flags.
-e
278
cicstran
Note: If you use this option, the programs performance may be degraded
because of the extra activity required to determine the EDF status of
the terminal on every EXEC CICS call.
Produces code that passes line numbers through CICS to be used by the
Execution Diagnostic Facility (CEDF) and to be included in Transaction
Dump information.
-d
-g locale
Sets the locale the translator is to work in, where locale is a string that
provides information to certain set conventions in the locale category.
file
-l
-s
-v
Restrictions
Standard operating system access permissions for files and directories apply.
Examples
1. To translate a C program to utilize CEDF, and produce a cross-reference listing:
cicstran -v -l C -e -c 60 Applic2.ccs
The interaction between the command level translator and the application
programmer is through a set of error codes and conditions output by the
translator. These codes are dependent on whether you invoke the translator for
COBOL or C.
The translator highlights, on an error report, all EXEC CICS commands found to be
in error.
Note: The error report includes line numbers up to 65535. If the line number is
greater than 65535, it is erroneously reported as line number 65535.
The EIBLABEL field, used only for COBOL programs, is used to contain values
relating to handled conditions or abends. The values are:
-1
RETURN or XCTL
0
normal sequential command processing
1
abend
Appendix. CICS commands used in application programming
279
cicstran
2 to nn
a value identifying a label for a handled condition or abend
Returned Values
cicstran has the following exit values:
0
cicstran has detected translator errors and has written messages to the
operating system file stream stderr.
280
cicstcl
Syntax
Syntax on CICS on Open Systems:
cicstcl [-l {COBOL | IBMCOB | C | IBMPLI | IBMCPP | CPP}] [-q] [-s] [-a]
[-e] [-c number] [-v] [-d] [-t (HP-UX only)] [-g locale ] [-x ext cmd] [-X ext cmd]
file
Syntax on CICS for Windows:
cicstcl [-l {COBOL | IBMCOB | C | IBMPLI | IBMC | CPP | IBMCPP}] [-q]
[-s] [-a] [-e] [-c number] [-v] [-d] [-x ext cmd] [-X {ext cmd | cicscobinsert}] file
Note: The -X cicscobinsert option works only on COBOL .cpp files to be compiled
by using Micro Focus Net Express version 3.0 or higher.
Description
This program accepts all the flags taken by the cicstran program, as well as four
additional flags, -a, -x, -X, and, on HP-UX systems only, -t. You specify compile
and link options by using the environment variables as shown in Table 41 on page
214.On C, C++, and COBOL files, the cicstcl command runs the cicstran program
automatically to provide the compile and link directives required by CICS. On IBM
PL/I files, the cicstcl command calls the PL/I compiler that handles the
preprocessing, compiling, and linking of PL/I files.
On CICS on Open Systems, an application program must be contained in a file
with a suffix based on file type. The cicstran program (run automatically on
COBOL, C, and C++ files as part of the cicstcl command) translates file.ccp into
file.cbl or file.ccs into file.c or file.C. The cicstcl command then compiles and links
these .cbl, .c, or .C files. (PL/I programs are not translated prior to compilation. On
these files, the cicstcl command invokes the PL/I compiler, which handles all of
the processes.) Table 46 and Table 47 on page 282 summarize the extensions of
incoming files and their resulting intermediate files and translation programs.
Table 46. Extensions of incoming files and resulting intermediate files and transaction
programs on CICS on Open Systems
File type
Extension of incoming
file
Extension of
intermediate file (after
translation)
Extension of resulting
transaction program in
working directory
Micro
Focus
Server
Express
COBOL
.ccp
.cbl
.gnt or .int
IBM
COBOL
.ccp
.cbl
.ibmcob
.ccs
.c
None
PL/I
.pli
None
.ibmpli
IBM C++
.ccs
.C
.ibmcpp
281
cicstcl
Table 46. Extensions of incoming files and resulting intermediate files and transaction
programs on CICS on Open Systems (continued)
C++
.ccs
.C
.cpp
Table 47. Extensions of incoming files and resulting intermediate files and transaction
programs on CICS for Windows
File type
Extension of incoming
file
Extension of
intermediate file (after
translation)
Extension of resulting
transaction program in
working directory
Micro
Focus Net
Express
COBOL
.ccp
.cbl
.cbmfnt
IBM
COBOL
.ccp
.cbl
.ibmcob
Microsoft C .ccs
.c
.dll
PL/I
.pli
None
.ibmpli
IBM C
.ccs
.c
.ibmc
Microsoft
C++
.ccs
.C
.cpp
IBM C++
.ccs
.C
.ibmcpp
Specifying the -x flag causes the cicstcl command to run an external command (for
example, an SQL translation step) before the cicstran translation. Specifying the -X
flag causes the cicstcl command to run an external command or, on the Windows
platform, the cicscobinsert utility (which compiles EBCDIC-enabled COBOL
programs that run on a Windows workstationsee Compiling EBCDIC-enabled
COBOL programs on page 57 and Using Micro Focus Net Express to compile
EBCDIC-enabled COBOL programs on page 227 for more information). The
pretranslation step specified by the -x flag must produce a file with the appropriate
.ccp or .ccs suffix. The posttranslation step specified by the -X flag must be able to
handle the .cbl, .c, or .C file produced by the translator.
Help information on the cicstcl command is written to stderr when you run cicstcl
with an invalid flag or -?. If you specify a valid flag that is not supported for the
language type, CICS writes a warning to the standard error stream and the option
is ignored.
Note: For important information about permissions, refer to Access permissions
for maps and transaction programs on page 37. The cicstcl command
accepts multiple source files for IBM VisualAge COBOL for NT.
Options
-a
-c number
(Not PL/I) specifies the number of lines to be included in each page of the
translator listing, including heading and blank lines, of the output files
created with the -v or -s flags. The number value must be an integer in the
range 7 through 255. If the number value is 7 or less, the heading and one
line of listing is included on each page. The default is 60.
282
cicstcl
Note: This option must be used with the -v or -s flags.
-d
Produces code that passes line numbers through CICS to be used by the
Execution Diagnostic Facility (EDF) and to be included in the Transaction
Dump information.
-e
file
-s
-X {ext cmd | cicscobinsert} (The cicscobinsert option is only for files on CICS for
Windows to be compiled with Micro Focus Net Express 3.0 or higher)
(Not PL/I) The -X ext cmd option executes the specified external command
for each translated file, filename.cbl, filename.c, or filename.C, after running
cicstran for the file. The -X cicscobinsert option executes the cicscobinsert
Appendix. CICS commands used in application programming
283
cicstcl
utility for each translated COBOL file, filename.cbl, after running cicstran
for the file. The -X ext cmd command is executed as ext cmd filename.cbl,
ext cmd filename.c, or ext cmd filename.C. The -X cicscobinsert command is
executed as cicscobinsert filename.cbl.
-x ext cmd
(Not PL/I) executes the specified external command for each file specified,
filename.ccp or filename.ccs , before running cicstran for that file. The
command is executed as ext cmd filename.ccp or ext cmd filename.ccs.
Restrictions
Standard operating system access permissions for files and directories apply.
The interaction between the command-level translator and the application
programmer is through a set of error codes and conditions output by the
translator.
All EXEC CICS API commands found to be in error by the translator are
highlighted on an error report. You can then amend these and resubmit your
source.
The EIBLABEL field, used only for COBOL programs, is used to contain values
relating to handled conditions or abends. The values are:
-1
EXEC CICS RETURN or EXEC CICS XCTL
0
normal sequential command processing
1
abend
2 to nn
a value identifying a label for a handled condition or abend
Returned Values
The translation step of cicstcl has the following exit values:
0
cicstcl has detected translator errors and has written messages to the
standard error stream.
Examples
v To compile, translate, and link-edit a C++ application complete with a source
listing:
cicstcl -l IBMCPP -s Applic2.ccs
284
Bibliography
v CICS Application Programming Reference,
SC09-4461
v CICS Intercommunication Guide, SC09-4462
v CICS Family: API Structure, SC33-1007
v CICS Family: Interproduct Communication,
SC33-0824
v Concepts and Planning, SC09-4582
v TXSeries Release Notes, GC09-4491
v CICS Family: Client/Server Programming,
SC33-1435
v CICS Administration Reference, SC09-4459
v CICS Administration Guide
v Planning and Installation Guide
v CICS Application Programming Guide, SC09-4460
v DB2: Administration Guide,
v CICS Problem Determination Guide, SC09-4465
v CICS Clients: Administration, SC33-1792
v IBM 3270 Information Display Programmers
Reference,
v CICS Administration Guide for Windows Systems,
SC09-4456
v SMARTdata UTILITIES for AIX
v CICS Messages and Codes, SC09-4589
v CICS Administration Reference
v CICS Administration Reference
v CICS Administration Guide for Open Systems,
SC09-4587
285
286
Notices
This information was developed for products and services offered in the U.S.A.
IBM may not offer the products, services, or features discussed in this document in
other countries. Consult your local IBM representative for information on the
products and services currently available in your area. Any reference to an IBM
product, program, or service is not intended to state or imply that only that IBM
product, program, or service may be used. Any functionally equivalent product,
program, or service that does not infringe any IBM intellectual property right may
be used instead. However, it is the users responsibility to evaluate and verify the
operation of any non-IBM product, program, or service.
IBM may have patents or pending patent applications covering subject matter
described in this document. The furnishing of this document does not give you
any license to these patents. You can send license inquiries, in writing, to:
IBM Director of Licensing
IBM Corporation
North Castle Drive
Armonk, NY 10504-1785
U.S.A.
For license inquiries regarding double-byte (DBCS) information, contact the IBM
Intellectual Property Department in your country or send inquiries, in writing, to:
IBM World Trade Asia Corporation Licensing
2-31 Roppongi 3-chome, Minato-ku
Tokyo 106, Japan
The following paragraph does not apply to the United Kingdom or any other
country where such provisions are inconsistent with local law:
INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THIS
DOCUMENT AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OR CONDITIONS OF NON-INFRINGEMENT,
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Some states
do not allow disclaimer of express or implied warranties in certain transactions,
therefore, this statement may not apply to you.
This information could include technical inaccuracies or typographical errors.
Changes are periodically made to the information herein; these changes will be
incorporated in new editions of the document. IBM may make improvements
and/or changes in the product(s) and/or the program(s) described in this
publication at any time without notice.
Any references in this information to non-IBM Web sites are provided for
convenience only and do not in any manner serve as an endorsement of those Web
sites. The materials at those Web sites are not part of the materials for this IBM
product and use of those Web sites is at your own risk.
IBM may use or distribute any of the information you supply in any way it
believes appropriate without incurring any obligation to you.
287
Licensees of this program who wish to have information about it for the purpose
of enabling: (i) the exchange of information between independently created
programs and other programs (including this one) and (ii) the mutual use of the
information which has been exchanged, should contact:
IBM Corporation
ATTN: Software Licensing
11 Stanwix Street
Pittsburgh, PA 15222
U.S.A.
Such information may be available, subject to appropriate terms and conditions,
including in some cases, payment of a fee.
The licensed program described in this document and all licensed material
available for it are provided by IBM under terms of the IBM International Program
License Agreement or any equivalent agreement between us.
Any performance data contained herein was determined in a controlled
environment. Therefore, the results obtained in other operating environments may
vary significantly. Some measurements may have been made on development-level
systems and there is no guarantee that these measurements will be the same on
generally available systems. Furthermore, some measurements may have been
estimated through extrapolation. Actual results may vary. Users of this document
should verify the applicable data for their specific environment.
Information concerning non-IBM products was obtained from the suppliers of
those products, their published announcements or other publicly available sources.
IBM has not tested those products and cannot confirm the accuracy of
performance, compatibility or any other claims related to non-IBM products.
Questions on the capabilities of non-IBM products should be addressed to the
suppliers of those products.
All statements regarding IBMs future direction or intent are subject to change or
withdrawal without notice, and represent goals and objectives only.
This information contains examples of data and reports used in daily business
operations. To illustrate them as completely as possible, the examples may include
the names of individuals, companies, brands, and products. All of these names are
fictitious and any similarity to the names and addresses used by an actual business
enterprise is entirely coincidental.
If you are viewing this information softcopy, the photographs and color
illustrations may not appear.
C-ISAM
CICS
CICS/400
CICS/6000
CICS/MVS
Database 2
288
CICS/ESA
CICS/VSE
DB2
DFS
Domino
Encina
IBM
IMS
Informix
Lotus
MQSeries
MVS
MVS/ESA
Notes
OS/2
RACF
SecureWay
SupportPac
System/390
TXSeries
VisualAge
VTAM
WebSphere
Other company, product, and service names may be trademarks or service marks
of others.
Notices
289
290
Index
Numerics
3270 Information Display System
attribute characters 78
conversion of datastreams 204
datastream migration 204
datastream, setting 3270 204
field concepts 77
field outlining 79, 205
field validation 205
input operations 76
programmed symbols 79
screen sizes 80
setting 3270 datastreams 204
untranslated 3270 datastreams 204
8775 Display Terminal
field validation attribute
character 78, 79
A
abend code 244, 245, 246
ABEND command 16, 56, 64, 66, 244,
246
abend exit
program level 244, 245
user exit 244, 245
abend handling 244
abnormal termination handling 246
abort, used in CICS programs 50
ADDRESS command 15, 29, 184, 186
AID (attention identifier) 90, 243
ALARM option 87
ALLOCATE command 15, 243
alternate (secondary) 106
alternate index structure 40
alternate key 106
Animator
application development tool 17
using 268, 269
ANSI mode, compiling it 219
application data area of screen 80
Application Debugger 258
application program
Animator 17
application migration 191
calling 18
cicstran 16
debugging 17
logical levels 174
transactions 18
translation 16
application server 9, 10, 53
ASIS option
Basic Mapping Support (BMS) 90
ASKTIME command 14
assert, used in CICS programs 50
ASSIGN command 15, 184, 186
asynchronous journal output 140
asynchronous operation 68
asynchronous page build 93
Copyright IBM Corp. 1999, 2004
asynchronous processing 5
attention identifier (AID)
3270 input operation 77
HANDLE AID command 91, 243
NOHANDLE option 243
RESP option 243
RESP2 option 243
attention key definition 52, 61
attribute characters 78, 83
attributes, use of
IndexName (FD) 106
ProgramCacheSize 44, 215
automatic transaction initiation
(ATI) 173
autoskip field 78
auxiliary temporary storage 27, 136
auxiliary trace 37, 248
B
base color 78
base key 106
Basic Mapping Support (BMS)
application development tool 16
assembling maps 73
attribute constants 83
CICS on Open Systems map
migration 203
CICS OS/2 map migration 203
cicsmap command 276
coordinating BMS and another screen
manager 88
cursor position 87
defining maps 73, 98
defining mapsets 98
device control options 87
exception conditions 90
field data format 82
field definition macro (DFHMDF) 98
GDDM coordination 88
how to copy symbolic maps 92
how to define maps 97
how to obtain printed output 93
how to use the BMS processor 75
input field suffix 82
invalid data 84
map definition macro (DFHMDI) 98
map set definition macro
(DFHMSD) 97
map set definition termination 99
map set suffixing 74
mapping considerations 202
mapping input data 89
mapping output data 84
migrating maps from CICS on Open
Systems 203
migrating maps from CICS OS/2 203
minimum function BMS 72
output field suffixes 82
overview 67, 71, 73
physical map 16, 74
C
C
abend handling in 144
BMS source files 16
cached programs, restriction 62
compiler considerations 198
compiling a program 219
length of CICS commands 37
link libraries 214
passing data to another program 175
recursive invocations 27
source directories 214
SQL, use of 14, 31
storage, accessing 183
translated code 217
translation of source 16
C programs, caches 44, 215
C++
BMS source files 16
compiler considerations 198
length of CICS commands 37
link libraries 214
passing data to another program 175
source directories 214
SQL, use of 31
storage, accessing 183
translating 198
translation of source 16
versions of 198
cached programs 62, 64, 215
CALL statement 53
CANCEL command 14
catch(...), used in CICS programs 51
CCFLAGS 62
CDCN 258
CEBR
use of 255
use with transient data 256
CECI transaction
security rules 257
291
CECS transaction
security rules 257
CEDF
application development tool 17
description of 258
reference 258
syntax 258
CEMT
DUMP command 253
use of 55
cerr, used in CICS programs 50
checkout, program 17
CheckpointInterval attribute, use of 34
CICS
names reserved for 49
CICS client
tracing 249
CICS internal functions, used in CICS
programs 50
CICS on Open Systems clients 9
CICS on Open Systems, defined 4
CICS OS/2
BMS map 202
map migration 203
CICS_XFH_DBNAME environment
variable, use of 160, 163
CICS_XFH_LOCAL_INDEXED
environment variable, use of 160, 163
CICS_XFH_LOCAL_LINE_SEQ
environment variable, use of 160, 163
CICS_XFH_LOCAL_RELATIVE
environment variable, use of 160, 163
CICS_XFH_LOCAL_SEQ environment
variable, use of 160, 163
CICS_XFH_LOGFILE environment
variable, use of 160, 163
CICS_XFH_TRANMODE environment
variable, use of 160, 163
CICS_XFH_USERNAME environment
variable, use of 160, 163
CICS_XFH_USERPASS environment
variable, use of 160, 163
CICS-private shared storage 184
CICS-safe functions 50
CICS-supplied transactions 253
summary of 18
cicsdb2conf command, use of 113
cicsddt command, use of 113
cicsmap command
description 276
flags 276
parameters 276
purpose 276
syntax 276
cicsmfmt 251
cicsmkcobol 199
cicsprCOBOL 199
cicstcl 213
cicstcl command
description 281
flags 281
parameters 281
program invocation environment 53
purpose 281
syntax 281
transaction execution 11
use of 215
292
COBOL (continued)
versions of 198
working storage 55
working storage loading 27
COBOL.
compiling with IBM COBOL 228
coded character set 116
coexistence
BTAM terminals 195
command-level applications 195
files, TDQs and TSQs 195
macro-level applications 195
VTAM terminals 195
Coexistence with other CICS family
members 194
COLLECT STATISTICS command 16,
252
color, extended 79
command
default options 52
lengths 37
summary 18
Command Level Interpreter (CECI)
security rules 257
commands
cicsdb2conf 113
cicsddt 113
cicsmkcobol 199
default options 64
COMMAREA 26, 29, 174, 183, 184
obtaining address 62
COMMIT WORK command, use of 144
common work area 28, 184
COMP-5 179
compilation
ANSI mode 219
compile a translated application 218
compile an application 214, 218
compiling a C application
program 219
compiling a Micro Focus Net Express
application program 226
compiling a Micro Focus Server
Express COBOL application
program 225
compiling a PL/I application
program 229
compiling an IBM COBOL application
program 229
EBCDIC-enabled programs 57, 227
link-edit a translated application 218
link-edit an application 214, 218
position independent 219
translate an application 214, 218
with IBM COBOL 228
compiler debugging tools 253
compiler options 281
CONNECT PROCESS command 15, 37
control and flow 14
conversational transaction 10, 21
CONVERSE command 13, 15, 68, 71
copying symbolic description maps 92
cout, used in CICS programs 50
CURSOR option 87
cursor position
Basic Mapping Support (BMS) 87
91
D
data
consistency 33
fields on screen 80
integrity 33
passing to another program 175
reading from a display 89
services 13
tables 183
data declaration
C 61
C++ 61
COBOL 52
PL/I 65
data sharing
within transaction 25
data-entry operations 96
databases
CLOSE DATABASE statement, and
use of 144
COMMIT WORK command, and use
of 144
DB2 142
improving performance of 45
Informix 142
Oracle 142
SQL 142
SQL COMMIT WORK command, and
use of 144
Sybase 142
SYNCPOINT commands, and use
of 144
databases and files
exclusive control 38
locking 38
DATAONLY option 85, 96
datastream 71, 94
basic mapping support 94
compressing 96
conversion of, 3270 204
field outlining 205
field validation 205
inbound 95
migration 204
migration requirements 204
untranslated, 3270 204
DB2
concurrency 102
example transaction for 145
file access 13
file types 106
keyed 13
locking 102
relative 13
sequential 13
table space 46
DB2 EXTFH 157
non-transactional access 160
transactional access 160
DCE
asynchronous cancellation, used in
CICS programs 50
DCE (continued)
programming considerations 49
threads, used in CICS programs 50
deadlock
avoiding 185
deadly embrace, avoiding 185
debugging
CEDF 17
EDF 258
overview 263
performance monitoring 16
remote transaction 258
tools 263
using Animator 268
using IBM VisualAge C++ (Windows
only) 264
using IBM VisualAge for
COBOL 265
using NT msdev 267
using NT windbg 267
Debugging with CDCN 258
default options, EXEC CICS 52, 64
deferred journal output 141
DELAY command 14, 59
FOR/UNTIL in C 59
DELETE command 121, 125, 129
DELETEQ TS command 133
DEQ command 14, 181
destinations
extrapartition 131
indirect 132
developing applications within CICS
overview 5
device control options, BMS 87
DFHAID 52, 91, 244
dfhaid.h 61
DFHBMSCA 52, 83
dfhbmsca.h 61
DFHCOMMAREA 54
DFHEIBLK 54
DFHMDF 97
DFHMDI 97
DFHMSD 97
DFHRESP 234
direct read 120, 121
display screens 29
display, reading from 89
distributed program link (DPL) 5
distributed transaction processing 5, 68
DL/I, reference to 18
dump
overview 250
DUMP command 16, 253
DUPKEY condition 123, 125
duplicate key 123
DUPREC condition
cause of 110, 118
in a KSDS 121
dynamic backout 34
dynamic loading 11
E
EBCDIC-enabled programs
ECI 7
programs 8
EDF 258
57, 227
Index
293
H
HANDLE ABEND command 16, 58,
234, 239, 246
CANCEL option 245
LABEL option 244
PROGRAM option 244
RESET option 245, 246
HANDLE AID command 13, 58, 91, 234,
237, 239, 243
HANDLE CONDITION command 16,
58, 141, 234, 236, 237, 238, 239, 241, 243
handling errors 233
highlighting 79
HOURS(hh) option 60
F
FD attributes, use of
IndexName 106
field concepts, 3270 77
field data format, BMS 82
field outlining 79, 205
field validation 205
field, blank 95
File Definitions (FD) attributes, use of
IndexName 106
file types 106
files
access from CICS application
programs 120
adding records 125
deleting records 125
external file handler 157
external files 131
recoverable 102
services 13
unlocking 125
updating from non-CICS
applications 157
user 30
fork, used in CICS programs 50
form feed control, BMS 94
formatted data 95
FORMATTIME command 14
FORMFEED option 87
FREE command 15
FREEKB option 87
FREEMAIN command 15, 183
abend codes 244
FRSET option 87, 95
FSET option 95
function shipping 5
294
J
journal 141
services 14
journal control
output synchronization 140
journaling 137, 253
CICS journaling 137
DTB 138
Dynamic Transaction Backout 138
recovery after a system abnormally
terminates 138
K
key-sequenced data set 107
KEYLENGTH option 107
remote file 127
keys
generic 121
keyword fields on screen 80
kill, used in CICS programs 50
KSDS 121
generic 107
key 107
RIDFLD 107
segmented 107
L
LENGERR condition 128, 234, 242
LENGTH option
default, COBOL 52
default, PL/I 64
Lengths for CICS commands 37
line width for printer 94
LINK command 14, 62, 175, 241
restrictions 144
link libraries 214
link to program anticipating return 175
link-edit an application 214, 218
linker options 281
LOAD command 15, 183, 184
lock modes 102
locking 33
explicit locking by application
program 41
implicit locking on nonrecoverable
files 38
implicit locking on recoverable
files 39
implicit locking on temporary storage
queues 41
implicit locking on transient data
destinations 40
in application programs 38
logging resource states 34
logical unit of work (LUW) 34
services 185
terminal services 67
LUW (logical unit of work) 185
M
macro instructions
field definition macro 99
field definition, DFHMDF 99
map definition, DFHMDI 98
map set definition, DFHMSD 98
main storage
buffer 248
trace 248
main temporary storage 27, 136
map definition macro, DFHMDI 98
MAPFAIL condition 90, 235
MAPONLY option 85, 96
mapping considerations 202
mapping input data 89
maps
BMS 95, 96
CICS on Open Systems map
migration 203
CICS OS/2 map migration 203
copying symbolic description 92
defining 73
migrating maps from CICS on Open
Systems 203
migrating maps from CICS OS/2 203
mapset 74, 75
MDT 95
message area of screen 81
MF COBOL EXTFH
DB2 159
Oracle 162
Micro Focus Net Express
compiling a program 226
compiling an EBCDIC-enabled
program 57, 227
Micro Focus Server Express COBOL
available memory 55
compiling a program 225
program invocation environment 53
migration
3270 Information Display System
datastream 204
API 201
application migration 191
CEMT 199
change control 191
CICS OS/2 203
CICS OS/2 map migration 203
migration (continued)
databases 199
macro-level applications 199
map migration 203
maps from CICS OS/2 203
migrating data 196
monitoring and statistics 199
planning and control 191
minimizing errors 253
minimum function BMS 72
MINUTES(mm) option 60
mixing languages 55, 62, 66
modified data tag (MDT) 77, 79, 95
MONITOR POINT command 251
monitoring
cicsmfmt 251
monitoring application
performance 251
record 251
MRO, defined 4
msdev 267
multiregion operation (MRO), defined 4
N
names reserved for CICS 49
NEWCOPY 215
NEWCOPY, use of 55
NOBUFSP condition 234
NOHANDLE option 58, 234, 236, 237,
243
NOJBUFSP condition 37, 141
non-migrated regions or
applications 194
non-transactional access, DB2
EXTFH 160
non-transactional access, Oracle
EXTFH 163
non-XA enabled databases
restrictions 144
nonconversational transaction 21
nondisplay fields 78
NOQUEUE option 37, 243
NORMAL condition 233, 234, 239
normal intensity field 78
NOSPACE condition 234
NOSTG condition 234
NOSUSPEND option 243
inhibit wait 37
NOTAUTH condition 234
NOTFND condition 121
null lines and 3270 printer 94
numeric-only field (3270 attribute
character) 78
O
ODBC API
using to write a CICS application
program 151
in C 151
in IBM VisualAge COBOL 153
Micro Focus NetExpress
COBOL 156
OFD, use of 101
OFF parameter 258
P
PA (program access) key 91
PA keys 71, 95
page width for printer 94
parallel running 196
passing control
anticipating return (LINK) 175
path 106, 122
PERFORM SNAP command 254
PERFORM SNAP DUMP command 253
PERFORM STATISTICS command 252
PERFORM STATISTICS RECORD
command 16
performance and recovery 36
PF (program function) key
BMS 91
PF keys 71, 95
phased cutover 193
non-migrated regions or
applications 194
terminal owning regions 193
PL/I
cached programs, restriction 64
compiler considerations 198
compiling a program 229
data declarations 65
length of CICS commands 37
passing data to another program 175
SQL, use of 14, 31
storage, accessing 183
translating 198
versions of 198
planning phase 192
POP HANDLE command 16, 58, 234,
237, 239, 243, 245
portability and recovery 36
POS operand
DFHMDF macro 99
preparing applications
cicstran command 278
preparing Applications
cicsmap command 276
overview 214
presentation services
overview 67
primary index 107
primary key 106
print monitor record 251
PRINT option 87
printers
3270 printer page width 93
3270 printers and blank lines 93
printing displayed data 93
Index
295
printers (continued)
starting a printer task 93
printing contents of screen 93
program access (PA) key 91
program compatibility
API 198
BMS 198
other considerations 198
source language and compilers 198
program design
conversational 21
nonconversational 21
pseudoconversational 21
program execution 174
linking to another program 175
passing data to another program 175
program function (PF) key
BMS 91
program reloads 55
program testing 17
EDF 258
program-level abend exit 244, 245
programmed symbols 79
programming considerations 49
migration 199
protected fields 78
pseudoconversational transaction 10, 21
PUSH HANDLE command 58, 234, 237,
239, 243, 245
Put command
Get command 256
Q
QBUSY condition 37, 234
queue 31, 135
intrapartition 131
temporary storage 14
transient data 14, 136
QZERO condition 133
R
raise, used in CICS programs 50
RBA 108
READ command 121, 124
READ MODIFIED command 95
reading data from a display 89
READNEXT command 108, 233
READPREV command 108
READQ TD command 133
NOSUSPEND option 37
READQ TS command 133, 243
RECEIVE command 13, 15, 68, 71, 237,
244
RECEIVE MAP command 13, 89, 234
FROM option 244
records 139
recovery 34
journaling 35
of resources 34
operations 35
performance 36
portability 36
region pool 184
relational database services 14
296
S
sample transaction 20
screen attribute definition 52, 61
screen layout design
application data area 80
data fields 80
input operations 77
keyword fields 80
message area 81
output operations 77
requirements 80
stopper fields 80
title area 80
screen size
alternate screen size 80
default screen size 80
screen, printing contents 93
secondary index 107
secondary key 106
SECONDS(ss) option 60
security rules
CECI 257
CECS 257
segmented key 107
SEND command 13, 15, 68, 71
SEND CONTROL command 13, 96
SEND MAP command 13, 84
SEND TEXT 13
SEND TEXT command 68
sequential browse 122
SESSBUSY condition 37
SET command 15, 187, 236
SET option 120
string handling 63
structure and function and recovery 32
structured file server 13
SUFFIX operand 74
supplied transactions 197
summary of 18
SUSPEND command 14
symbolic cursor positioning 87
symbolic description maps
copying 92
field data format 82
symbolic map data structures 81
synchronization 68, 181
journal output 140
SYNCPOINT command 15, 121, 144
SYNCPOINT ROLLBACK
command 102, 245
Syntax Checker (CECS)
security rules 257
SYSBUSY condition 234
sysid parameter 258
system trace 248
T
table space, DB2 46
tabs in map and program sources 49
task
automatic transaction initiation
(ATI) 173
definition of 4
initiation 173
interval control transaction
initiation 173
terminal task initiation (TTI) 173
triggered transaction initiation 173
task-private storage 183
task-shared storage
data tables 183
use of 183
TCTUA 184
TCTUALen option 29
techniques, programming 36
temporary storage 10, 14, 133
auxiliary 27, 136
dynamic definition 27
implicit locking upon 41
main 27, 136
names 135
uses of 134
TERMERR condition 246
terminal
input/output area 96
services 13
user area 29
terminal owning regions 193
terminal services
overview 67
terminal task initiation (TTI) 173
terminal user area 184
terminating reverse video 81
testing
Installation Verification Procedures
(IVPs) 195
minimizing errors 253
tests and parallel running 195
thread safety 50
time arguments in C 60
time fields in commands 59
time-related services 14
TIOA 26, 96
title area of screen 80
tools for testing 253
TRACE command 16
trace facility
overview 247
trace entry points 249
transaction
definition of 4
transaction deadlock
avoiding 129, 185
transaction identifier (CEDF) 17
transaction processing 4
transaction routing 5
transaction scheduler 9, 10
transaction type
conversational 21
nonconversational 21
pseudoconversational 21
transaction work area 26
TWASize option 26
transactional access, DB2 EXTFH 160
transactional access, Oracle EXTFH 163
transactions
CECI 257
CECS 257
CEDF 17, 258
pseudoconversational 21
transient data 14, 136
extrapartition 30, 131, 137
extrapartition destination 131
indirect destination 132
intrapartition 10, 30
intrapartition destination 130, 132
READQ TD command 132
trigger level 132
transient data queues 30
transient data, extrapartition 30
transient data, intrapartition
implicit locking upon 40
translate an application 214, 218
translation 16
translator
cicstran command 278
trigger level 133
triggered transaction initiation 132, 173
TTI, defined 173
TWA
TWASize option 26
V
variables in static storage 62, 64
variables in static storage, restriction 62,
64
vertical forms control 94
violation of storage 29
virtual storage environment 36
VSAM data set types 106
VSAM emulation 108, 113
W
wait conditions 37
WAIT CONVID command 15
WAIT option 140
WAIT TERMINAL 68
WAIT TERMINAL command 13
windbg 267
working storage 55
WRITE EXEC CICS JOURNAL
command 37
WRITE JOURNAL command 141
WRITEQ TD command 234
WRITEQ TS command 133, 234, 243
WRITEQ TS REWRITE command 133
X
XA-enabled databases
restrictions 145
XA-enabled relational database 145
XCTL command 14, 56, 64, 66, 241
restrictions 144
Z
zero length field 81
U
unformatted data 94
UNLOCK command 121, 125, 129
unprotected field, 3270 attribute
character 78
UPDATE option 121, 124
upgrade set 107
user exit
abend exit 244
monitoring 251
program level 244
user files 30
user storage 26
Index
297
298
Printed in USA
SC09-4460-03
TXSeries
Spine information:
Version 5.1
SC09-4460-03