ILE C/C++ Programmer's Guide

Called Procedures and Operational Descriptors

Operational descriptors provide descriptive information to the called procedure in cases where the called procedure cannot precisely anticipate the form of the argument, for example, different types of strings. The additional information allows the procedure to properly interpret the string. You should use operational descriptors only when they are expected by the called procedure, usually an ILE bindable API.

Example: Calling an ILE API from ILE C

The following figure shows the ILE C source code of func1() that contains the call to the ILE API. The API is used to determine the string type, length, and maximum length of the string arguments declared in func1(). The values for typeCharZ and typeCharV2 are found in the ILE API header file <leod.h>.

Figure 250. ILE C Source to Determine the String Arguments in a Function




#include <string.h>
#include <stdio.h>
#include <leawi.h>
#include <leod.h>
#include "oper_desc.h"
int func1(char a[5], char b[5], char *c)
{
int posn = 1;
int datatype;
int currlen;
int maxlen;
_FEEDBACK fc;
char *string1;
/* Call to ILE API CEEGSI to determine string type, length */
/* and the maximum length. */
CEEGSI(&posn, &datatype, &currlen, &maxlen, &fc);


switch(datatype)
{
case typeCharZ:
string1 = a;
break;
case typeCharV2:
string1 = a + 2;
break;
}
/* Use string1. */
if (!memcmp(string1, "stuv", currlen))
printf("First 4 characters are the same.\n");
else
printf("First 4 characters are not the same.\n");
}


[ Top of Page | Previous Page | Next Page | Table of Contents ]