Often, you need to get as much information as you can about a particular object. Although the Display Object Description (DSPOBJD) command is there to help in that situation, the information it presents is scattered among many panels. For one thing, it displays different information, depending on whether you request full or service information. And in either case, the information you need comes to you in several pages of data; you have to press the Page Down key, sometimes repeatedly, to find what you want.
I decided to write my own tool for this purpose, so here is my Display Object Information (DSPOBJINF) command. As you can see in Figure 1, DSPOBJINF shows quite a bit of information in a single panel. In addition, you can press F6 to display or F7 to edit the objects source code (if any exists) or F8 to display the objects authorities. F6 actually runs the Start SEU (STRSEU) command using an option 5, thereby invoking SEU in browse mode, so you cannot alter the source code by mistake. F7 also invokes STRSEU, but it does so in edit mode so you can actually edit the source code. F9 runs the Display Object Authorities (DSPOBJAUT) command.
Finally, you can key in the name and type of another object right at the DSPOBJINF commands display panel, press Enter, and get the information for the new object. Try that using IBMs DSPOBJD command!
The Command
DSPOBJINF (Figure 2) has only three parameters, two of which serve to identify the object about which you need information. The OBJ parameter accepts the name of the object, qualified with a library name, *CURLIB (current library), or *LIBL (search the library list). The OBJTYPE parameter displays the object type code, such as *PGM for programs. The third parameter, MBR, is applicable only for files and is ignored otherwise. It defaults to *NONE and identifies the member within the file whose information you want to display. *NONE indicates that you are interested in retrieving not member information, but file information only. You can also enter a specific member name or the special value *FIRST. If you select *FIRST, DSPOBJINF automatically plugs in the first member name for you.
CL program OBJ024CL (Figure 3) is the command processing program (CPP). When it starts running, it breaks the objects qualified name and jumps to label RETRIEVE, bypassing all the code that manipulates the display file. The display file (Figure 4) uses indicator 99 to control whether the output data fields show up on the screen; if indicator 99 is off, they are visible. The first order of business, then, is to turn indicator 99 off to enable those fields.
Next, a Check Object (CHKOBJ) command verifies the existence of the object you have requested. If the command fails, the message Object/library not found will appear at the bottom of the screen and indicator 99 will be turned on, making all the output fields vanish from sight. If the object does exist, however, the Retrieve Object Description (RTVOBJD) command will obtain all the necessary information about the object. If the object is a file, OBJ024CL also runs the Retrieve Member Description (RTVMBRD) command.
If the object is a library, the size data is almost guaranteed to be incorrect, so the program will display a message to remind you of that fact. The size information is inaccurate because the library size obtained through RTVOBJD is the size of the *LIB object exclusively, not the total size of all objects contained in the library.
After all this, the program will check to see if you have pressed F6, F7, or F9. If so, it will display the additional information you have requested. For instance, if you pressed F9, the program will run the DSPOBJAUT command and display an error message if DSPOBJAUT ended in error for whatever reason (for instance, if you lack the authority to run DSPOBJAUT).
At the very bottom is the Forward Program Messages (FWDPGMMSG) command. The utility command I wrote and published in How to Forward Messages in CL (MC, January 1998), FWDPGMMSG, simplifies enormously the chore of forwarding messages up the call stack, so Ill make use of it in all the CL programs I publish from this point on.
Thats a Screenful of Data
Lets go back to Figure 1, which shows the information for one of our source files here at MC: file SOURCE in library MAGWORK. Seven information areas are on the screen: General Information, Storage, Source, Save, File Member, Last Change/Use, and Other Data.
General Information shows the text description, object attribute (PF = physical file), name of the objects owner (QDFTOWNALT), name of the user who created the object (MALERN), name of the system in which the object was created (MC PGMR), and the time stamp for that creation (March 5, 1992, at 15:26:57). Notice that the owner and the creator are not identical, as would be the case if someone had changed the owner with the Change Object Owner (CHGOBJOWN) command. Also, the time stamp is given without editing in order to save space on the screen and to make the program shorter, although I have broken it in two partsdate and time.
The Storage area displays the size of the object (over 16 million bytes), the auxiliary storage pool (ASP) in which it resides, whether the ASP has overflowed (0 = no), whether storage has been freed (*KEEP = no), and whether storage has been compressed (X = no).
The Source area lists the names of the source file and member used to create the object (if the object was created from source code) and the date it was last changed. This information is vital for F6 and F7 to work; if missing or incorrect, F6 and F7 wont be able to access the objects source code. In the case of the object were viewing, theres no source code because source files are typically created with the Create Source Physical File (CRTSRCPF) command. Also, the source information listed in the Source area may be incorrect if you have moved the source code to another source file or library after compiling it or if you keep the source code offline.
The Save area is the most complex. It shows the time stamp of the last time the object was saved (February 25, 1998, at 00:32:03), the size of the saved object (not necessarily equal to the size of the object on disk), which command was used to save the object (SAVLIB in this case), the sequence number, volume ID, and the device used (*TAP = tape).
The File Member area tells you, for file objects only, the number of active and deleted records in the member you requested (14 and 0 respectively), as well as the file attribute (*PF = physical), type (*SRC = source), and source type for the member you selected (CMD).
By now, you should be able to guess the meaning of the fields in the Last Change/Use area, except perhaps for two. The third field reports how many times the object has been used (6,972), and the fifth field shows the time stamp of the last time the object was reset.
Last, but not least, the Other Data area tells you the domain of the object (*S = system) and the system level (version, release, and modification level) when the object was created (Version 2, Release 1, Modification 0, in this case). By the way, if you want to identify the version and release currently installed, use DSPOBJINF on program QCMD in QSYS.
Information Overload
There is a lot of information that even DSPOBJINF and DSPOBJD dont show. In fact, these commands merely scratch the surface. The complete picture can be obtained only from a system API named QUSROBJD. Im confident, however, that DSPOBJINF will satisfy most of your object information needs.
|
Figure 1: DSPOBJINFs panel.
/*===================================================================*/
/* To compile: */
/* */
/* CRTCMD CMD(XXX/DSPOBJINF) PGM(XXX/OBJ024CL) + */
/* SRCFILE(XXX/QCMDSRC) TEXT(Display Object +*/
/* Information) ALLOW(*IPGM *IMOD *INTERACT +*/
/* *EXEC) */
/* */
/*===================================================================*/
CMD PROMPT(Display Object Information)
PARM KWD(OBJ) TYPE(Q1) MIN(1) PROMPT(Object)
Q1: QUAL TYPE(*NAME) LEN(10) MIN(1) EXPR(*YES)
QUAL TYPE(*NAME) LEN(10) DFT(*LIBL) +
SPCVAL((*LIBL) (*CURLIB)) EXPR(*YES) +
PROMPT(Library)
PARM KWD(OBJTYPE) TYPE(*CHAR) LEN(7) MIN(1) +
EXPR(*YES) PROMPT(Object type)
PARM KWD(MBR) TYPE(*NAME) LEN(10) DFT(*NONE) +
SPCVAL((*NONE) (*FIRST)) EXPR(*YES) +
PROMPT(File member)
/*===================================================================*/
/* To compile: */
/* */
/* First, install FWDPGMMSG utility command. */
/* Then, */
/* */
/* CRTCLPGM PGM(XXX/OBJ024CL) SRCFILE(XXX/QCLSRC) + */
/* TEXT(CPP for DSPOBJINF command) */
/* */
/*===================================================================*/
PGM PARM(&QOBJ &OBJTYPE &MEMBER)
DCL VAR(&CHGTS) TYPE(*CHAR) LEN(13)
Figure 2: The DSPOBJINF command
DCL VAR(&CRTTS) TYPE(*CHAR) LEN(13)
DCL VAR(&FALSE) TYPE(*LGL) LEN(1) VALUE(0)
DCL VAR(&OBJAUD) TYPE(*CHAR) LEN(10)
DCL VAR(&QOBJ) TYPE(*CHAR) LEN(20)
DCL VAR(&RESETTS) TYPE(*CHAR) LEN(13)
DCL VAR(&RSTTS) TYPE(*CHAR) LEN(13)
DCL VAR(&RTNLIB) TYPE(*CHAR) LEN(10)
DCL VAR(&SAVVOL) TYPE(*CHAR) LEN(71)
DCL VAR(&SAVTS) TYPE(*CHAR) LEN(13)
DCL VAR(&SRCTS) TYPE(*CHAR) LEN(13)
DCL VAR(&TRUE) TYPE(*LGL) LEN(1) VALUE(1)
DCL VAR(&USETS) TYPE(*CHAR) LEN(13)
DCLF FILE(OBJ024DF)
MONMSG MSGID(CPF0000 MCH0000) EXEC(GOTO CMDLBL(ERROR))
/* Break qualified name */
CHGVAR VAR(&OBJ) VALUE(%SST(&QOBJ 1 10))
CHGVAR VAR(&OBJLIB) VALUE(%SST(&QOBJ 11 10))
GOTO CMDLBL(RETRIEVE)
/* Show information */
DISPLAY:
SNDRCVF RCDFMT(INFO)
CHGVAR VAR(&MESSAGE) VALUE( )
/* If F3 or F12 pressed, end program */
IF COND(&IN03 *OR &IN12) THEN(RETURN)
/* If new object name entered, get info */
IF COND(&IN30) THEN(DO)
/* Verify existence of object */
RETRIEVE:
CHGVAR VAR(&IN99) VALUE(&FALSE)
IF COND(&OBJLIB *EQ ) THEN(DO)
CHGVAR VAR(&OBJLIB) VALUE(*LIBL)
ENDDO
IF COND(&MEMBER *EQ ) THEN(DO)
CHGVAR VAR(&MEMBER) VALUE(*NONE)
ENDDO
CHKOBJ OBJ(&OBJLIB/&OBJ) OBJTYPE(&OBJTYPE)
MONMSG MSGID(CPF0000) EXEC(DO)
CHGVAR VAR(&MESSAGE) VALUE(Object/library not +
found.)
CHGVAR VAR(&IN99) VALUE(&TRUE)
GOTO CMDLBL(DISPLAY)
ENDDO
IF COND(&OBJTYPE *EQ *FILE *AND &MEMBER *NE +
*NONE) THEN(DO)
CHGVAR VAR(&IN98) VALUE(&TRUE)
CHKOBJ OBJ(&OBJLIB/&OBJ) OBJTYPE(*FILE) MBR(&MEMBER)
MONMSG MSGID(CPF9815) EXEC(DO)
CHGVAR VAR(&MESSAGE) VALUE(Member *BCAT &MEMBER +
*BCAT not found.)
CHGVAR VAR(&IN99) VALUE(&TRUE)
GOTO CMDLBL(DISPLAY)
ENDDO
ENDDO
ELSE CMD(DO)
CHGVAR VAR(&IN98) VALUE(&FALSE)
ENDDO
/* Gather information about object */
RTVOBJD OBJ(&OBJLIB/&OBJ) OBJTYPE(&OBJTYPE) +
RTNLIB(&RTNLIB) OBJATR(&OBJATR) +
TEXT(&TEXT) OWNER(&OWNER) ASP(&ASP) +
OVFASP(&OVFASP) CRTDATE(&CRTTS) +
CHGDATE(&CHGTS) SAVDATE(&SAVTS) +
RSTDATE(&RSTTS) CRTUSER(&CRTUSER) +
CRTSYSTEM(&CRTSYSTEM) OBJDMN(&OBJDMN) +
USEDATE(&USETS) USECOUNT(&USECOUNT) +
RESETDATE(&RESETTS) STG(&STG) CPR(&CPR) +
SIZE(&SIZE) SAVSIZE(&SAVSIZE) +
SAVCMD(&SAVCMD) SAVSEQNBR(&SAVSEQNBR) +
SAVVOL(&SAVVOL) SAVDEV(&SAVDEV) +
SAVF(&SAVF) SAVFLIB(&SAVFLIB) +
SAVLABEL(&SAVLABEL) SRCF(&SRCF) +
SRCFLIB(&SRCFLIB) SRCMBR(&SRCMBR) +
SRCDATE(&SRCTS) SYSLVL(&SYSLVL) +
OBJAUD(&OBJAUD)
CHGVAR VAR(&CRTDATE) VALUE(%SST(&CRTTS 1 7))
CHGVAR VAR(&CRTTIME) VALUE(%SST(&CRTTS 8 6))
CHGVAR VAR(&CHGDATE) VALUE(%SST(&CHGTS 1 7))
CHGVAR VAR(&CHGTIME) VALUE(%SST(&CHGTS 8 6))
CHGVAR VAR(&SAVDATE) VALUE(%SST(&SAVTS 1 7))
CHGVAR VAR(&SAVTIME) VALUE(%SST(&SAVTS 8 6))
CHGVAR VAR(&RSTDATE) VALUE(%SST(&RSTTS 1 7))
CHGVAR VAR(&RSTTIME) VALUE(%SST(&RSTTS 8 6))
CHGVAR VAR(&RESETDATE) VALUE(%SST(&RESETTS 1 7))
CHGVAR VAR(&RESETTIME) VALUE(%SST(&RESETTS 8 6))
CHGVAR VAR(&SRCDATE) VALUE(%SST(&SRCTS 1 7))
CHGVAR VAR(&SRCTIME) VALUE(%SST(&SRCTS 8 6))
IF COND(&OBJTYPE *EQ *FILE *AND &MEMBER *NE +
*NONE) THEN(DO)
RTVMBRD FILE(&OBJLIB/&OBJ) MBR(&MEMBER) +
RTNMBR(&MEMBER) FILEATR(&FILEATTR) +
FILETYPE(&FILETYPE) SRCTYPE(&SRCTYPE) +
NBRCURRCD(&ACTRCDS) NBRDLTRCD(&DLTRCDS)
ENDDO
ELSE CMD(DO)
CHGVAR VAR(&FILEATTR) VALUE( )
CHGVAR VAR(&FILETYPE) VALUE( )
CHGVAR VAR(&SRCTYPE) VALUE( )
CHGVAR VAR(&ACTRCDS) VALUE(0)
CHGVAR VAR(&DLTRCDS) VALUE(0)
ENDDO
CHGVAR VAR(&OBJLIB) VALUE(&RTNLIB)
CHGVAR VAR(&SAVVOL20) VALUE(%SST(&SAVVOL 1 20))
/* Warn if object is library */
IF COND(&OBJTYPE *EQ *LIB) THEN(DO)
CHGVAR VAR(&MESSAGE) VALUE(Object is library; size +
info not accurate.)
ENDDO
ENDDO
/* If F6 pressed, display source code */
IF COND(&IN06) THEN(DO)
STRSEU SRCFILE(&SRCFLIB/&SRCF) SRCMBR(&SRCMBR) +
OPTION(5)
MONMSG MSGID(CPF0000) EXEC(DO)
RCVMSG MSGTYPE(*EXCP) RMV(*YES)
CHGVAR VAR(&MESSAGE) VALUE(Error while attempting +
to display source.)
ENDDO
ENDDO
/* If F7 pressed, edit source code */
IF COND(&IN07) THEN(DO)
STRSEU SRCFILE(&SRCFLIB/&SRCF) SRCMBR(&SRCMBR) +
OPTION(2)
MONMSG MSGID(CPF0000) EXEC(DO)
RCVMSG MSGTYPE(*EXCP) RMV(*YES)
CHGVAR VAR(&MESSAGE) VALUE(Error while attempting +
to edit source.)
ENDDO
ENDDO
/* If F9 pressed, display object authorities */
ELSE CMD(IF COND(&IN09) THEN(DO))
DSPOBJAUT OBJ(&OBJLIB/&OBJ) OBJTYPE(&OBJTYPE)
MONMSG MSGID(CPF0000) EXEC(DO)
RCVMSG MSGTYPE(*EXCP) RMV(*YES)
CHGVAR VAR(&MESSAGE) VALUE(Error while attempting +
to display object authorities.)
ENDDO
ENDDO
GOTO CMDLBL(DISPLAY)
ERROR:
FWDPGMMSG
MONMSG MSGID(CPF0000)
ENDPGM
*=================================================================
* To compile:
*
* CRTDSPF FILE(XXX/OBJ024DF) SRCFILE(XXX/QDDSSRC) +
* TEXT(Display file for DSPOBJINF command)
*
*=================================================================
A DSPSIZ(24 80 *DS3)
A PRINT
A CA03(03 Exit)
A CF06(06 Display source)
A CA07(07 Edit source)
A CF09(09 Display object authorities-
A )
A CA12(12 Cancel)
*=================================================================
A R INFO
A 1 28Display Object Information
A DSPATR(HI)
A 2 4Object:
A OBJ 10A B 2 12CHANGE(30)
A COLOR(TRQ)
A 2 24Library:
A OBJLIB 10A B 2 33CHANGE(30)
A COLOR(TRQ)
A 2 45Type:
A OBJTYPE 7A B 2 51CHANGE(30)
A COLOR(TRQ)
A 2 60Member:
A MEMBER 10A B 2 68CHANGE(30)
A COLOR(TRQ)
A 3 60(name, *NONE, *FIRST)
A N99 4 2General InformationAA
A DSPATR(UL)
A COLOR(YLW)
A N99 5 2Text
A N99 TEXT 50A O 5 8COLOR(TRQ)
A N99 5 60Attr
A N99 OBJATR 10A O 5 65COLOR(TRQ)
A N99 6 2Owner
A N99 OWNER 10A O 6 8COLOR(TRQ)
A N99 6 20Created by
A N99 CRTUSER 10A O 6 31COLOR(TRQ)
A N99 6 43sys
A N99 CRTSYSTEM 8A O 6 47COLOR(TRQ)
A N99 6 57when
A N99 CRTDATE 7A O 6 62COLOR(TRQ)
A N99 CRTTIME 6A O 6 70COLOR(TRQ)
A N99 8 2Storage
A DSPATR(UL)
A COLOR(YLW)
A N99 8 30Save
A DSPATR(UL)
A COLOR(YLW)
A N99 8 60Last Change/Use
A DSPATR(UL)
A COLOR(YLW)
A N99 9 2Size
A N99 SIZE 15Y 0O 9 8EDTCDE(1 *)
A COLOR(TRQ)
A N99 9 30When
A N99 SAVDATE 7A O 9 36COLOR(TRQ)
A N99 SAVTIME 6A O 9 44COLOR(TRQ)
A N99 9 60Chg
A N99 CHGDATE 7A O 9 66COLOR(TRQ)
A N99 CHGTIME 6A O 9 74COLOR(TRQ)
A N99 10 2ASP
A N99 ASP 2S 0O 10 8COLOR(TRQ)
A N99 10 30Size
A N99 SAVSIZE 15Y 0O 10 36COLOR(TRQ)
A EDTCDE(1 *)
A N99 10 60UseDt
A N99 USEDATE 7A O 10 66COLOR(TRQ)
Figure 3: CL program OBJ024CL
A N99 USETIME 6A O 10 74COLOR(TRQ)
A N99 11 2Ovf
A N99 OVFASP 1A O 11 8COLOR(TRQ)
A N99 11 30Cmd
A N99 SAVCMD 10A O 11 36COLOR(TRQ)
A N99 11 60UseCt
A N99 USECOUNT 5Y 0O 11 66EDTCDE(1)
A COLOR(TRQ)
A N99 12 2Free
A N99 STG 10A O 12 8COLOR(TRQ)
A N99 12 30SeqN
A N99 SAVSEQNBR 4S 0O 12 36COLOR(TRQ)
A N99 12 60Rstor
A N99 RSTDATE 7A O 12 66COLOR(TRQ)
A N99 RSTTIME 6A O 12 74COLOR(TRQ)
A N99 13 2Cpr
A N99 CPR 1A O 13 8COLOR(TRQ)
A N99 13 30Vol
A N99 SAVVOL20 20A O 13 36COLOR(TRQ)
A N99 13 60Reset
A N99 RESETDATE 7A O 13 66COLOR(TRQ)
A N99 RESETTIME 6A O 13 74COLOR(TRQ)
A N99 14 30Dev
A N99 SAVDEV 10A O 14 36COLOR(TRQ)
A N99 15 2Source
A DSPATR(UL)
A COLOR(YLW)
A N99 15 30Savf
A N99 SAVF 10A O 15 36COLOR(TRQ)
A N99 SAVFLIB 10A O 15 47COLOR(TRQ)
A N99 15 60Other Data
A DSPATR(UL)
A COLOR(YLW)
A N99 16 2File
A N99 SRCF 10A O 16 8COLOR(TRQ)
A N99 16 30Lbl
A N99 SAVLABEL 17A O 16 36COLOR(TRQ)
A N99 16 60Dmain
A N99 OBJDMN 2A O 16 66COLOR(TRQ)
A N99 17 2Lib
A N99 SRCFLIB 10A O 17 8COLOR(TRQ)
A N99 17 60SysLv
A N99 SYSLVL 9A O 17 66COLOR(TRQ)
A N99 18 2Mbr
A N99 SRCMBR 10A O 18 8COLOR(TRQ)
A N99 98 18 30File MemberA
A COLOR(YLW)
A DSPATR(UL)
A N99 19 2Date
A N99 SRCDATE 7A O 19 8COLOR(TRQ)
A N99 SRCTIME 6A O 19 16COLOR(TRQ)
A N99 98 19 30Rcds
A N99 98 ACTRCDS 10Y 0O 19 36COLOR(TRQ)
A EDTCDE(1 *)
A N99 98 19 60FAttr
A N99 98 FILEATTR 3A O 19 66COLOR(TRQ)
A N99 98 20 30Dltd
A N99 98 DLTRCDS 10Y 0O 20 36COLOR(TRQ)
A EDTCDE(1 *)
A N99 98 20 60FType
A N99 98 FILETYPE 5A O 20 66COLOR(TRQ)
A N99 98 21 60SrcTp
A N99 98 SRCTYPE 10A O 21 66COLOR(TRQ)
A 23 2F3=Exit F6=Show source F7=Edit-
A source F9=DSPOBJAUT F12=Cancel
A COLOR(BLU)
A MESSAGE 75A O 24 2DSPATR(HI)
Figure 4: Display file OBJ024DF
LATEST COMMENTS
MC Press Online