Create Object List

CrtObjList

The CrtObjList procedure creates a list of object names and attributes and stores that information in a user space object.

The CrtObjList procedure can be used to enumerate the object for any or all libraries. The generated output is stored in the specified user space object and contains the same format as that generated by the QUSLOBJ API.

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

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 will create it automatically.
 
szObject
[input Char(21) const]  The name of the program or service program name whose modules 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.

szObjType [ optional ] DFT(*ALL)

[input Char(10) const]  The OS/400 object type to use to generate the list of objects. Only objects of this type will be included on the list that is generated. The special value *ALL may be specified to indicate that objects of all types should be included.
 
szApiFmt [optional] DFT(OBJL0100)
[input Char(10) const]  The name of the API format to use to generate the module list. Any format may be specified that is supported QUSLOBJ API. Includes those formats that may become available in a future release. The current available formats include the following:
 
Formats
  • OBJL0100
  • OBJL0200
  • OBJL0300
  • OBJL0400
  • OBJL0500
  • OBJL0600
  • OBJL0700
szRtnStruct [ reserved ]
[ input/output Struct(88) ]  This optional parameter is reserved.

Return Value

The number of objects 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 users 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 users 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 object names (programs) and their attributes in the default user space, the following example may be used:

      /INCLUDE qcpysrc,lists
      /INCLUDE qsysinc/qrpglesrc,quslobj
.....CSRn01..............OpCode(ex)Extended-factor2+++++++++++++++++++++++++++
     C                   CallP     CrtObjList('*' : 'OE*':'*ALLUSR': '*PGM')

In this example, the objects that start with the letter OE in any user library, that are programs are added to the list generated in the default user space.