Some features of COBOL that are of interest to the CICS programmer
are:
- Simplified based addressing using cell pointer variables and the
ADDRESS special register.
- The ability to use COBOL CALL statements to call assembler language,
other COBOL programs, and PL/I or C/C++ programs.
- The LENGTH special register, which CICS uses to deduce the length
of data items.
- The ability to use the RETURN-CODE special register in a CICS
application program. This register allows you to set and access return
codes in COBOL programs.
With compiler option DATA(24), the WORKING-STORAGE SECTION is allocated
below the 16MB line. With
compiler option DATA(31), the WORKING-STORAGE SECTION is allocated
above the 16MB line.
This section describes COBOL language elements that you cannot
use under CICS, or whose use is restricted or can cause problems under
CICS.
By
default, the CICS® translator and the COBOL compiler do not detect
the use of COBOL words affected by the restrictions listed here. The
use of a restricted word in a CICS environment
may cause a failure at execution time. However, COBOL provides a
reserved-word table, IGYCCICS, for CICS application
programs. If you specify the compiler option WORD(CICS), the
compiler uses IGYCCICS, and COBOL words that are not supported under CICS are
flagged by the compiler with an error message. (The COBOL words normally
restricted by the default IBM-supplied reserved-word table are also
flagged.) See the Enterprise COBOL for z/OS®: Programming Guide for a current listing of the words which are
restricted by IGYCCICS.
The following restrictions apply to a COBOL program that is to
be used as a CICS application program. (See the appropriate COBOL
programming guide for more information about these functions.)
- If no IDENTIFICATION DIVISION is present, only the CICS commands
are expanded. If the IDENTIFICATION DIVISION only is present, only
DFHEIVAR, DFHEIBLK, and DFHCOMMAREA are produced.
- Statements that produce variable-length areas, such as OCCURS
DEPENDING ON, should be used with caution within the WORKING-STORAGE
SECTION.
- If
you are running CICS applications written in COBOL
under Language Environment® for the first time, you may need to review the Language Environment runtime
options in use at your installation. In particular, if your applications
are not coded to ensure that the WORKING-STORAGE SECTION is properly
initialized (for example, cleared with binary zeros before sending
maps), you should use the STORAGE runtime option. See z/OS Language Environment Customization for information about customizing Language Environment
runtime options.
- You cannot use entry points in COBOL in CICS.
- When a debugging line is to be used as a comment, it must not
contain any unmatched quotation marks.
- Do not use EXEC CICS commands in a Declaratives Section.
- You must use CICS commands for most input and output processing.
Therefore, do not describe files or code any OPEN, CLOSE, READ, START,
REWRITE, WRITE, or DELETE statements. Instead, use CICS commands to
retrieve, update, insert, and delete data.
- Do not use a format-1 ACCEPT statement in a CICS program. Format-2
ACCEPT statements are supported by Language Environment enabled
compilers.
- Do not use DISPLAY . . . UPON CONSOLE and DISPLAY . . . UPON
SYSPUNCH. DISPLAY to the system logical output device ( SYSOUT, SYSLIST,SYSLST)
is supported.
- Do not use STOP "literal".
- There are restrictions on the use of the SORT statement. See the Enterprise COBOL for z/OS: Programming Guide for
information. Do not use MERGE.
- Do not use:
- USE declaratives.
ENVIRONMENT DIVISION and FILE SECTION entries associated
with data management, because CICS handles data management. (These
can be used when they are associated with the limited SORT facility
referenced above.)
- User-specified parameters to the main program.
- Do not use the following compiler options:
- DYNAM (if program is to be translated)
- NOLIB (if program is to be translated)
- NORENT
You may use the DLL compiler option.
- The use of the TEST(SYM,NOSEPARATE) compiler option results in
a very large increase in program size. Therefore, short-of-storage
problems may occur when using this option. You can achieve the same
functionality with TEST(SYM,SEPARATE) without an increase in program
size. For more information about the TEST compiler option, see the Enterprise COBOL for z/OS: Programming Guide.
Use TRUNC(OPT)
for handling binary data items if they conform to the PICTURE definitions.
Otherwise use TRUNC(OPT) as the compiler option, and USAGE COMP-5
for items where the binary value might be larger than the PICTURE
clause would allow. TRUNC(BIN) inhibits runtime performance, so only
use this option if you have no control over binary data items (such
as those created by a code generator). (TRUNC(STD) is the default.) 
- For
VS COBOL II programs with Language Environment runtime, the following
limits apply to the length of WORKING-STORAGE:
- When the compiler option DATA(24) is used, the limit is the available
space below the 16MB line.
- When the compiler option DATA(31) is used, the limit is 128MB.
80 bytes are required for storage accounting and save areas,
and this must be included within the limits.
The use of
the RMODE(24) compiler option means that the program always resides
below the 16MB line, so this is not recommended. RMODE(ANY) or RMODE(AUTO)
should be used instead. For more information about the RMODE compiler
option, see the Enterprise COBOL for z/OS: Programming Guide.
- If the DLI option is specified and an ENTRY statement immediately
follows the PROCEDURE DIVISION header, you are recommended to change
the PROGRAM-ID name to the ENTRY statement literal, then delete the
ENTRY statement.
- The following compiler options have no effect in a CICS environment:
- ADV
AWO
EXPORTALL
- FASTSRT
NAME
OOCOBOL
- OUTDD
THREAD
- If you use HANDLE CONDITION or HANDLE AID, you can avoid addressing
problems by using SET(ADDRESS OF A-DATA) or SET(A-POINTER) where A-DATA
is a structure in the LINKAGE SECTION and A-POINTER is defined with
the USAGE IS POINTER clause.
- For
a COBOL program running above the 16MB line, these restrictions apply
for 31-bit addressing:
- If the receiving program is link-edited with AMODE(31), addresses
passed to it must be 31-bits long (or 24-bits long with the left-most
byte set to zeros).
- If the receiving program is link-edited with AMODE(24), addresses
passed to it must be 24-bits long.
Specify
the DATA(24) compiler option for programs running in 31-bit addressing
mode that are passing data arguments to programs in 24-bit addressing
mode. This ensures that the data will be addressable by the called
program.
The CBLPSHPOP runtime option controls whether Language Environment
automatically issues an EXEC CICS PUSH HANDLE command during initialization
and an EXEC CICS POP HANDLE command during termination whenever a
COBOL subroutine is called.
If your application makes many COBOL subroutine CALLs under CICS,
performance is better with CBLPSHPOP(OFF) than with CBLPSHPOP(ON).
You can set CBLPSHPOP on an individual transaction basis by using
CEEUOPT, as explained in Defining runtime options for Language Environment. However, because
condition handling has not been stacked, be aware that:
- If your called routine raises a condition that causes CICS to
attempt to pass control to a condition handler in the calling routine,
this is an error and your transaction will be abnormally terminated.
- If you use any of the PUSHable CICS commands, HANDLE ABEND, HANDLE
AID, HANDLE CONDITION, or IGNORE CONDITION, within the called routine,
you will be changing the settings of your caller and this could lead
to later errors.
If you have programs that use CALL DL/I, and you have not yet made
the following changes to them, you should now do so:
Figure 1 illustrates the whole of the above process.
The example in the figure assumes that you have three PCBs defined
in the PSB and want to use the second PCB in the database CALL. Therefore,
when setting up the ADDRESS special register of the LINKAGE SECTION
group item PCB, the program uses 2 to index the working-storage table,
PCB-ADDRESS-LIST. To use the nth PCB, you use the number n to index
PCB-ADDRESS-LIST.
Figure 1. Using the DL/I CALL interface
WORKING-STORAGE SECTION.
77 PCB-CALL PIC X(4) VALUE 'PCB '.
77 GET-HOLD-UNIQUE PIC X(4) VALUE 'GHU '.
77 PSB-NAME PIC X(8) VALUE 'CBLPSB'.
77 SSA1 PIC X(40) VALUE SPACES.
01 DLI-IO-AREA.
02 DLI-IO-AREA1 PIC X(99).
*
LINKAGE SECTION.
COPY DLIUIB.
01 OVERLAY-DLIUIB REDEFINES DLIUIB.
02 PCBADDR USAGE IS POINTER.
02 FILLER PIC XX.
01 PCB-ADDR-LIST.
02 PCB-ADDRESS-LIST USAGE IS POINTER
OCCURS 10 TIMES.
01 PCB.
02 PCB-DBD-NAME PIC X(8).
02 PCB-SEG-LEVEL PIC XX.
02 PCB-STATUS-CODE PIC XX.
*
PROCEDURE DIVISION.
*SCHEDULE THE PSB AND ADDRESS THE UIB
CALL 'CBLTDLI' USING PCB-CALL PSB-NAME ADDRESS OF DLIUIB.
*
*MOVE VALUE OF UIBPCBAL, ADDRESS OF PCB ADDRESS LIST (HELD IN UIB)
*(REDEFINED AS PCBADDR, A POINTER VARIABLE), TO
*ADDRESS SPECIAL REGISTER OF PCB-ADDR-LIST TO PCBADDR.
SET ADDRESS OF PCB-ADDR-LIST TO PCBADDR.
*MOVE VALUE OF SECOND ITEM IN PCB-ADDRESS-LIST TO ADDRESS SPECIAL
*REGISTER OF PCB, DEFINED IN LINKAGE SECTION.
SET ADDRESS OF PCB TO PCB-ADDRESS-LIST(2).
*PERFORM DATABASE CALLS ......
........
MOVE ........ TO SSA1.
CALL 'CBLTDLI' USING GET-HOLD-UNIQUE PCB DLI-IO-AREA SSA1.
*CHECK SUCCESS OF CALLS .......
IF UIBFCTR IS NOT EQUAL LOW-VALUES THEN
...... error diagnostic code
........
IF PCB-STATUS-CODE IS NOT EQUAL SPACES THEN
...... error diagnostic code
........
[[ Contents Previous Page | Next Page Index ]]