Language selection considerations

You can directly use APIs, other than service-program-based APIs, with all the languages that are available with the IBM® i operating system.

ILE APIs that are implemented as service programs (*SRVPGM) can be directly accessed only by ILE languages. For non-ILE languages, the Call Service Program Procedure (QZRUCLSP) API is available to indirectly access service-program-based APIs. In some cases, an ILE API also provides a program (*PGM) interface so that non-ILE languages can access the function.

Some APIs also require that particular data types and particular parameter passing conventions be used. The following table shows the languages that are available with the IBM i operating system and the data types that they provide.

Table 1. Language selection considerations–data types
Language Pointers Binary 2 Binary 4 Character Zoned decimal Packed decimal Floating point Structures Single array Exception handling
BASIC (PRPQ 5799-FPK) X X X X 1 X 1 X X X
ILE C X X X X X 6 X X X X
VisualAge® C++ for IBM i X X X X X 7 X X X X
CL X X X X X X X 2 X
ILE CL X X X X X X X 2 X
COBOL X X X X X X X X X 3
ILE COBOL X X X X X X X X X X 3
MI X X X X X X X X X X
Pascal (PRPQ 5799-FRJ) X X X X X 4 X 4 X X X X
PL/I (PRPQ 5799-FPJ) X X X X X X X X X X
REXX X X 2 X 2 X
RPG X X X X X X X X 5
ILE RPG X X X X X X X X X X 5
Notes:
  1. Refer to the CNVRT$ intrinsic function.
  2. There is no direct support, but you can use the substring capability to simulate structures and arrays.
  3. COBOL and ILE COBOL programs cannot monitor for specific messages, but these programs can define an error handler to run when a program ends because of an error.
  4. There is no direct support, but you can use extended program model (EPM) conversion routines to convert to and from zoned and packed decimal.
  5. RPG programs cannot monitor for specific messages, but these programs can define an error handler to run when a program ends because of an error.
  6. Packed decimal is implemented in ILE C with the decimal() data type.
  7. Packed decimal is implemented in VisualAge C++ for IBM i with the Binary Coded Decimal (BCD) class. The BCD class is the C++ implementation of the C-language's decimal(). The BCD object can be used in API calls because it is binary compatible with the decimal() data type.

The following table shows the languages that are available with the IBM i operating system and the parameter support that they provide. See the reference information for the specific programming language that you plan to use.

Table 2. Language selection considerations–call conventions
Language Function return values 1 Pass by reference Pass by value
BASIC X
ILE C X X X
VisualAge C++ for IBM i X X X
CL X
ILE CL X2 X X2
COBOL X 3
ILE COBOL X X X
MI X X
Pascal X
PL/I X
REXX X
RPG X
ILE RPG X X X
Notes:
  1. Return values are used by the UNIX-type APIs and the Dynamic Screen Manager (DSM) APIs.
  2. This support is available only when using the Call Bound Procedure (CALLPRC) command.
  3. COBOL provides a by-content phrase, but it does not have the same semantics as ILE C pass-by-value.