I seem to recall a thread awhile back that revealed that SQL DELETEs cannot be undone.  As I recall, when SQL deletes a row, the record gets initialized.  
http://archive.midrange.com/rpg400-l/200706/msg00495.html
Rereading this thread, it seems the scenario was inconclusive.  Anyone know for sure?
Eric
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx]On Behalf Of PaulMmn
Sent: Sunday, February 03, 2008 12:34 PM
To: Midrange Systems Technical Discussion
Subject: Re: is there a way to recover deleted records ?
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.