IBM Version 4 Universal Remote User Manual


 
Your application is more straightforward if you are coding in a programming lan-
guage other than CL, which is not a fully defined language (it does not have
the full capabilities of a high-level language). For example, you may have to
code separate CL programs to perform specific functions.
You can access system information and functions that are not available through
CL commands.
Data is often easier to work with when returned to you by an API.
At times, you may need access to system functions at a lower level than what
was initially provided on the AS/400 system. APIs and a set of documented
machine interface (MI) instructions are available to allow the experienced pro-
grammer access to these system functions.
System APIs or CL Commands—When to Use Each
Before system APIs were offered on the AS/400, you had to either code separate
CL programs to perform the needed functions using the appropriate CL commands
or code a call to the Execute Command (QCMDEXC) API in your program. Both
methods made coding an application on the AS/400 more cumbersome (less
straightforward and not as fast as possible).
CL commands will always be needed; they are ideal for the interactive user and for
CL applications that are performing basic tasks. They provide a complete set of
functions on the AS/400 system.
APIs are not provided as a replacement for CL commands, although in many cases
there may be both an API and a CL command that perform the same function. If a
CL command and an API provide the same function, at times the API provides
more flexibility and information. The CL command is intended to be entered either
interactively or in a CL program, and the API is designed as a programming inter-
face.
Some APIs have no equivalent CL command. These APIs have been provided in
areas where customers and business partners have indicated that they need high-
level language (HLL) access.
Actions and System Functions of APIs
An API can be categorized by the type of action it performs and by the system
function that it relates to.
Following are some of the types of APIs that perform actions; several examples of
these APIs are discussed in more detail in later chapters of this book.
List APIs, which return lists of information about something on the system.
Refer to “List Object API—Examples” on page B-94 for an example of a list
API in both ILE COBOL and ILE RPG.
Retrieve APIs, which return information to the application program.
Create, change, and delete APIs, which work with objects of a specified type
on the system.
Other APIs, which perform a variety of actions on the system.
While many APIs are used alone, some can be used together to perform a task or
function. The following is a list of a few functions:
Chapter 1. Application Programming Interface—Overview 1-3