× 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.



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.

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.