× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi, Timothy,

There are several related issues here:

#1. originally on S/38 CPF and early OS/400, when you created a physical file with CRTPF, it always just added new inserted records at the end, and any "deleted" records were just marked as "deleted" (the first byte of every record is a 'delete' flag byte).  Then, a RGZPFM would "compress out" the deleted records, to reclaim the space they occupied.

RGZPFM was considered "onerous" because it requires an exclusive lock on the entire database file for the duration of the operation.  For really large files, especially back when machines were much slower, this could take many hours or even days to complete.

#2. at some point, IBM added the "Re-Use Deleted Records" feature, with the attribute REUSEDLT *YES or *NO on the CRTPF, CHGPF commands, etc.

When this is "yes" the system still marks deleted records with the delete flag, but it adds their RRNs to a (hidden) index of deleted records, so that the next time a new record is to be written, instead of always writing it at the end of the physical file extent, it will re-use one of the deleted records, and then remove it from that hidden index.   So, in this way, the disk space is thus automatically re-used, and you no longer need to worry about running a RGZPFM.   

#3. also note that when you create a file using SQL, e.g. CREATE TABLE, it always sets on the REUSEDLT(*YES) flag in the underlying physical file.

So, typically, when you used files that have the older REUSEDLT(*NO) and always added new records at the end, if you delete any records, you can end up with "holes" in the file, blocks of deleted records.   When RGZPFM is run, any records beyond these "holes" will get "moved down" to lower relative record numbers.

But, with REUSEDLT(*YES), the new inserted records would appear to "jump" around, seemingly randomly.

Also, you can still use RGZPFM even on a file with REUSEDLT(*YES), but, why would you?

Hope that helps,

Mark S. Waterbury

On Thursday, April 4, 2024 at 11:09:47 AM EDT, Timothy Feldmeier <timothy.feldmeier@xxxxxxxx> wrote:

I know the RRN can change when running a reorg, as it will reuse deleted records etc...    My question is - would the order of the RRN every change for a record.

This would allow a program to keep the RRN order to be always reliable.

Thank You

Tim Feldmeier
Programmer Analyst, Applications Development
1431 Opus Place, Suite 530 | Downers Grove, IL 60515
Email:  timothy.feldmeier@xxxxxxxx<mailto:timothy.feldmeier@xxxxxxxx>
Phone: (331) 233-7921


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.