6/17/08 - How to streamline the deletion of logical files when you need to delete a physical file

Deleting logical files can be a time consuming task when you need to delete a physical file due to the number of logical files that have no common prefix to the file name to wildcard.

This simple CL program could 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: