345 pts.
 Clear AS/400 library
library1                                 library2 pf1                                       lf3 lf1 lf2 i have 2 librares but i want to clear library1 all objects but not clear because depent objects are there in library how to clear all objects in library1, give me advices  

Software/Hardware used:
software
ASKED: May 17, 2011  5:55 PM
UPDATED: June 22, 2011  4:50 AM

Answer Wiki:
I run a CL every week to let me know if I have any LF not in the same library as the PF. Here is what I do. <pre>DSPDBR FILE(*ALL/*ALL) OUTPUT(*OUTFILE) + OUTFILE(QTEMP/BAD_LF) RUNQRY QRY(PGMRTOOLS/CROSS_LF) Then I send the report as an email attachment. ---- Here is the Query Sleect fields Seq Field 10 WHRTYP 20 WHRFI 30 WHRLI 40 WHRMB 50 WHNO 60 WHREFI 70 WHRELI 80 WHREMB 90 WHTYPE Select Records AND/OR Field Test Value (Field, Num WHRELI NE WHRLI AND WHRELI NE ' ' AND WHRLI NLIST 'QSYS2' 'QSYS'</pre>
Last Wiki Answer Submitted:  May 17, 2011  7:51 pm  by  CharlieBrowne   32,915 pts.
All Answer Wiki Contributors:  CharlieBrowne   32,915 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

It is not clear for me exactly what do you need, but I think you could save the file dependencies in a file and then read it from a program to clear the object that has no dependencies.

You can use DSPDBR command to see database dependencies and save this output to a file. Like this:

DSPDBR FILE(MYLIBRARY/*ALL) OUTPUT(*OUTFILE) OUTFILE(QTEMP/MYFILE) MBR(*NONE)

Regards.

 2,790 pts.

 

The simple answer is that you cannot delete pf1 from library1 until you first delete lf3 from library2.

The system won’t allow pf1 to be deleted until its dependent files are deleted.

You could move lf3 into library1 and then clear library1. You might use the MOVOBJ command to do that.

Tom

 108,310 pts.

 

Hi, You couldnt be able to clear(or delete) Physical file when there was logical file existing based on PF.
Either you need to delete LF in Library 2 and should try clearing LIbrary1
(or)
Move the LF from Library2 to library1 and try clearing Library.

Pradeep.

 3,370 pts.

 

thanks your guidelines

 345 pts.

 

When questions like this………….Don’t forget about the QADB* files in QSYS (In this case QADBFDEP)

 35 pts.

 

Don’t forget about the QADB* files in QSYS (In this case QADBFDEP)

Those files should be forgotten. I don’t know of a reason ever to access them, and there is good reason not to. Those are system files that should be left alone for DB2 to use.

IBM has provided a number of alternative interfaces that are much better choices. Use the supplied interfaces.

The DSPDBR command is one simple interface. The views, SYSVIEWDEP and SYSTABDEP in QSYS2, are another. And the List Database Relations (QDBLDBR) API is still another.

When directly accessing DB2 system files, there’s an elevated risk of getting the database cross-references out of sync. That leads to the need for RCLSTG SELECT(*DBXREF) or RCLDBXREF.

Tom

 108,310 pts.