Start of change

PROGRAM_RESOLVED_IMPORTS table function

The PROGRAM_RESOLVED_IMPORTS table function returns the imports for an ILE program or service program that are resolved by exports from one or more service programs.

For each resolved import, the name of the symbol and the service program from which it is exported is returned. If the bound service program is qualified with *LIBL, the library list of the thread that invokes the function is used to find the service program.

No other system interface returns this information.

Authorization: The caller must have:
  • *EXECUTE authority to the library containing the program or service program
  • *READ authority to the program or service program
For each service program that exports a symbol:
  • *EXECUTE authority to the library containing the service program
  • *READ authority to the service program
Read syntax diagramSkip visual syntax diagram PROGRAM_RESOLVED_IMPORTS ( PROGRAM_LIBRARY =>  program-library ,PROGRAM_NAME =>  program-name ,OBJECT_TYPE =>  object-type ,IGNORE_ERRORS => ignore-errors )
The schema is QSYS2.
program-library
A character or graphic string expression that specifies the name of the library that contains program-name.
program-name
A character or graphic string expression that specifies the name of the program or service program to return resolved imports for.
object-type
A character or graphic string expression that specifies the type of object for program-name.
*PGM
The object is a program.
*SRVPGM
The object is a service program.
ignore-errors
A character or graphic string expression that identifies what to do when an error is encountered.
NO
An error is returned.
YES
A warning is returned.
No rows are returned when an error is encountered. This is the default.

The result of the function is a table containing one or more rows with the format shown in the following table.

Table 1. PROGRAM_RESOLVED_IMPORTS table function
Column Name Data Type Description
BOUND_SERVICE_PROGRAM_LIBRARY VARCHAR(10) The library that contains BOUND_SERVICE_PROGRAM. This can be the special value *LIBL.
BOUND_SERVICE_PROGRAM VARCHAR(10) Service program that exports RESOLVED_SYMBOL_NAME.
RESOLVED_SERVICE_PROGRAM_LIBRARY VARCHAR(10)
Nullable
If BOUND_SERVICE_PROGRAM_LIBRARY is *LIBL, the library list was used to find the service program. The *SRVPGM is found based on the current library list when this function is invoked, which could be a different object than the one found when program-name was created or when the program is called. Otherwise, this value is the same as BOUND_SERVICE_PROGRAM_LIBRARY.

Contains the null value if BOUND_SERVICE_PROGRAM is not found when searching the library list.

RESOLVED_SYMBOL_NAME VARGRAPHIC(8192) CCSID(1200)
Nullable
The name of the resolved symbol.
Contains the null value if the symbol is not available. Reasons include:
  • The service program was not found.
  • The user is not authorized to the service program.
  • The service program does not export a symbol in the expected position.
  • The public interface (signature) of the service program has changed.
RESOLVED_SYMBOL_USAGE VARCHAR(8)
Nullable
The type for RESOLVED_SYMBOL_NAME.
*DTAEXP
A data item export.
*PROCEXP
A procedure export.

Contains the null value if RESOLVED_SYMBOL_NAME is null.

Note

This table function returns information for program and service program objects that were created on IBM i 6.1 or later. The RELEASE_CREATED_ON column of the QSYS2.PROGRAM_INFO view can be examined to determine if PROGRAM_RESOLVED_IMPORTS can be used for a program or service program.

Examples

Show the imports that are resolved via service programs for program QGPL/MATH.

SELECT * 
  FROM TABLE(QSYS2.PROGRAM_RESOLVED_IMPORTS( 
                         PROGRAM_LIBRARY => 'QGPL',
                         PROGRAM_NAME    => 'MATH',
                         OBJECT_TYPE     => '*PGM'));

Show which programs and service programs in library QGPL use procedure Negate from service program QGPL/UNARY.

SELECT B.PROGRAM_LIBRARY, B.PROGRAM_NAME, B.OBJECT_TYPE
   FROM QSYS2.BOUND_SRVPGM_INFO B, 
        TABLE(QSYS2.PROGRAM_RESOLVED_IMPORTS ( 
                         PROGRAM_LIBRARY => B.PROGRAM_LIBRARY,
                         PROGRAM_NAME    => B.PROGRAM_NAME,
                         OBJECT_TYPE     => B.OBJECT_TYPE)) R
   WHERE B.PROGRAM_LIBRARY = 'QGPL' AND
         B.BOUND_SERVICE_PROGRAM = 'UNARY' AND
         (B.BOUND_SERVICE_PROGRAM_LIBRARY = 'QGPL' OR
          (B.BOUND_SERVICE_PROGRAM_LIBRARY = '*LIBL' AND
           R.RESOLVED_SERVICE_PROGRAM_LIBRARY = 'QGPL')) AND
         R.RESOLVED_SYMBOL_NAME = 'Negate' AND
         R.RESOLVED_SYMBOL_USAGE = '*PROCEXP'
   ORDER BY 1, 2;
End of change