mgo
OS/400 Edition
Volume 3, Number 3 -- January 17, 2003

Which Commands Can Build Outfiles?


Hey, Ted:

You always do such a great job on Midrange Guru that I hate to even mention this comment, but your tip on using the Display Object Description (DSPOBJD) command for user profiles was a bow-wow.

The Display User Profile (DSPUSRPRF) command has *OUTFILE capability with *ALL and you can get all sorts of different profile info, including group profiles, special authorities, etc.

But don't sweat it. I'd rather have you doing this letter with the bow-wows than not have you doing it.

-- John


Thanks for your comments, John. Several other readers felt the same way.

If you are looking for information specific to user profiles, the DSPUSRPRF command does the trick much better.
-- (another) John
In your "Odds and Ends" column in the November 8, 2002 issue of Midrange Guru, a reader asked for a method of placing user profile names into a file. While DSPOBJD may accommodate this person's specific needs, I find that DSPUSRPRF to a *OUTFILE allows for a greater level of analysis of my user community. For instance, you could then run a query over the file to determine who hasn't signed on in over 90 days or who's profile is disabled.
-- Mike
While your solution will give them a list of user-profile names, using the DSPUSRPRF command to display users profile to an outfile seems a better way to do this, since other information about the user profiles will be available.
-- Bill
While there is nothing wrong with this solution, another option is to use the DSPUSRPRF command. The DSPUSRPRF command creates an output file that provides the user profile names and additional information related to the user profile.
-- Roy
The outfile of the Work with User Profiles (WRKUSRPRF) command is available on the DSPUSRPRF command.
-- Russ


Well, that's enough. I agree with all of you that DSPUSRPRF also provides a list of user profiles. Furthermore, I agree that DSPUSRPRF provides more information about user profiles than DSPOBJD does. Let's go back to the original question.

"Work with User Profiles (WRKUSRPRF) command will not load a list of user profile names into a database file. Is there some other way to do this?"

I gave the first solution that came to mind, to use DSPOBJD. It solved the questioner's problem. Had I thought of DSPUSRPRF, the question would probably never have been included in the "Odds and Ends" column, and we would have all been the poorer for it, as I will show you.

Suppose the questioner had asked for an outfile of data area names. The Display Data Area (DSPDTAARA) command does not display a list of data areas. The Work with Data Areas command lists data areas to the display, but not to an outfile.

However, DSPOBJD can produce a list of any type of object to an outfile, and that is why I included that question in Midrange Guru. As I said in that article, "I think a lot of us forget this command exists, since so many object-specific commands have *OUTFILE capabilities."

Anyway, these readers piqued my curiosity, so I wrote a CL program to try to find out which DSPxxx and WRKxxx commands can write to an outfile and which ones can't. My program builds a work file, each record of which contains a command name and a value of Y or N. I used SQL to extract the following lists of commands.

Unless there's a bug in my program, here are the V5R1 commands that can write to an outfile:

DSPAPPNINF Display APPN Information
DSPAUTHLR Display Authority Holder
DSPAUTL Display Authorization List
DSPAUTLOBJ Display Authorization List Objects
DSPBNDDIR Display Binding Directory
DSPDBR Display Database Relations
DSPDIRE Display Directory Entries
DSPDLOAUD Display Document Library Object Auditing Level
DSPDSTL Display Distribution List
DSPFD Display File Description
DSPFFD Display File Field Description
DSPFLR Display Folder
DSPHDWRSC Display Hardware Resources
DSPJOBLOG Display Job Log
DSPJRN Display Journal
DSPMOD Display Module
DSPNCK Display Nickname
DSPOBJAUT Display Object Authority
DSPOBJD Display Object Description
DSPOPT Display Optical
DSPPGMADP Display Programs that Adopt
DSPPGMREF Display Program References
DSPRDBDIRE Display Relational Database Directory Entry
DSPRMTDFN Display Remote Definition
DSPSFWRSC Display Software Resources
DSPTAP Display Tape
DSPTAPCGY Display Tape Category
DSPTAPCTG Display Tape Cartridge
DSPTAPSTS Display Tape Status
DSPUSRPRF Display User Profile
WRKNETF Work with Network Files

