Thierry Seunevel Thierry 
Seunevel 
 Tech Corner      
  Home   Missions Tech corner Download Resume Contact
Home > Tech Corner > RunMnyCmd

Running AS/400 commands on many objects (3)

. Example
. List File
. Managing List
. RunMnyCmd
. Tool's Code
Managing Object Lists
The purpose of most of the commands composing the tools is to manage lists and objects in lists.
This page gives an enumeration of this commands, followed by a detailed description of each one.
The invite function (F4) can be used on each one.
Command Comment
CRTOBJPF Create a new object list file, and add to it references to all the object of a library.
ADDOBJPF Add the description of an object to an existing list.
DLTOBJPF Remove an object, defined by its name, library and type from a list.
PRTOBJPF Print the content of a list.

The CRTOBJPF command
This command allows a combination of the following actions :
. Creating a new object list file from scratch.
. Adding a new member to a new or existing object list file.
. Adding references to all the objects of a library to the object list file.
Parameter Type Text Comment
OBJPF *CHAR 10 File Name Name of the object list file to create or use
LIB *CHAR 10 Library Nmae Name of the library hosting the object list file.
MBR *CHAR 10 Member Name Name of an existing or a new member.
This parameter is optional.
Defaults to the file name at creation time, to the first member if the file already exists.
LIBS *CHAR 10 Source Library Name Optional parameter. If used, all the objects contained in that library will be added to the newly created or existing object list file.

The ADDOBJPF command
This command allows adding object definition to object list file, one at a time.

When first used in the active job, the parameter values given for the target object list file are recorded (in QTEMP library). They can be reused in the same job using a special value (*SAME) for the object list file name.

The use of this command can be made much easier defining a user option in PDM, as the one shown at the end of this page.

The command parameters are described below :
Parameter Type Text Comment
BIBLIO *NAME Library Name Mandatory parameter, defining the library hosting the object to add to the list.
Special values *LIBL and *CURLIB can be used for this parameter. If used, the object defined by the two following parameters is located, and the real library name is filled in the file
OBJET *NAME Object Name Name of the object to add to the target object list
TYPE *CHAR 8 Object Type Mandatory parameter, defining the object type, and expressed according to the AS/400 vocabulary (*FILE, *PGM ...).
DESC *CHAR 50 Description Optional parameter, that can be useful on printed list for example.
LIBPTF *NAME Library hosting the object list file Mandatory parameter, defining the library hosting the object list file target of the command.
3 special values can be used for this parameter: *LIBL and *CURLIB, as for most command, and *SAME. *SAME can be used for all but the first command issued in the same job. It asks to use the same target object list file than in the preceding command execution.
OBJPF *NAME Object List File Name Parameter defining the name of the target object list file name. This parameter is mandatory if the value *SAME has not been specified for the preceding parameter.
MBRPF *NAME Object list file member name If the target object list file has several data members, this parameter can be used to select what member will be the target of the command.
The special value *FIRST can be used, and is the default for this parameter.
ATTRB *CHAR 10 Attribute value This parameter allows to specify the attribute value of the object added to the object list file. Attributes are associated with certain type of object (PF-DTA or SRC-DTA for *FILE objects for example)
The attribute value is not controled. Its value can be used in the RunMnyCmd command to filter execution to object belonging to a specific attribute value. For instance, executing a CRTCLPPGM on all *PGM objects of a list could be restricted the CLP attribute objects.
FRMLIB *NAME From Library This optional parameter is not used in the standard commands. It is filled as is in the file, and can be used for specific needs.

The DLTOBJPF command
This command can be used to remove the record corresponding to an object defined by its library, name and type, from a object list file.
The record which key values match the parameters (if any) is deleted from the file. Of course the real object is left unchanged.
The parameters are as follow :
Parameter Type Text Comment
LIBPTF *NAME Library hosting the object list file Mandatory parameter, defining the library hosting the object list file target of the command.
3 special values can be used for this parameter: *LIBL and *CURLIB, as for most command, and *SAME. *SAME can be used for all but the first command issued in the same job. It asks to use the same target object list file than in the preceding command execution.
OBJPF *NAME Object List File Name Parameter defining the name of the target object list file name. This parameter is mandatory if the value *SAME has not been specified for the preceding parameter.
MBRPF *NAME Object list file member name If the target object list file has several data members, this parameter can be used to select what member will be the target of the command.
The special value *FIRST can be used, and is the default for this parameter.
LIBOB *NAME Library Name Mandatory parameter, defining the library hosting the object to delete from the list.
OBJET *NAME Object Name Name of the object to delete from the target object list
TYPE *CHAR 8 Object Type Mandatory parameter, defining the object type, and expressed according to the AS/400 vocabulary (*FILE, *PGM ...).

The PRTOBJPF command
This command allows printing a list of objects in an object list file.
It can be used to produce documentation, for example a distribution list.
Objects are printed ordered by library, name and type.
The content can be filtered, restricting the objects printed by type or attribute. The command parameters are described here :
Parameter Type Text Comment
LIB *NAME Library hosting the object list file Mandatory parameter, defining the library hosting the object list file target of the command.
FILE *CHAR 10 Object list file name Name of the file to print
MBR *CHAR 10 Member name If object list file has several data members, this parameter can be used to select the member that will be the target of the command.
The special value *FIRST can be used, and is the default for this parameter.
TYPE *CHAR 8 Object type Optional parameter that can be used to filter the printing.
Specifying a value in this parameter will limit the printing to the objects of that type.
ATTRB *CHAR 10 Object attribute Optional parameter that can be used to filter the printing, and select only object belonging to this attribute value.
COM1
COM2
COM3
*CHAR 50 Comments This 3 optional parameters if filled are printed in the report header as comments.

PDM user option for the ADDOBJPF command
Adding object one at a time to an object list can be a fastidious task, even with the use of the *SAME value to define the target object list file.

If you are using the Work with Object option of PDM (WRKOBJPDM command), it's easier to define a user option, with a one or two characters shortcut, and have the data associated with each object filled automatically in the parameters.
You just have to key the shortcut in front of the selected object(s) and hit Enter (For the first command, the target object list file has to be selected).

A user option named AO (like AddObject) can be defined (F16 command) like the following :
? ADDOBJPF LIBPTF(*SAME)
  ?*MBRPF(*FIRST)
  ?*BIBLIO(&L)
  ?*OBJET(&N)
  ?*TYPE(&T)
  ?*DESC(&X)
  ?*ATTRB('&A')
  ?*FRMLIB(&L)

The same principle can be used to create a shortcut to the DLTOBJPF command.

    Top  Top  Previous  List File | RunMnyCmd  Next


©  Thierry Seunevel (2004) www.seusoft.com