|
Hello all... Occasionally, I want to retrieve all of the deleted records from an AS/400 file. I have various reasons for needing to do this, but it is mainly because we have an EAI application where we have files with *INSERT trigger-handling programs that are used to submit jobs to run for processing sales orders. The only reason that the record is written to the file is so that the trigger-handling program will submit a job to process a particular order. When the submitted job runs, it deletes the record from the trigger file to clean up. We have periodic processes that reorg these files. Because of system design constraints these records MUST be deleted when processed, I can't just flag them as processed and leave them in the file. I now need to view all of the deleted records in a particular file via a query in order to see an audit trail of transactions which have occurred with a particular order. I have the UNDEL utility, but it requires me to display each record one at a time and press F23 twice...and this undeletes the record in place in the data file. I have figured out a kludgey way to do what I want by saving the physical file to a save file, then copy the save file to a data file. I then use DSPPFM to see roughly where the file data begins in the save file data. I know that each deleted record in the PF is prefixed by a X'C0' character in the save file (good records are prefixed with X'80'), so in an RPG program I can process the save file data records byte-by-byte to build a record and write records to a work file that looks like the original data file (I copy the DDS to another member and add an X suffix to the file name, also removing the UNIQUE keyword, if specified). I would like to build a more elegant solution so that I don't necessarily have to write a new program every time I want to retrieve the deleted records from a file. 1) where do I find the documentation that I need that describe the internal layout of a physical file (both the live file and the format when stored in a save file)? 2) How do programs like UNDEL work against the live file to retrieve deleted records? Is there an API to call for this?
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.