These are the commands that do not support the OUTPUT(*OUTFILE) option:

DSPACC Display Access Code
DSPACCAUT Display Access Code Authority
DSPACTPJ Display Active Prestart Jobs
DSPAUT Display Authority
DSPAUTLDLO Display Authorization List Document Library Objects
DSPAUTUSR Display Authorized Users
DSPBCKSTS Display Backup Status
DSPBCKUP Display Backup Options
DSPBCKUPL Display Backup List
DSPBKP Display Breakpoints
DSPCCTRTE Display Circuit Route
DSPCCTSRV Display Circuit Service
DSPCDEFNT Display Coded Font
DSPCFGL Display Configuration List
DSPCLS Display Class
DSPCMD Display Command
DSPCNNL Display Connection List
DSPCNNSTS Display Connection Status
DSPCOSD Display Class-of-Service Description
DSPCPCST Display Check Pending Constraint
DSPCSI Display Communications Side Information
DSPCTLD Display Controller Description
DSPCURDIR Display Current Directory
DSPDBG Display Debug
DSPDBGWCH Display Debug Watches
DSPDDMF Display Distributed Data Management File
DSPDEVD Display Device Description
DSPDKT Display Diskette
DSPDLFA Display DataLink File Attributes
DSPDLOAUT Display Document Library Object Authority
DSPDLONAM Display Document Library Object Name
DSPDOC Display Document
DSPDSTSRV Display Distribution Services
DSPDTA Display Data
DSPDTAARA Display Data Area
DSPDTADCT Display Data Dictionary
DSPEDTD Display Edit Description
DSPEWCBCDE Display Extended Wireless Controller Bar Code Entry
DSPEWCM Display Extended Wireless Controller Member
DSPEWCPTCE Display Extended Wireless Controller Portable Transaction Computer Entry
DSPEWLM Display Extended Wireless Line Member
DSPF Display File Description
DSPFNTRSCA Display Font Resource Attributes
DSPFNTTBL Display Font Table
DSPHFS Display Hierarchical File Systems
DSPHLPDOC Display Help Document
DSPIPLA Display IPL Attributes
DSPIPXCCT Display IPX Circuit
DSPIPXD Display IPX Description
DSPJOB Display Job
DSPJOBD Display Job Description
DSPJOBTBL Display Job Tables
DSPJRNRCVA Display Journal Receiver Attributes
DSPJVAPGM Display Java Program
DSPKBDMAP Display Keyboard Map
DSPLANADPP Display Local Area Network Adapter Profile
DSPLANMLB Display LAN Media Library
DSPLANSTS Display Local Area Network Status
DSPLIB Display Library
DSPLIBD Display Library Description
DSPLIBL Display Library List
DSPLIND Display Line Description
DSPLNK Display Object Links
DSPLOG Display Log
DSPMFSINF Display Mounted File System Information
DSPMNUA Display Menu Attributes
DSPMODD Display Mode Description
DSPMODSRC Display Module Source
DSPMODSTS Display Mode Status
DSPMSG Display Messages
DSPMSGD Display Message Descriptions
DSPNETA Display Network Attributes
DSPNODGRP Display Node Group
DSPNTBD Display NetBIOS Description
DSPNWID Display Network Interface Description
DSPNWSA Display Network Server Attributes
DSPNWSD Display Network Server Description
DSPNWSSTG Display Network Server Storage Space
DSPNWSUSR Display Network Server Users
DSPNWSUSRA Display Network Server User Attributes
DSPOPTLCK Display Optical Locks
DSPOPTSVR Display Optical Server
DSPOVR Display Override
DSPPART Displaying and Printing a Part
DSPPDGPRF Display Print Descriptor Group Profile
DSPPFM Display Physical File Member
DSPPGM Display Program
DSPPGMVAR Display Program Variable
DSPPSFCFG Display Print Services Facility Configuration
DSPPWRSCD Display Power On/Off Schedule
DSPRCDLCK Display Record Locks
DSPRCYAP Display Recovery for Access Paths
DSPSAVF Display Save File
DSPSBSD Display Subsystem Description
DSPSECA Display Security Attributes
DSPSOCSTS Display Sphere of Control Status
DSPSPLF Display Spooled File
DSPSRVA Display Service Attributes
DSPSRVPGM Display Service Program
DSPSYSSTS Display System Status
DSPSYSVAL Display System Value
DSPS36 Display System/36 Configuration
DSPTM Display Trademarks
DSPTRC Display Trace
DSPTRCDTA Display Trace Data
DSPUDFS Display User-Defined File System
DSPUSRPMN Display User Permission
DSPUSRPRTI Display User Print Information
DSPVTMAP Display VT Keyboard Map
DSPWSUSR Display Work Station User
WRKACTJOB Work with Active Jobs
WRKALR Work with Alerts
WRKALRD Work with Alert Descriptions
WRKALRTBL Work with Alert Tables
WRKAPPNSTS Work with APPN Status
WRKAUT Work with Authority
WRKAUTL Work with Authorization Lists
WRKBNDDIR Work with Binding Directories
WRKBNDDIRE Work with Binding Directory Entries
WRKBPTBL Work with BOOTP Table
WRKCCTRTE Work with Circuit Routes
WRKCCTSRV Work with Circuit Services
WRKCFGL Work with Configuration Lists
WRKCFGSTS Work with Configuration Status
WRKCHTFMT Work with Chart Formats
WRKCLS Work with Classes
WRKCMD Work with Commands
WRKCMTDFN Work with Commitment Definitions
WRKCNNL Work with Connection Lists
WRKCNNLE Work with Connection List Entries
WRKCOSD Work with Class-of-Service Descriptions
WRKCSI Work with Communications Side Information
WRKCTLD Work with Controller Descriptions
WRKDBFIDD Work with Database Files Using IDDU
WRKDDMF Work with Distributed Data Management Files
WRKDEVD Work with Device Descriptions
WRKDIRE Work with Directory Entries
WRKDIRLOC Work with Directory Locations
WRKDIRSHD Work with Directory Shadow Systems
WRKDOC Work with Documents
WRKDOCLIB Work with Document Libraries
WRKDOCPRTQ Work with Document Print Queue
WRKDSKSTS Work with Disk Status
WRKDSTL Work with Distribution Lists
WRKDTAARA Work with Data Areas
WRKDTADCT Work with Data Dictionaries
WRKDTADFN Work with Data Definitions
WRKDTAQ Work with Data Queues
WRKEDTD Work with Edit Descriptions
WRKENVVAR Work with Environment Variables
WRKF Work with Files
WRKFLR Work with Folders
WRKFNTRSC Work with Font Resources
WRKFORMDF Work with Form Definitions
WRKFTR Work with Filters
WRKFTRACNE Work with Filter Action Entries
WRKFTRSLTE Work with Filter Selection Entries
WRKGRPPDM Work with Groups Using PDM
WRKGSS Work with Graphics Symbol Sets
WRKHDWPRD Work with Hardware Products
WRKHDWRSC Work with Hardware Resources
WRKHLDOPTF Work with Held Optical Files
WRKIPXCCT Work with IPX Circuits
WRKIPXD Work with IPX Descriptions
WRKIPXSTS Work with IPX Status
WRKJOB Work with Job
WRKJOBD Work with Job Descriptions
WRKJOBQ Work with Job Queues
WRKJOBSCDE Work with Job Schedule Entries
WRKJRNA Work with Journal Attributes
WRKJRNRCV Work with Journal Receivers
WRKLANADPT Work with LAN Adapters
WRKLIB Work with Libraries
WRKLIBPDM Work with Libraries Using PDM
WRKLIND Work with Line Descriptions
WRKLNK Work with Object Links
WRKMBRPDM Work with Members Using PDM
WRKMLBRSCQ Work with Media Library Resource Queue
WRKMLBSTS Work with Media Library Status
WRKMNU Work with Menus
WRKMOD Work with Modules
WRKMODD Work with Mode Descriptions
WRKMSG Work with Messages
WRKMSGD Work with Message Descriptions
WRKMSGF Work with Message Files
WRKMSGQ Work with Message Queues
WRKNAMSMTP Work with Names for SMTP
WRKNCK Work with Nicknames
WRKNETJOBE Work with Network Job Entries
WRKNETTBLE Work with Network Table Entry
WRKNODL Work with Node Lists
WRKNODLE Work with Node List Entries
WRKNTBD Work with NetBIOS Descriptions
WRKNWID Work with Network Interface Description
WRKNWSD Work with Network Server Descriptions
WRKNWSENR Work with Network Server User Enrollment
WRKNWSSTG Work with Network Server Storage Spaces
WRKNWSSTS Work with Network Server Status
WRKOBJ Work with Objects
WRKOBJLCK Work with Object Locks
WRKOBJOWN Work with Objects by Owner
WRKOBJPDM Work with Objects Using PDM
WRKOBJPGP Work with Objects by Primary Group
WRKOPTDIR Work with Optical Directories
WRKOPTF Work with Optical Files
WRKOPTVOL Work with Optical Volumes
WRKOUTQ Work with Output Queues
WRKOUTQD Work with Output Queue Description
WRKOVL Work with Overlays
WRKPAGDFN Work with Page Definitions
WRKPAGSEG Work with Page Segments
WRKPARTPDM Work with Parts Using PDM
WRKPCLTBLE Work with Protocol Table Entry
WRKPFCST Work with Physical File Constraints
WRKPFDL Work with Physical File Datalinks
WRKPGM Work with Programs
WRKPMRMTS Work with Remote AS/400 System
WRKPMRPTO Work with Top Ten Omissions
WRKPMSCH Work with Scheduled Jobs
WRKPNLGRP Work with Panel Groups
WRKPRDINF Work with Product Information
WRKPRJPDM Work with Projects Using PDM
WRKPRTSTS Work with Printing Status
WRKPSFCFG Work with Print Services Facility Configurations
WRKQMFORM Work with Query Management Forms
WRKQMQRY Work with Query Management Queries
WRKQRY Work with Queriesy
WRKQST Work with Questions
WRKRDR Work with Readers
WRKREGINF Work with Registration Information
WRKRPYLE Work with System Reply List Entries
WRKRTDCFG Work with RouteD Configuration
WRKSBMJOB Work with Submitted Jobs
WRKSBS Work with Subsystems
WRKSBSD Work with Subsystem Descriptions
WRKSBSJOB Work with Subsystem Jobs
WRKSCHIDX Work with Search Indexes
WRKSCHIDXE Work with Search Index Entries
WRKSHRPOOL Work with Shared Storage Pools
WRKSOC Work with Sphere of Control
WRKSPADCT Work with Spelling Aid Dictionaries
WRKSPLF Work with Spooled Files
WRKSPLFA Work with Spooled File Attributes
WRKSRVPGM Work with Service Programs
WRKSRVTBLE Work with Service Table Entry
WRKSYSVAL Work with System Values
WRKS36 Work with System/36 Configuration
WRKS36PGMA Work with System/36 Program Attributes
WRKS36PRCA Work with System/36 Procedure Attributes
WRKS36SRCA Work with System/36 Source Attributes
WRKTAPCTG Work with Tape Cartridges
WRKTBL Work with Tables
WRKTCPPTP Work with Point-to-Point TCP/IP
WRKTIE Work with Technical Information Exchange
WRKUSFCNNE Work with Ultimedia System Facilities Connection Entries
WRKUSFDEVE Work with Ultimedia System Facilities Device Entries
WRKUSFSVRE Work with Ultimedia System Facilities Server Entries
WRKUSRJOB Work with User Jobs
WRKUSRPRF Work with User Profiles
WRKWTR Work with Writers

