IBM i Global

 View Only

 Delete image catalog entry (WRKIMGCLG)

Miguel Peralta's profile image
Miguel Peralta posted Tue March 25, 2025 04:18 PM

Hi, I'm backing up to a virtual tape using ASP2. I need to delete all the image catalog entries that have been generated. The only way I can see is to go into the image catalog itself and execute option 4 (delete).
Is there a way to delete it using a CL program? Regards.

Marc Rauzier's profile image
Marc Rauzier

I am not really sure if you want to keep the images catalogs and delete only the entries, or if you can delete the images catalogs themselves.

For the second case DLTIMGCLG KEEP(*NO) will do the job.

For the first case, as a brut force program, you can use RMVIMGCLGE IMGCLGIDX(index) KEEP(*NO) with index value going from 1 to 256 and monitoring CPFBC30 and CPFBC31 to avoid errors when there is no entry for the index.

If you have several images catalogs, look at *IMGCLG objects in QUSRSYS. There should be one for each of images catalogs that you see with WRKIMGCLG. So you can browse through those objects and do what is needed for each in a CL program.

Make sure that the image catalog is no longer loaded into a virtual device.

Sylvain Manceau's profile image
Sylvain Manceau

Hi,

As always, you can get all available commands using GO CMDIMGCLG.

If your concern is about listing an image catalog content in CL to perform individual deletes, the safest and easiest way I've found so far is to verify the catalog using TYPE(*OTHER) NFSSHR(*YES), then read the generated VOLUME_LIST file as STMF.

Marc Rauzier's profile image
Marc Rauzier

Following the idea from Sylvain, it might even be possible to use IFS_OBJECT_STATISTICS table function in conjunction with QCMDEXC scalar function in order to remove entries through one SQL statement. The trick is to retrieve the IFS directory where entries are stored. Possibly with Retrieve image catalog Details API.

Robert Berendt's profile image
Robert Berendt IBM Champion

You could use the following:  https://www.ibm.com/docs/api/v1/content/ssw_ibm_i_75/apis/qvoircld.htm

Or you could ask IBM for a sql service built over this at:   IBM Power Ideas Portal  The team at Database live to generate new services.  Planned releases Db2 for IBM i 2025 PTF Group Schedule

You could also see if Cozzi's tools have this covered.

Marc Rauzier's profile image
Marc Rauzier

Well, unfortunately I cannot create any program with access to an image catalog and virtual device on PUB400.

So I am not sure about the content of VOLUME_LIST. I believe that it contains the list of IFS files names. RMVIMGCLGE requires either the image index or the volume name. My understanding is that volume name is not necessary the file name. If VOLUME_LIST includes in some way the index, it becomes possible to use it. SQL service IFS_READ will return the content of VOLUME_LIST file.

Christian Jorgensen's profile image
Christian Jorgensen IBM Champion

As @Robert Berendt mentioned, you could use the QVOIRCLD API to get the information about the image catalog that you need.

I wrote such a SQL service back in 2016 called Image_Catalog_Details, which returns all the info from that API. The SQL table function is available for free as open source in a BitBucket repository. It is also included as an example in the old IBM GitHub repository OSSILE with open source examples.

Hope this helps.