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


  • Subject: RE: How to retrive deleted record in SQL?
  • From: Buck Calabro/commsoft<mcalabro@xxxxxxxxxxxx>
  • Date: Wed, 23 Dec 1998 13:51:20 -0500


>>When I delete a record using SQL delete statement, 
>>can I get it back? Is there any command to retrive back 
>>deleted record?

>My understanding was the answer to that is a big NO. 
>But with all the gurus out there, maybe we shall find 
>out something new?  If you are journaling the file 
>you could possibly reconstruct it.

Journaling is certainly one method, perhaps the best
outside of backup tapes.
Thanks to Joseph Wechsler (sp?), I have a skeleton
started for a program to retrieve deleted records.
I say skeleton because it has hard-coding for my
particular file.

Here's how it works:

1. CRTSAVF tempsavf
2. 1SAVOBJ yourfile to tempsavf
3. CRTPF tempfile RCDLEN(528)
4. Write a simple RPG program to copy the records 
   from the SAVF to tempfile
     The data in tempfile contains a header section,
     all the records from your file and a trailer
     section.  I do not have any layout information
     for the header or trailer sections (this is what's
     hard coded.)  Each record in your original file
     is preceded by a "status" byte - x'80' = active,
     x'C0' = deleted.  Each record contains data in 
     1-512, and a checksum(?) in 513-528.
5. CRTDUPOBJ yourfile dupefile
6. Write an RPG program to read the spanned records
   from tempfile and write them to dupefile.

Right now, I have the record length and start position
(past the header) hard coded for the file I needed to 
retrieve records from.  Also, when the program hits the
trailer records it issues an error, but I didn't care,
since it already wrote all my records.  I can verify
this with DSPFD yourfile and look at the record counts.

If anybody has the time and inclination to finish this,
let me know and I'll post or email the source I have 
so far.

Buck Calabro
CommSoft, Albany, NY
mailto:mcalabro@commsoft.net




+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.