ctdli() — Call to DL/I

Standards

Standards / Extensions C or C++ Dependencies
Language Environment both  

Format

C only:
#pragma runopts(env(IMS),plist(OS))
#include <ims.h>              /* or #include <cics.h> */

#define _CTDLI_PARMCOUNT 			 /* First arg is an explicit parameter count */
int ctdli(int parmcount, const char *function, ...);

or

#define _CTDLI_NOPARMCOUNT		 /*Parameter count is implicit in varargs */
int ctdli(const char *function,...);
C++:
#include <ims.h>						 	/* or #include <cics.h> */

int ctdli(int parmcount, const char *function, …);

or

#define _CTDLI_NOPARMCOUNT
int ctdli(const char *function, ...);

General description

Restriction: This function is not supported in AMODE 64.

Invokes DL/I facilities. The parmcount argument is optional. The parmcount value specifies the number of arguments in the variable argument list for the ctdli() call to function.

In C, when specifying a parmcount, use the _CTDLI_PARMCOUNT feature test macro. Otherwise, for C or C++, define _CTDLI_NOPARMCOUNT and make function the first argument. If the compile unit contains both types of call (sometimes passing parmcount and sometimes not), and if you want to avoid messages when compiling with the checkout option, define _CTDLI_NOPARMCOUNT and always cast the first argument to (const char *).

The function argument specifies the DL/I function you want to perform. Because the format of the ctdli() call depends on the function selected, all of the variations are not given here. For complete details on the available functions, refer to the COBOL publications.

To avoid infringing on the user's name space, this nonstandard function has two names. One name is prefixed with two underscore characters, and one name is not. The name without the prefix underscore characters is exposed only when you use LANGLVL(EXTENDED).

To use this function, you must either invoke the function using its external entry point name (that is, the name that begins with two underscore characters), or compile with LANGLVL(EXTENDED). When you use LANGLVL(EXTENDED) any relevant information in the header is also exposed.

To invoke ctdli() from an IMS™ transaction, you need either the #pragma runopts(env(ims),plist(os)), or you need to specify the compiler options TARGET(IMS) and PLIST(OS).

Returned value

The Program Control Block (PCB) status field (2 bytes) is stored as an unsigned int and used as the returned value for ctdli().

If the PCB status field contains blanks (hex '4040'), ctdli() returns 0.

Example

/* The following program demonstrates the use of the ctdli() function.
   It is a skeleton of a message processing program that calls ctdli()
   to retrieve messages and data.

   Do use the TARGET(IMS) and PLIST(IMS) compile options for C++
   applications.
 */
#ifndef __cplusplus
#pragma runopts(env(ims),plist(os))
#endif

#include <stdlib.h>
#include <ims.h>
#define n     20          /* I/O area size - Application dependent  */
typedef struct {PCB_STRUCT(10)} PCB_10_TYPE;

int main(void)
{
   /* Function codes for ctdli */
   static const char func_GU[4]   = "GU  ";
   static const char func_ISRT[4] = "ISRT";

   char ssa_name[] = "ORDER   (ORDERKEY   = 666666)";

   int rc;

   char msg_seg_io_area[n];
   char db_seg_io_area[n];
   char alt_msg_seg_out[n];

   PCB_STRUCT_8_TYPE *alt_pcb;
   PCB_10_TYPE *db_pcb;
   IO_PCB_TYPE *io_pcb;

   io_pcb = (IO_PCB_TYPE *)(__pcblist)[0];
   alt_pcb = __pcblist[1];
   db_pcb = (PCB_10_TYPE *) __pcblist[2];
⋮
   /* Get first message segment from message region */
   rc = ctdli(func_GU, io_pcb, msg_seg_io_area);
⋮
   /* Get the data from the database having the specified key value */
   rc = ctdli(func_GU, db_pcb, db_seg_io_area, ssa_name);
⋮
   /* Build output message in program's I/O area */
   rc = ctdli(func_ISRT, alt_pcb, alt_msg_seg_out);
⋮
}

Related information