Retrieve CL Command Attributes with RTVCMDINF

Article ID: 56825

IBM has provided great CL commands to retrieve information about user profiles, objects, members, job information, system values, and more in commands like RTVUSRPRF, RTVOBJD, RTVMBRD, RTVJOBA, and RVSYSVAL.

But what about when you want to know about CL command attributes? There is no IBM-supplied command to retrieve command attributes into a program. For this issue, I have created the command RTVCMDINF(Retrieve Command Information) for those times when you need to gather information such as "What commands can be used by limited capability users by way of the ALWLMTUSR attribute?", or "What commands add a library to the job's library list through the PRODLIB attribute?"

Presented here is the Retrieve Command Information (RTVCMDINF) command, as well as a sample CL program demonstrating how to use the RTVCMDINF command in conjunction with the DSPOBJD (Display Object Description) command and its *OUTFILE option. The RTVCMDINF command has the following prompt display:


                   Retrieve Command Information (RTVCMDINF)            
                                                                       
Type choices, press Enter.                                             
                                                                       
Command  . . . . . . . . . . .                 Name                  
  Library  . . . . . . . . . .     *LIBL    Name, *LIBL, *CURLIB  
CL var for RTNLIB       (10) .              Character value      
CL var for PGM          (10) .              Character value       
CL var for PGMLIB       (10) .              Character value       
CL var for SRCFIL       (10) .              Character value       
CL var for SRCLIB       (10) .              Character value       
CL var for SRCMBR       (10) .              Character value       
CL var for VLDCKR       (10) .              Character value       
CL var for VLDCKRLIB    (10) .              Character value       
CL var for MODE        (100) .              Character value       
CL var for ALLOW       (150) .              Character value       
CL var for ALWLMTUSR     (1) .              Character value       
CL var for MAXPOS     (10 0) .              Character                
CL var for PMTFILE      (10) .              Character value       
CL var for PMTFILELIB   (10) .              Character value       
CL var for MSGF         (10) .              Character value  
CL var for MSGFLIB      (10) .              Character value  
CL var for HLPPNLGRP    (10) .              Character value  
CL var for HLPPNLGRPL   (10) .              Character value  
CL var for HLPID        (10) .              Character value  
CL var for HLPSCHIDX    (10) .              Character value  
CL var for HLPSCHIDXL   (10) .              Character value  
CL var for CURLIB       (10) .              Character value  
CL var for PRDLIB       (10) .              Character value  
CL var for PMTOVRPGM    (10) .              Character value  
CL var for PMTOVRPGML   (10) .              Character value  
CL var for TGTRLS        (6) .              Character value  
CL var for TEXT         (50) .              Character value  
CL var for CPPSTATE      (2) .              Character value  
CL var for VCPSTATE      (2) .              Character value  
CL var for POPSTATE      (2) .              Character value  
CL var for CCSID       (5 0) .              umber               
CL var for ENBGUI        (1) .              Character value      
CL var for THDSAFE       (1) .              Character value      
CL var for MLTTHDACN     (1) .              Character value      
CL var for PXYIND        (1) .              Character value      

The RTVCMDINF command is based on the equivalent QCDRCMDI API as of release V5R4, but can of course also be adapted to support previous releases by removing references to proxy command indicator (PXYIND parameter) from the RTVCMDINF and its command processing program. The QCDRCMDI API also offers information about a command’s REXX-related attributes, and while these attributes have not been included in the utility presented here, it would be quite easy to add that support to the RTVCMDINF command, given the need.

The CL sample program included with this article uses the DSPOBJD and RTVCMDINF commands together to examine all commands in library QSYS, and for each command found to be allowed for user profiles with limited capabilities, an informational message is sent to the caller of the sample CL program. You can of course change and adapt the sample program as dictated by your requirements. The following sources are involved in creating all objects needed for the RTVCMDINF command as well as the sample CL program:

CBX978      RPGLE       Retrieve Command Information       
CBX978H     PNLGRP      Retrieve Command Information - Help
CBX978X     CMD         Retrieve Command Information             
CBX978T     CLP         Retrieve Command Information – Sample Program

Simply follow the compilation instructions in the respective source headers, and also be sure to check out the help panel group for further information about the RTVCMDINF command.

You can download a zip file containing all the source code here.

ProVIP Sponsors

ProVIP Sponsors