cedure passes parameters in the manner expected by the called API. The OPM or
ILE HLL programmer's guides contain more information on passing parameters to
different languages.
The ILE languages support the following parameter-passing styles:
ILE C passes and accepts parameters by value (directly and indirectly) and by
reference.
ILE COBOL and COBOL support the passing of parameters by value (indi-
rectly) and by reference.
ILE RPG and RPG support the passing of parameters by reference.
ILE CL and CL support the passing of parameters by reference.
Parameter Classification
Parameters can be classified into the following general categories:
Input parameters: These parameters must be set to a value before calling the
API because they pass needed information to the API to enable it to perform its
function. For example, if the API is to perform a function on an object, one of
the parameters would be the name and library of that object. Input parameters
are not changed by the API.
Output parameters: These parameters do not need to be set before calling the
API because the API returns information to the application in these parameters.
When a return to the application is successful and no errors have occurred, the
application then accesses the information returned in output parameters.
Input/Output parameters: These are parameters that are identified as struc-
tures that contain fields. The fields within the structure can be either input,
output, or both. For example, the bytes provided field in the error code param-
eter is an input field. The rest of the fields that make up this parameter are
output fields. The rules for input parameters and output parameters apply to
the individual fields in the structure.
Error Code Parameter
The error code parameter is a variable-length structure that is a parameter for most
APIs. (UNIX-type APIs and ILE CEE APIs do not use the error code structure.)
The error code parameter controls how errors are returned to the application. The
parameter must be initialized before the program calls the API. Depending on how
the error code structure is set, this parameter either returns information associated
with an error condition or causes errors to be returned as exception messages.
For some APIs, the error code parameter is optional. If you do not code the
optional error code parameter, the API returns diagnostic and escape messages. If
you code the optional error code parameter, the API can either signal exceptions or
return the exception information in the error code parameter.
The structure for the error code parameter is discussed in the topic “Format of an
Error Code Structure” on page 3-12. It contains information about the error code
fields. Although the information is about an RPG example, the information is true
for other APIs.
Note: The error code structure is provided in the QSYSINC library and is called
QUSEC. Refer to Figure 2-5 on page 2-28 for a list of include files that are
shipped in the QSYSINC library.
2-8 System API Programming V4R1