The list of commands that does not support OUTPUT(*OUTFILE) is quite a bit larger, but to be fair, many of them do not reference objects. DSPOBJD can handle most if not all of the object types that you might want a list of. That's why I think DSPOBJD is such a great tool and why I was glad to give it some publicity in Midrange Guru.

For those who would like to double-check my work, I'm including the source code. Anyone who would like to know how to make CL write to disk files may also find my source code of interest.

-- Ted


CL program CMDS001C

/* List the names of all DSPxxx and WRKxxx commands to a file */ 
/* along with a flag telling whether or not they support the  */ 
/* OUTPUT(*OUTFILE) parameter.                                */ 
                                                                 
/* Before compiling, set the value of the &LIB variable    */
/* to the name of the library in which the work file should */
/* be built, and the value of &FILE to the work file name. */
                                                                 
/* To compile:                                                */ 
/*    CRTCLPGM   PGM(xxx/CMDS001C) SRCFILE(xxx/QCLSRC)        */ 
                                                                 
PGM                                                              
                                                                 
   DCL        VAR(&CMDSTR) TYPE(*CHAR) LEN(80)               
   DCL        VAR(&TYPE) TYPE(*CHAR) LEN(1)                  
   DCL        VAR(&MSGID) TYPE(*CHAR) LEN(7)                 
   DCL        VAR(&MSGTXT) TYPE(*CHAR) LEN(80)               
   DCL        VAR(&LIB) TYPE(*CHAR) LEN(10) VALUE(MYLIB)     
   DCL        VAR(&FILE) TYPE(*CHAR) LEN(10) VALUE(COMMANDS)
                                                            
   DCLF       FILE(QADSPOBJ)                                
                                                            
   MONMSG     CPF0000 EXEC(GOTO ABEND)                      
                                                            
   /* Create list of DSPxxx and WRKxxx commands from QSYS */
   DSPOBJD    OBJ(QSYS/DSP*) OBJTYPE(*CMD) +                
                OUTPUT(*OUTFILE) OUTFILE(QTEMP/QADSPOBJ)    
   DSPOBJD    OBJ(QSYS/WRK*) OBJTYPE(*CMD) +                
                OUTPUT(*OUTFILE) OUTFILE(QTEMP/QADSPOBJ) +  
                OUTMBR(*FIRST *ADD)                         
                                                            
   /* Clear or build the work file */                       
   CLRPFM     FILE(&LIB/&FILE)                           
   MONMSG     CPF3142 EXEC(DO)                              
      CRTPF &LIB/&FILE RCDLEN(96)                        
   ENDDO                                                    
                                                            
   /* Load the work file with the commands & flags        */
   WRTDBF     ACTION(OPEN) DATA(&LIB *CAT '/' *CAT &FILE)
   OVRDBF     FILE(QADSPOBJ) TOFILE(QTEMP/QADSPOBJ)         
