You can access the Record Number in SQL by referring to RRN. As far as I know the RRN is not supported in Query.
Deleted records are not accessible through SQL or Query. Although the space used by deleted records is not released until RGZPFM is done or the file has REUSEDLT(*YES) specified, the records are no longer existant in the file. They can only be recovered from a database journal.
It is true that you cannot access deleted records using SQL or Query. The record is however still in the database even after you have deleted it. There is a hidden field (not visible to users) which indicates if the record is logically deleted. The value however is not Y or N.
You can deduce the RRN of a deleted record by sequentially reading the file (not by key), looking to see what RRN each record represents, and noticing gaps (RRN 5 follows RRN 3, RRN 4 has been deleted).
Not all data associated with the deleted record may exist. If, for instance, the record contained a variable length field and data had overflowed the base allocation size then the overflowed data may indeed be gone.
<a href=”http://www.brucevining.com/”>Bruce Vining Services</a>