C and C++ programming restrictions and requirements
Some restrictions and requirements apply to a C or C++ program that is used as a CICS® application program.
Functions and commands that cannot be used
- HANDLE ABEND LABEL(label)
- HANDLE AID
- HANDLE CONDITION
- IGNORE CONDITION
- PUSH HANDLE
- POP HANDLE
CICS does not support the system() function, but two CICS commands, LINK and XCTL , provide equivalent function.
CICS does not support extended precision floating point.
C++ does not support packed decimal data. The application has access to packed decimal data using the character string data type. No C++ standard library functions are available to perform arithmetic on this data, but you can write your own. When using CICS commands that have options to specify time (for example, the DELAY or POST commands), it is advisable to use the HOURS, MINUTES, and SECONDS options. You can define times by using the TIME or INTERVAL options, which are packed decimal data types, if you provide functions to handle them in your application.
C and C++ do not support the use of CICS commands in macros.
Native C or C++ file operations operate only on files that are opened with type=memory specified. I/O to CICS-supported access methods must use the CICS API.
- CDUMP
- CSNAP
- CTEST
- CTRACE
- CLOCK (The clock() function returns a value (time_t) of -1.)
- CTDLI
- SVC99
- SYSTEM
- SETLOCALE
Coding requirements
- You can enter all CICS keywords in mixed case, except for CICS keywords on #pragma directives, which must be in upper case only.
- Where CICS expects a fixed-length character string such as a program name, map name, or queue name, you must pad the literal with blanks up to the required length if it is shorter than expected. For EXEC DLI commands, the SEGMENT name is padded by the translator if a literal is passed.
- Do not use field names that might be acceptable to the assembler, but that cause the C or C++ compiler to abend. These names include $, #, and @.
-
C++ uses '//' for single line comments. Do not put such a comment
in the middle of an EXEC
CICS
command. For example, the
following code is not valid:
The following code examples are valid:EXEC CICS SEND TEXT FROM(errmsg) LENGTH(msglen) // Send error message to screen RESP(rcode) RESP2(rcode2);
EXEC CICS SEND TEXT FROM(errmsg) LENGTH(msglen) RESP(rcode) RESP2(rcode2); //Send error message to screen
EXEC CICS SEND TEXT FROM(errmsg) LENGTH(msglen) /* Send error message to screen */ RESP(rcode) RESP2(rcode2);
Condition handling
In a C or C++ application, every EXEC CICS command is treated as if the NOHANDLE or RESP option is specified. Therefore, the set ofsystem actiontransaction abends that result from a condition occurring, but not being handled, is not possible. Control always flows to the next instruction, and the application is responsible for testing for a normal response.
COMMAREA
The address of the communication area is not passed as an argument to a C or C++ main function. This means that C and C++ functions must use ADDRESS COMMAREA to obtain the address of the communications area.EIB
The address of the EXEC interface block (EIB) is not passed as an argument to a C or C++ main function. This means that C and C++ functions must use ADDRESS EIB to obtain the address of the EIB. See Accessing the EIB from C and C++ for more information.LENGTH
If you do not specify the LENGTH option on commands that support LENGTH (for example, READ , READNEXT , READPREV , and WRITE commands), the translator does not supply a default value. In effect, NOLENGTH is implicit for C programs.OVERFLOW conditions
If you want any OVERFLOW condition to be indicated in the RESP field on return from a SEND MAP command with the ACCUM option, you should specify the NOFLUSH option.Addressing mode
All C and C++ language programs running under CICS must be link-edited with the attributes AMODE(31), RMODE(ANY). They can reside above the 16 MB line.- Pass parameters below 16 MB
- Re-link the CSP load library with AMODE(31)
64-bit addressing mode (AMODE(64)) is not supported for C and C++ language programs.
64-bit residency mode
CICS does not support 64-bit residency mode (RMODE(64)) and treats any RMODE(64) programs as RMODE(31). That is, RMODE(64) programs are loaded into 31-bit (above-the-line) storage, not 64-bit (above-the-bar) storage.
Return value
If you terminate a C or C++ program with an exit() function or the return statement instead of a CICS RETURN command, the value passed through the exit() function is saved in the EIBRESP2 field of the EIB on return from the program.Data declarations
- Execution interface block definitions (EIB). The EIB declarations are enclosed in #ifndef and #endif lines, and are included in all translated files. The C or C++ compiler ignores duplicated declarations. The inserted code contains definitions of all the fields in the EIB, coded in C and C++.
- BMS screen attributes definitions: C and C++ versions of the DFHBMSCA, DFHMSRCA, and DFHAID files are supplied by CICS, and can be included by the application programmer when using BMS.
- DL/I support: a C language version of DFHDIB is included by the DLI translator if the translator option has been specified. (You must include DLIUIB if the CALL DLI interface is used.)