READ:                                                       
   RCVF                                                     
   MONMSG     MSGID(CPF0864) EXEC(GOTO EOF)                 
   CHGVAR     VAR(&TYPE) VALUE('Y')                       
   CHGVAR     VAR(&CMDSTR) VALUE(&ODOBNM *BCAT +        
                'output(*outfile)')                         
   /* Does this command support OUTPUT(*OUTFILE)?    */     
   CALL       PGM(QCMDCHK) PARM(&CMDSTR 80)                 
   MONMSG     MSGID(CPF0006) EXEC(DO)                       
      READMSG:                                              
         RCVMSG     RMV(*YES) MSG(&MSGTXT) MSGID(&MSGID) 
         IF (&MSGID *EQ '       ') +                        
                 THEN(GOTO ENDREADMSG)                      
         IF (&MSGID *EQ 'CPD0043' *OR &MSGID *EQ +      
            'CPD0084' *OR &MSGID *EQ 'CPD0074') +          
                 THEN(CHGVAR VAR(&TYPE) VALUE('N'))        
      /* to see the messages that are being evaluated, */ 
      /* uncomment the next command                    */ 
      /* WRTDBF     ACTION(WRITE) DATA(&ODOBNM *BCAT &TYPE
                      *BCAT + &MSGID *BCAT &MSGTXT)    */
         GOTO       READMSG                                    
      ENDREADMSG:                                              
   ENDDO                                                      
   WRTDBF     ACTION(WRITE) DATA(&ODOBNM *CAT ' ' *CAT 
                  &TYPE)                                 
   GOTO       READ                                             
