5/1/08 How to streamline the deletion of logical files when deleting a physical file

Deleting a physical file can be time consuming at times due to the number of logical files that might are associated with it that have no common prefix to the name of the LF (thus cannot be found with a wildcard search).

This short program can help:


PGM PARM(&SYS1OBJ &SYS1LIB)
DCL VAR(&SYS1OBJ) TYPE(*CHAR) LEN(10)
DCL VAR(&SYS1LIB) TYPE(*CHAR) LEN(10)
DCLF FILE(QADSPDBR)
OVRDBF FILE(QADSPDBR) TOFILE(QTEMP/DBRRMV)
DSPDBR FILE(&SYS1LIB/&SYS1OBJ) OUTPUT(*OUTFILE) +
OUTFILE(QTEMP/DBRRMV)
MONMSG MSGID(CPF3012) EXEC(GOTO CMDLBL(EOF))
READ: RCVF
MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(DLTF))
IF COND(&WHNO *EQ 0) THEN(GOTO CMDLBL(DLTF))
DLTF FILE(&WHRELI/&WHREFI)
MONMSG MSGID(CPF0001)
GOTO CMDLBL(READ)
DLTF: DLTF FILE(&SYS1LIB/&SYS1OBJ)
MONMSG MSGID(CPF0001)
EOF: ENDPGM



Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.

No comments: