Application programming for C language

Application programs in C use the following format, parameters, and DL/I calls to communicate with the IMS Transaction Manager.

Format

Read syntax diagramSkip visual syntax diagramrc=CTDLI(parmcount, function, i/o_pcbAB, alt_pcbAC);rc=AIBTDLI( parmcount, function, aibABC);D
A
Read syntax diagramSkip visual syntax diagram, i/o_area, mod_name, token, options_list,feedback_area
B
Read syntax diagramSkip visual syntax diagram, i/o_area_length, i/o_area, area_length, area
C
Read syntax diagramSkip visual syntax diagram, destination_name, options_list, feedback_area
D
Read syntax diagramSkip visual syntax diagramCEETDLI(parmcount, function, i/o_pcbAB, alt_pcbAC, aibABC);
Notes:

Parameters

rr
Receives the DL/I status or return code. It is a 2-character field shifted into the 2 lower bytes of an integer variable (int). If the status or return code is two blanks, 0 is placed in the field. You can test the rc parameter with an if statement; for example, if (rc == 'IX'). You can also use rc in a switch statement. You can choose to ignore the value placed in rc and use the status code returned in the program communication block (PCB) instead.
parmcount
Specifies the name of a fixed-binary (31) variable in user-defined storage that is a pointer to the number of parameters in the parameter list that follows parmcount. The parmcount field is a pointer to long.
function
Specifies the name of a character (4) variable, left-justified, in user-defined storage, which contains the call function to be used. The call function must be padded with blanks. For example, (GUbb) is a call function.
i/o pcb
Specifies the address of the I/O PCB. The I/O PCB address is the first address passed on entry to the application program in the PCB list, given the following circumstances:
  • A program executing in DLI or database management batch (DBB) regions where CMPAT=YES is coded on the PSB.
  • Any program executing in batch message processing program (BMP), message processing program (MPP), or IMS Fast Path (IFP) regions regardless of the CMPAT= value.
alternate pcb
Specifies the name of a pointer variable that contains the address of the I/O PCB or alternate PCB to be used for the call. The PCB address must be one of the PCB addresses passed on entry to the application program in the PCB list.
aib
Specifies the name of the pointer variable that contains the address of the structure that defines the application interface block (AIB) in user-defined storage.
i/o area
Specifies the name of a pointer variable to a major structure, array, or character string that defines the I/O area in user-defined storage to be used for the call. The I/O area must be large enough to contain the returned data.
i/o area length
Specifies the name of a fixed-binary (31) variable in user-defined storage that contains the I/O area length.
area length
Specifies the name of a fixed-binary (31) variable in user-defined storage that contains the length of the area immediately following it in the parameter list. Up to seven area length/area pairs can be specified.
area
Specifies the name of the pointer variable that contains the address of the structure that defines the user-defined storage to be checkpointed. Up to seven area length/area pairs can be specified.
token
Specifies the name of a character (4) variable in user-defined storage that contains a user token.
options list
Specifies the name of the pointer variable that contains the address of the structure that defines the user-defined storage that contains processing options used with the call.
feedback area
Specifies the name of the pointer variable that contains the address of the structure that defines the user-defined storage that receives information about options list processing errors.
mod name
Specifies the name of a character (8) variable in user-defined storage that contains the user-defined MOD name used with the call. The mod name parameter is used only with MFS.
destination name
Specifies the name of a character (8) variable in user-defined storage that contains the name of the logical or terminal transaction code to which messages resulting from the call are sent.

I/O area

In C language, the I/O area can be of any type, including structure or array. The ceetdli declarations in leawi.h and the ctdli declarations in ims.h do not have any prototype information, so no type checking of the parameters is done. The I/O area can be auto, static, or allocated (with malloc or calloc). Give special consideration to C-strings because DL/I does not recognize the C convention of terminating strings with nulls ('\0'). Instead of using the strcpy and strcmp functions, you might want to use the memcpy and memcmp functions.

Example DL/I call formats

DL/I CEEDTLI interface:
#include <leawi.h>
ceetdli(function,aib,i/o_area)
DL/I AIBTDLI interface:
int rc;
⋮
rc = aibtdli(parmcount,function,aib,i/o_area)
DL/I language-specific interface:
#include <ims.h>
int rc;
⋮
rc = ctdli(function,i/o_pcb,i/o_area)