EOF:                                                           
   WRTDBF     ACTION(CLOSE)                                     
   RETURN     /* normal end of job */                           
ABEND:                                                         
   SNDPGMMSG  MSGID(CPF9897) MSGF(QCPFMSG) +                   
                MSGDTA('Unexpected error; see job log.') +     
                MSGTYPE(*ESCAPE)                              
   MONMSG     MSGID(CPF0000) 
ENDPGM                    

Command WRTDBF

/* WRITE TO A DATABASE FILE */                         
                                                       
/*  TO CREATE:                                       */
/*      CRTCMD     CMD(XXX/WRTDBF) PGM(XXX/WRTDBFR)  */
                                                       
CMD        PROMPT('Write to Database File')            
PARM       KWD(ACTION) TYPE(*CHAR) LEN(8) MIN(1) +     
             EXPR(*YES) PROMPT('Action')               
PARM       KWD(DATA) TYPE(*CHAR) LEN(4096) EXPR(*YES) +
             PROMPT('Data')                            

RPG program WRTDBFR:

* Write to a database file                             
                                                       
 * To compile:                                         
 *     CRTBNDRPG  PGM(XXX/WRTDBFR) SRCFILE(XXX/QRPGLESRC)
                                                      
H dftactgrp(*no) actgrp(*caller)                       
                                                          
