In this program, you will find 2 CL programs and 1 RPG-ILE program that will create a file named ALLFILES. You can write a query on this file and sort on object size or last date changed to help identify good candidates for deletion.
Figure 1 - CL Program to Display Libraries - UTC001
FMT ** ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7
*************** Beginning of data *************************************
0001.00 PGM
0002.00 /* */
0003.00 DLTF FILE(your library/ALLFILES)
0004.00 MONMSG MSGID(CPF0000)
0005.00 DSPOBJD OBJ(QSYS/*ALL) OBJTYPE(*LIB) +
0006.00 OUTPUT(*OUTFILE) OUTFILE(your library/ALLLIBS)
0007.00 /* */
0008.00 CALL UTR0001
0009.00 /* */
0010.00 ENDPGM
****************** End of data ****************************************
Figure 2 - CL Program to Create List of Files in Libraries - UTC002
FMT ** ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7
*************** Beginning of data *************************************
0001.00 PGM PARM(&LIBNAME)
0002.00 /* */
0003.00 DCL VAR(&LIBNAME) TYPE(*CHAR) LEN(10)
0004.00 DSPOBJD OBJ(&LIBNAME/*ALL) OBJTYPE(*FILE) +
0005.00 OUTPUT(*OUTFILE) OUTFILE(QTEMP/ALLFILES)
0006.00 MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(EOJ))
0007.00 /* */
0008.00 CHKOBJ OBJ(your library/ALLFILES) OBJTYPE(*FILE)
0009.00 MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(FRSTTIME))
0010.00 CPYF FROMFILE(QTEMP/ALLFILES) +
0011.00 TOFILE(your library/ALLFILES) MBROPT(*ADD)
0012.00 GOTO EOJ
0013.00 /* */
0014.00 FRSTTIME:
0015.00 CPYF FROMFILE(QTEMP/ALLFILES) +
0016.00 TOFILE(your library/ALLFILES) MBROPT(*ADD) +
0017.00 CRTFILE(*YES)
0018.00 EOJ:
0019.00 ENDPGM
****************** End of data ****************************************
Figure 3 - RPG-ILE Program Run by CL Program to List Library and Information - UTR001
FMT * *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+.
*************** Beginning of data *************************************
0001.00 ***************************************************************
0002.00 ** System Name: **
0003.00 ** **
0004.00 ** Program Name: **
0005.00 ** **
0006.00 ** Program Text: Read file ALLLIBS and list all libraries **
0007.00 ** and last date used > 6 months **
0008.00 ** **
0009.00 ** Date Written: **
0010.00 ** **
0011.00 ** Written By: **
0012.00 ***************************************************************
0013.00 *
0014.00 FALLLIBS IF E DISK
0015.00 *
0016.00 D Library S 1
0017.00 *---------------------------------------------------------------------
0018.00 C Read ALLLIBS 90
0019.00 *
0020.00 C DoW *IN90 = *Off
0021.00 C ExSr CheckLib
0022.00 *
0023.00 C Read ALLLIBS 90
0024.00 C EndDo
0025.00 *
0026.00 C Eval *INLR = *On
0027.00 C Return
0028.00 *---------------------------------------------------------------------
0029.00 * Subroutine to format PATNUM
0030.00 *---------------------------------------------------------------------
0031.00 C CheckLib BegSr
0032.00 *
0033.00 C MoveL ODOBNM Library
0034.00 C If Library <> 'Q' and
0036.00 *
0037.00 C Call 'UTC0002'
0038.00 C Parm ODOBNM
0039.00 C EndIf
0040.00 *
0041.00 C EndSr
****************** End of data ****************************************