The reason you can retrieve deleted records is that when your program
"deletes" a record, the operating system merely flags that record as
"deleted." That's why DSPFD has totals for "number of records" and
"number of deleted records." Until you reorganize that file, the
deleted record count will continue to climb.
When you save the file (SAVOBJ or SAVLIB), the saved object includes
both the active records and those flagged as deleted.
Now comes the fun part!
Save the file with the deleted records to a SAVF.
You can read a SAVF in RPG. Define a file (I believe it's 528
bytes-- DSPFD for the save file and check) and use it in your program.
As you read the file, there's some header information, followed by
your data. Yes, it doesn't line up with the record boundaries, and
you've got to deal with packed and binary and date fields, but your
records are all there! You can even find the flag that the system
uses to mark deleted records.
It's left as an exercise for the student to unwind the spanned
records and copy them to a new file with the deleted records restored.
Isn't there an option when dealing with files in the IFS to tell the
transfer commands what the record length is? If so, a copy out and
back may re-align the records...
-Paul E Musselman
PaulMmn@xxxxxxxxxxxxxxxxxxxx
As an Amazon Associate we earn from qualifying purchases.
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.