Create List of Procedure Names

CrtProcList

The CrtProcList procedure creates a list of procedure names exported from a service program or module and stores those names in a user space.

The CrtProcList procedure can be used to enumerate the procedure names for any service program. The generated output is stored in the specified user space object. Only exported procedure names are included on the list.

module-count CrtProcList(
 szUserSpace    21A    Const 
 szObject       21A    Const  
 szAPIFmt        8A    Const OPTIONS(*NOPASS : *OMIT) 
 szRtnStruct    88A    OPTIONS(*NOPASS)
)

See also: CrtUsrSpace GetNextEntry

Parameters

szUserSpace
[input Char(21) const]  This parameter consists of two parts (1) in the first 10 positions, the name of the user space, and (2) in the second 10 positions, the name of the library in which the user space is located. For example:
 *...v....1....v....2
'MYSPACE   QTEMP     '
 

An alternative syntax is also supported for the user space parameter. The alternate syntax allows you to specify the user space name similar to that of an OS/400 CL command, that is it may be qualified using qualified name syntax, as follows:

 *...v....1....v....2
'QTEMP/MYSPACE       '
 

The qualified user space name is MYSPACE in the QTEMP library. Either syntax is acceptable.

 
The special value '*' (an asterisk) may be specified, which causes the  procedure to use the default user space (created in the QTEMP library). Any data currently stored in the default user space is replaced.
 
If the user space does not exist, the procedure creates it automatically.
 
szSrvPgm
[input Char(21) const]  The name of the service program whose procedures will be enumerated. This parameter may be a full name, generic* name, or *ALL. 
 
This parameter may be specified in two different formats: Object library format includes the object name in positions 1 to 10 and the library name in positions 11 to 20. Qualified format includes the object name with the library name qualified to it using the same syntax as a traditional OS/400 CL command parameter. Trailing blanks are ignored by both formats. The following illustrates these two formats:
 
Object Library Format:
 *...v....1....v....2
'MYFILE    QTEMP     '
 
Qualified Format:
 *...v....1....v....2.
'QTEMP/MYFILE         '
 
The library component may be any valid library name, it may be omitted, or it may be one of the following special values: 
Special Value Description
*LIBL The job's library list (both system and user portions). This is the default.
*ALL All libraries on the system
*ALLUSR All non-system libraries on the system
*USRLIBL The libraries on the user-portion of the job's library list
*CURLIB The job's current library.

szAPIFmt [optional] DFT(PGML0100)

[input Char(10) const]  The name of the API format to use to generate the module list. The format implies the type of object whose members are being listed. Based on the format specified, either *PGM or *SRVPGM objects modules will be listed. The valid format identifiers are those supported by the QBNLSPGM, but are restricted to the following:
 
Supported Formats
  • SPGL0600
  • SPGL0610
szRtnStruct [ reserved ]
[ input/output Struct(88) ]  This optional parameter is reserved.

Return Value

The number of procedure names enumerated is returned.

If the function fails, check the XT_ERROR data structure's subfield XT_ERRMSGID for the error message ID indicating why the user space was not created.

Remarks

If the user space specified on the szUserSpace parameter does not exist, it will be created by this procedure.

Note: The default user space name is the same for all CrtxxxList procedures. The default user space is provided to simplify creating a list of items and then retrieving that list. If you create a list of items and target the default user space, and then create another list and also target the default user space, the second list overwrites (replaces) the first list.

Example

To create a list of procedure names for the service program named XTOOLS stored in the QGPL library, the following example may be used:

      /INCLUDE qcpysrc,lists
.....CSRn01..............OpCode(ex)Extended-factor2+++++++++++++++++++++++++++
     C                   CallP     CrtProcList('*' : 'XTOOLS' : 'QGPL')