Curb the erosion of disk space with these practices.
by Eric Hill
The first thing that goes through my mind when I discuss new projects or I purchase new software is the availability of disk space on my AS/400. Can I fit the new software on the system? How much room will be left after implementation? I have found myself staring at the disk usage percentage on the Work with System Status (WRKSYSSTS) screen as if it was a time bomb.
Disk space on the AS/400 is one of the most important concerns in all MIS shops. But there is little to be found in the IBM manuals that shows you how to conserve or regain disk space. As with many aspects of IBM midrange computers, you often must find things out on your own. I have compiled these disk space saving tips after doing some research and asking quite a few questions of fellow MIS professionals.
IPL and RCLSTG Command
After a spooled file is printed, the AS/400 is left with "spool members," which are unusable segments of disk storage. These spool members accumulate until the machine is IPLed for the seventh time. At this point, the AS/400 cleans up the excess spool members, recovering all the wasted space. To prompt the clean-up on a timely schedule, if at all possible, try to IPL the system once a week.
The Reclaim Storage command (RCL STG) is used to perform a general clean-up of auxiliary storage. This command also reclaims all objects secured with a damaged or destroyed authorization list. RCLSTG should be run especially after unexpected failures occur. Doing so will correct abnormal conditions on permanent objects that might have been damaged when the failure occurred.
All subsystems must be inactive to execute the RCLSTG command. Because of this restriction, carefully select the time when you will run this command. It can take a very long time to complete.
Remove Observability and Optimize Programs
Observability data in a program is data required for on-line debugging. It is automatically inserted in a program when it is compiled. On-line debug is wonderful when you are still in the testing stage of a program, but it is not necessary when the program goes into production. Once the program is running smoothly, remove observability using the Change Program command (CHGPGM) to reduce the program size. Observability can be returned to the program by simply re-compiling it.
The command to create HLL programs (CRTxxxPGM) has a parameter, GENOPT, which can contain *OPTIMIZE or *NOOPTIMIZE. When *OPTIMIZE is used, the compiler generates a program for more efficient processing and possibly requires less storage. According to a "TechTalk" item in Midrange Computing magazine (then DataNetwork, December 1989), "Optimizing deals mainly with register usage optimization, so a program would benefit in path lengths and possibly instruction paging." Compiling an HLL program using GENOPT(*OPTIMIZE) can increase the length of the compile substantially. The program can also be changed for optimization using the CHGPGM command. Later we will discuss a program which removes observability and optimizes programs in all user libraries.
Delete Old Entries from the Problem Log
The AS/400 keeps track of all errors on the system in a log file called QASXPROB. You should periodically delete these entries using the Delete Problem command (DLTPRB). The STATUS parameter of this command specifies the status of the problem to be deleted. It can be *OPENED (the problem has been identified but no problem analysis run); *READY (the problem analysis has been run and the problem is ready to be prepared); *PREPARED (information relating to a service request has been added); or *ALL (all problems older than a specified number of days will be deleted). The DAYS parameter in the command denotes that all problems older than this value will be deleted.
After completing the DLTPRB command, perform the Reorganize Physical File Member command (RGZPGM) to remove the deleted records from QASXPROB.
Delete Old History Files
Old history files take up a great deal of space on disk. These should be systematically saved and deleted. The Work with Objects command (WRKOBJ) with QHST* in the OBJ parameter will display a list of all history files on the system. Once saved, these can be deleted by placing a "4" beside the files to be removed.
In the July 1990 issue of Midrange Computing (or their ResourceLibrary), there is a CL program that will remove history files with an option to keep a certain number of history files.
Clear the QRPLOBJ Library
When you change a program on the AS/400 and you recompile it while another user is executing that program, the AS/400 places the old version of the program in a library called QRPLOBJ. The user continues to use the old program until he or she exits the program. The new program will be used any time after that. However, that old version of the program remains in the QRPLOBJ library. Use the Clear Library command (CLRLIB) to clear this library on a timely basis.
Apply PTFs Permanently
When you load a cumulative PTF package onto the AS/400 and you apply it temporarily, the previous PTFs remain in disk until the new PTFs are applied permanently. After running the AS/400 successfully using the new PTFs, you should apply them permanently to remove the old PTFs.
There are two ways to apply PTFs permanently. The first method can be used during an attended IPL. After taking the option "Perform IPL" from the IPL screen, there will be a screen to work with program temporary fixes. The PTFs can be applied permanently from there.
Another way to apply PTFs permanently is to use the Apply PTF command (APYPTF). Run the Display PTF command (DSPPTF) to get a list of all licensed programs on the system. A separate application will be needed for each licensed program. Place the licensed program name in the LICPGM parameter, indicate SELECT (*ALL), APY(*PERM), DELAYED (*YES), and IPLAPY(*YES). Press Enter to apply these PTFs permanently at the next unattended IPL.
Delete PTF Save Files from QGPL
When PTFs are downloaded to the AS/400 via the Electronic Customer Support (ECS) line, save files are created in library QGPL for these PTFs. Delete these save files after the downloaded PTFs are applied.
Clear Message and Output Queues
Make sure all users are maintaining their message queues on a regular basis, including the QSYSOPR message queue. These queues have a tendency to increase in size very quickly. Train users to use the function keys when they Display Messages (DSPMSG). They can either clear their entire message queues using the F13 key, or remove one message at a time by moving the cursor to a message and pressing the F11 key. The F16 key removes all unanswered messages, which is a good way to unclutter the QSYSOPR message queue.
Check output queues for old spool files that are no longer needed. The Work with Output Queue command (WRKOUTQ) can be helpful in determining which spool files can be deleted, especially if you take the trouble to request the information on hard copy with OUTPUT(*PRINT). Each spool file is fully identified and dated. An easy way to clear an output queue of all spool files is to use the Clear Output Queue command (CLROUTQ).
Manage the Journal Receivers
The AS/400 keeps several internal journals. The names of these journals are:
QSDSNX (Distributed Services) QSXJRN (Problem Database)
These journals must be maintained periodically because their attached journal receiver fills up. Failure to maintain the journal will cause the journal receiver to keep growing, consuming valuable space. This maintenance process is somewhat involved, but basically it consists of detaching the current journal receiver, saving it on tape, deleting it from disk, and creating a new journal receiver for the journal. The steps required to perform this maintenance follow below.
Detach the current journal receiver and assign a new one to each journal using the Change Journal command (CHGJRN). For the JRN parameter, enter the journal name, and for the JRNRCV parameter, enter *GEN. This will increment the sequence number by one and cause it to be used as the new journal receiver name. List the current attached journal receivers for each of the internal journals using the Work with Journal Attributes command (WRKJRNA). Place the journal name into the JRN parameter and *PRINT in the OUTPUT parameter.
List all the journal receivers using the Display Object Description command (DSPOBJD). Indicate OBJ(*ALL), OBJTYPE(*JRNRCV), and OUTPUT(*PRINT).
Compare the two lists and save the journal receivers which match the names of the internal journals but are not attached.
Delete the journals using the Delete Journal Receiver command (DLTJRNRCV). Chapter 3 of the Backup and Recovery Guide contains just about all the information needed to maintain journals.
Reorganize Office Physical Files
If the AS/400 has Office installed, periodically reorganize the Office physical files which are found in library QUSRSYS. Figures 1a and 1b provide programs called CLEANLIBS and CLEANLIBSF which will clean up all files in all user libraries. The programs were originally presented in the December 1989 issue of Midrange Computing (then DataNetwork). These programs are ideal to use in this situation. They also remove observability and optimize all programs in the library to further save disk space.
Reorganize Application Physical Files
It is a good idea to reorganize all application physical files on a regular basis. Files with a great number of additions and deletions need to be reorganized periodically. The CLEANLIBS program should handle this as well.
Delete Users From On-Line Education
Once a user is finished with the AS/400 on-line education, delete the user from on-line education and reorganize those files. The education files are in QUSRSYS and the CLEANLIBS program will take care of these files, too.
Delete Old Programs
Everyone has had to write one-time fix programs for a quick way out of a problem. Once these are done and are no longer in use, delete the programs and remove the source member. This can save some disk space as well as clean up the source physical file.
These are the space saving measures I use on my AS/400. As almost everyone knows, every little bit of space helps. If you know of any more, please let me know, or contact Midrange Computing with your tip. The more we know, the more space we can save.
AS/400 Disk Saving Tips
Figure 1A CL program CLEANLIBS
CLEANLIBS: + PGM DCLF FILE(QADSPOBJ) MONMSG MSGID(CPF0000) DSPOBJD OBJ(QSYS/*ALL) OBJTYPE(*LIB) OUTPUT(*OUTFILE) + OUTFILE(QTEMP/LIBLIST) OVRDBF FILE(QADSPOBJ) TOFILE(LIBLIST) OPNDBF FILE(QTEMP/LIBLIST) OPTION(*INP) READ: + RCVF RCDFMT(QLIDOBJD) MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(EOF)) IF COND(%SST(&ODOBNM 1 1) *EQ 'Q') THEN(GOTO CMDLBL(READ)) IF COND(%SST(&ODOBNM 1 1) *EQ '#') THEN(GOTO CMDLBL(READ)) IF COND(%SST(&ODOBNM 1 1) *EQ '$') THEN(GOTO CMDLBL(READ)) IF COND(%SST(&ODOBNM 1 1) *EQ '%') THEN(GOTO CMDLBL(READ)) IF COND(%SST(&ODOBNM 1 1) *EQ '&') THEN(GOTO CMDLBL(READ)) REORGF: + CALL PGM(REORGPF) PARM(&ODOBNM) RMVOBS: + CHGPGM PGM(&ODOBNM/*ALL) RMVOBS(*ALL) OPTIMIZE: + CHGPGM PGM(&ODOBNM/*ALL) OPTIMIZE(*YES) GOTO CMDLBL(READ) EOF: + CLOF OPNID(LIBLIST) ENDPGM
AS/400 Disk Saving Tips
Figure 1B CL program CLEANLIBSFCLEANLIBSF: + PGM PARM(&LIB) DCL VAR(&LIB) TYPE(*CHAR) LEN(10) DCL VAR(&PERC) TYPE(*DEC) LEN(5 2) DCLF FILE(QAFDMBRL) MONMSG MSGID(CPF0000) DSPFD FILE(&LIB/*ALL) TYPE(*MBRLIST) OUTPUT(*OUTFILE) + FILEATR(*PF) OUTFILE(QTEMP/FILELIST) MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(ENDPGM)) OVRDBF FILE(QAFDMBRL) TOFILE(FILELIST) OPNDBF FILE(QTEMP/FILELIST) OPTION(*INP) READ: + RCVF RCDFMT(QWHFDML) MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(EOF)) CHGVAR VAR(&PERC) VALUE(000.00) IF COND(&MLNRCD *GT 0) THEN(DO) CHGVAR VAR(&PERC) VALUE(&MLNDTR / &MLNRCD) ENDDO IF COND(&PERC *EQ 00.10) THEN(DO) RGZPFM FILE(&LIB/&MLFILE) MBR(&MLNAME) ENDDO GOTO CMDLBL(READ) EOF: + CLOF OPNID(FILELIST) ENDPGM: + ENDPGM