Input and output parameters

API parameters can be used for input or output. Some parameters, identified as input/output (I/O) parameters, contain both input and output fields.

Input parameters and fields are not changed by the API. They have the same values on the return from the API call as they do before the API call. In contrast, output parameters and fields are changed. Any information that an API caller (either an application program or an interactive entry on the display) places in an output parameter or output field before the call will be lost on the return from the call.

Parameters can be classified into the following general categories:

  • Input parameters: You must set input parameters before calling an API because these parameters 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 the object. Input parameters are not changed by the API.
  • Output parameters: You do not need to set output parameters before calling an API because the API returns information to the application in these parameters. When a return to the application is successful and no errors occur, the application accesses the information returned in output parameters.
  • I/O parameters: I/O parameters are identified as structures 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 parameter is an input field. The rest of the fields that comprise this parameter are output fields. The rules for input parameters and output parameters apply to the individual fields in the structure.