eimErr2String
Purpose
Converts the EIM return code structure that an EIM function returns into a NULL-terminated character string that describes the error.
Format
#include <eim.h>
char * eimErr2String(EimRC * eimrc)Parameters
- eimrc
- (Input) The structure in which to return error code information. For the format of the structure, see EimRC -- EIM return code parameter for C/C++.
Authorization
- z/OS authorization
- None.
Return Values
The following table lists the return values from the API. Following
each return value is the list of possible values for the
messageCatalogMessageID field
in the eimrc parameter for that value.
| Return Value | Meaning |
|---|---|
| address of error string | Request was successful. (The caller is expected to free the error string.) |
| NULL | Request was unsuccessful. The eimErr2String
sets global errno. The errno can be set by catopen, catgets, catclose,
or one of the following values:
|
Example
The following example converts an EIM RC into an error message
and prints it.
#include <eim.h>
#include <stdio.h>
...
char eimerr[150];
EimRC * err;
char * message;
...
/* Set up error structure. */
memset(eimerr,0x00,150);
err = (EimRC *)eimerr;
err->memoryProvidedByCaller = 150;
/* Call an EIM API that returns an EimRC...*/
/* Convert the error structure to a message */
if (NULL == (message = eimErr2String(err)))
printf("eimErr2String error = %s",strerror(errno));
else
{
printf("EIM API Error Message: %s",message);
free(message);
}
...