FDBFile    o    f 4096      disk   usropn extfile(FileName)
                                                           
D WriteToDisk     pr               extpgm('WRTDBFR')       
D   Action                       8a                        
D   Data                      4096                         
D WriteToDisk     pi                                       
D   Action                       8a                        
D   Data                      4096                         
                                                           
D FileName        s             20                         
D Output          ds          4096                         
                                                           
                                                  
C                   select                        
C                   when      Action = 'OPEN'     
C                   eval      FileName = Data     
C                   open      DBFile              
C                   when      Action = 'WRITE'    
C                   eval      Output = Data       
C                   write     DBFile        Output
C                   when      Action = 'CLOSE'    
C                   close     DBFile              
C                   eval      *inlr = *on         
C                   other                         
C                   endsl                         
C                   return                        

Sponsored By
COMMON

Get the IT training you need by attending COMMON Users Group's Spring 2003 IT Education Conference and Expo, March 9 - 13, in Indianapolis.

Choose from hundreds of sessions and labs covering the widest range of industry topics, including RPG IV, LPAR, WebSphere, and High Availability.

COMMON is the best value in IT education, so don't miss out!

Click and visit www.common.org for details!


THIS ISSUE
SPONSORED BY:

ASC
COMMON


BACK ISSUES

TABLE OF
CONTENTS

A More Perfect Union

Which Commands Can Build Outfiles?

Reader Feedback and Insights: Faster Grep



Editors
Howard Arner
Joe Hertvik
Ted Holt
David Morris

Managing Editor
Mari Barrett

Publisher and
Advertising Director:

Jenny Thomas

Advertising Sales Representative
Kim Reed

Contact the Editors
Do you have a gripe, inside dope or an opinion?
Email the editors:
editors@itjungle.com



Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved.