4/27/09 - How to delete a specifc relative record if the file is keyed

You can delete a specific relative record number when a file is keyed and the UPDDTA command can’t do it. Simply use normal OS/400 SQL and run the following:

delete from LIBRARY/FILENAME A where RRN(A) = 3

The above example deletes RRN number 3. Just replace LIBRARY and FILENAME with library and file names the ‘A’ after file name is needed. Then change the 3 at the end to be the actual RRN number you want to delete.

You may want to use a ‘select’ statement first to ensure you have the right record, here’s an example of that:


select * from LIBRARY/FILENAME A where RRN(A) = 3

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 2009, Vision Solutions, Inc. All rights reserved. Vision Solutions develops and sells iSeries high availability and AIX replication and clustering solutions. 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: