Examples: Program-based APIs

These examples demonstrate the use of program-based APIs in several different high-level language programs.

The examples focus on descriptions, formats, variable-length fields as output, and optional parameters. They access information from a job description to demonstrate how to code APIs. While this might not be what your application requires, you can use the same approach to access information when you use most of the APIs.

Assume that you are interested in accessing the value of the HOLD parameter on the Create Job Description (CRTJOBD) or Change Job Description (CHGJOBD) command. The HOLD parameter determines whether the job is held on the job queue. The following values are supported:

*NO: The job is not held.

*YES: The job is held on the job queue.

The first step is to find the correct API to use. To do this, you must identify the part of the IBM i licensed program that is most closely related to the function in which you are interested. If you want to access information from a job description, as in these examples, you need to know that a job description object is considered part of the work management function. API names contain verbs that are similar to the IBM i licensed program: change, create, remove, and retrieve. These examples use the Retrieve Job Description Information (QWDRJOBD) API.

For a detailed description of how to use the API, see API information format. These descriptions and the programs that support them are in RPG. You can, however, view the same programs in different languages.