When Was the Last Time...?

Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

AS/400 libraries, like attics, have a tendency to accumulate old stuff that was once good, but now remains only because of inertia ("just in case I need it again") or forgetfulness. And it's frustrating to realize that your system is running short of available disk space because of an accumulation of old objects, and yet not be able to identify the objects that can be deleted.

Allow me to introduce you to the Print Object Dates command (PRTOBJDAT). With this command, you can obtain a list of objects, sorted by one of the following dates:

The date the object was created. The date the object was last changed. The date the object was last used. The date the object was last saved. The date the object was last restored.

PRTOBJDAT requires that you specify the library or libraries to be listed. You can indicate a single library, all libraries, all user libraries, all libraries in your library list, the current library, or all libraries in the user portion of your library list.

Next, you have to indicate what objects to list. You can enter a specific name, a generic name, or *ALL. Following that, enter the object type--it can be either *ALL, or a specific type. Finally, indicate how to sort the report; you have the five choices mentioned before.

The objects needed to run PRTOBJDAT are listed in Figures 1 through 5. Be sure to compile them in the order they appear in the figures.


When Was the Last Time...?

Figure 1 Command PRTOBJDAT

 PRTOBJDAT: CMD PROMPT('Print Object Dates') PARM KWD(LIB) TYPE(*NAME) LEN(10) SPCVAL((*ALL) + (*ALLUSR) (*CURLIB) (*LIBL) (*USRLIBL)) + MIN(1) PROMPT('Library') PARM KWD(OBJ) TYPE(*GENERIC) DFT(*ALL) + SPCVAL((*ALL)) PROMPT('Object') PARM KWD(OBJTYPE) TYPE(*CHAR) LEN(8) RSTD(*YES) + DFT(*ALL) VALUES(*ALL *ALRTBL *AUTL *CFGL + *CHTFMT *CLD *CLS *CMD *COSD *CSPMAP + *CSPTBL *CTLD *DEVD *DOC *DTAARA *DTADCT + *DTAQ *EDTD *FCT *FILE *FLR *FNTRSC + *FORMDF *GSS *JOBD *JOBQ *JRN *JRNRCV + *LIB *LIND *MENU *MODD *MSGF *MSGQ *OUTQ + *OVL *PAGSEG *PDG *PGM *PNLGRP *PRDAVL + *PRDDFN *PRDLOD *QMFORM *QMQRY *QRYDFN + *RCT *SBSD *SCHIDX *SPADCT *SSND *S36 + *TBL *USRIDX *USRPRF *USRQ *USRSPC) + PROMPT('Object type') PARM KWD(SORT) TYPE(*CHAR) LEN(4) RSTD(*YES) + DFT(*USE) VALUES(*CRT *CHG *USE *SAV + *RST) PROMPT('Date to sort by') 
When Was the Last Time...?

Figure 2 CL program OBJ007CL

 OBJ007CL: + PGM PARM(&LIB &OBJ &OBJTYPE &SORT) DCL VAR(&LIB) TYPE(*CHAR) LEN(10) DCL VAR(&OBJ) TYPE(*CHAR) LEN(10) DCL VAR(&OBJTYPE) TYPE(*CHAR) LEN(8) DCL VAR(&SORT) TYPE(*CHAR) LEN(4) DSPOBJD OBJ(&LIB/&OBJ) OBJTYPE(&OBJTYPE) DETAIL(*FULL) + OUTPUT(*OUTFILE) OUTFILE(QTEMP/QADSPOBJ) CLRPFM FILE(OBJ007WF) OVRDBF FILE(QADSPOBJ) TOFILE(QTEMP/QADSPOBJ) CALL PGM(OBJ007RG) PARM(&SORT) DLTOVR FILE(QADSPOBJ) CALL PGM(OBJ007RT) CLRPFM FILE(OBJ007WF) ENDPGM 
When Was the Last Time...?

Figure 3 Physical file OBJ007WF

 A REF(QSYS/QADSPOBJ) * A R WFREC A ODLBNM R TEXT('LIBRARY NAME') A ODOBNM R TEXT('OBJECT NAME') A ODOBTP R TEXT('OBJECT TYPE') A ODOBSZ R TEXT('OBJECT SIZE') A ODOBOW R TEXT('OWNER PROFILE') A ODOBTX R TEXT('OBJECT TEXT') A ODCDAT R TEXT('CREATION DATE') A ODLDAT R TEXT('CHANGE DATE') A ODUDAT R TEXT('USE DATE') A ODSDAT R TEXT('SAVE DATE') A ODRDAT R TEXT('RESTORE DATE') A SORT1 1 TEXT('SORT CENTURY') A SORT2 6 TEXT('SORT DATE') * A K SORT1 DESCEND A K SORT2 DESCEND A K ODLBNM A K ODOBNM A K ODOBTP 
When Was the Last Time...?

Figure 4 RPG program OBJ007RG

 FQADSPOBJIP E K DISK FOBJ007WFO E DISK A * I DS I 1 6 MMDDYY I 1 2 MM I 3 4 DD I 5 6 YY * C *ENTRY PLIST C PARM SORT 4 * C SORT CASEQ'*CRT' CRTDAT C SORT CASEQ'*CHG' CHGDAT C SORT CASEQ'*USE' USEDAT C SORT CASEQ'*SAV' SAVDAT C SORT CASEQ'*RST' RSTDAT C END C EXSR TOYMD C WRITEWFREC * C CRTDAT BEGSR C MOVE ODCCEN SORT1 C MOVE ODCDAT MMDDYY C ENDSR * C CHGDAT BEGSR C MOVE ODLCEN SORT1 C MOVE ODLDAT MMDDYY C ENDSR * C USEDAT BEGSR C MOVE ODUCEN SORT1 C MOVE ODUDAT MMDDYY C ENDSR * C SAVDAT BEGSR C MOVE ODSCEN SORT1 C MOVE ODSDAT MMDDYY C ENDSR * C RSTDAT BEGSR C MOVE ODRCEN SORT1 C MOVE ODRDAT MMDDYY C ENDSR * C TOYMD BEGSR C MOVE *BLANK SORT2 C YY CAT MM:0 SORT2 C SORT2 CAT DD:0 SORT2 C ENDSR 
When Was the Last Time...?

Figure 5 RPG Auto Report program OBJ007RT

 FOBJ007WFIP E K DISK FQSYSPRT O F 132 OA PRINTER * C MOVE ODLBNM LIB 10 C MOVE ODOBNM OBJ 10 C MOVE ODOBTP TYPE 8 C MOVELODOBTX TEXT 20 C Z-ADDODOBSZ SIZE 100 C MOVE ODOBOW OWNER 10 C MOVE ODCDAT CRTDAT 60 C MOVE ODLDAT CHGDAT 60 C MOVE ODUDAT USEDAT 60 C MOVE ODSDAT SAVDAT 60 C MOVE ODRDAT RSTDAT 60 * OQSYSPRT H 303 *AUTO O 'PRINT OBJECT DATES ' O '(PRTOBJDAT)' O D 1 *AUTO O LIB 'Library' O OBJ 'Object' O TYPE 'Obj Type' O SIZE 3 'Size' O OWNER 'Owner' O TEXT 'Text' O CRTDATY 'Created' O CHGDATY 'Last Chg' O USEDATY 'Last Use' O SAVDATY 'Last Sav' O RSTDATY 'Last Rst' 
BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  •  

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: