The example APIs in this chapter represent two general functions of APIs—change
and retrieve. It is typical for an API that is not retrieving information not to return
any output to the caller other than the error code parameter. If an error did not
occur when using APIs, the requested function completed successfully.
The presentation of the ILE APIs in the
System API Reference
is similar to the
OPM APIs. For a general discussion of the API topics, see “Description of an API”
on page 3-2.
Registration Facility Using ILE APIs—Concepts
The following examples illustrate the use of OS/400 ILE APIs. The examples use
the registration facility APIs. The registration facility APIs provide a means for
storing and retrieving information about exit points and exit programs. An exit
point is a specific point in a system function or program where control may be
passed to one or more exit programs. An exit program is a program to which
control is passed from an exit point. The examples show how to manipulate exit
points and exit programs, how to retrieve information about exit points and exit pro-
grams that are stored with the registration facility, and how to call an exit program.
Several of the registration facility APIs manipulate the information that the registra-
tion facility repository contains. One API is provided for retrieving information from
the repository.
The example programs are provided at the end of this chapter in their entirety (see
“Registration Facility Using ILE APIs—Examples” on page 4-9). The example
makes use of a continuation handle. Following are portions of the code to help
illustrate concepts pertaining to the use of OS/400 ILE APIs. The following con-
cepts include:
Various types of header files
The use of keyed interfaces
Error handling and the error code parameter
The use of receiver variables for returned information
Generic Header Files
This topic shows how to use a generic header file from the QSYSINC (system
include) library in a program. For information about the QSYSINC header files, see
“APIs and the QSYSINC Library” on page 2-28.
In addition to the traditional C-library header files (such as stdio and string), the API
header file qusrgfa1.h is included in the following example. The qusrgfa1.h header
file defines the functions exported from service program QUSRGFA1. This service
program contains the APIs provided for manipulating the information in the reposi-
tory. A second service program named QUSRGFA2 contains the ILE API for
retrieving information from the registration facility repository. The header file
qusec.h contains the definition for the error code structure that is used for the error
code parameter. The following list shows the standard C header files (the first four
includes) and a few AS/400-defined header files for APIs. This list does not show
all the header files used in the example programs starting on page 4-9.
4-2 System API Programming V4R1