It's possible to write a CL program that calls UNDEL in a loop. UNDEL
takes a relative record number as a parameter and all you need to do put
it in a loop and increment a counter. I think it returns a message that
kills the program when you try to undelete a record that isn't deleted
but MONMSG will handle that. Here's an example CL:
PGM
DCL VAR(&RRN) TYPE(*DEC) LEN(6 0) VALUE(1)
START:
UNDEL FILE(TPCHAASM/F57EMAIL) RCDNBR(&RRN) +
ACTION(*RTV) OUTPUT(*OUTFILE) +
OUTFILE(TPCHAASM/EMAILOUT) OUTMBR(*FIRST +
*ADD)
MONMSG MSGID(TOL0001 TOL0020)
CHGVAR VAR(&RRN) VALUE(&RRN + 1)
IF COND(&RRN < 46315) THEN(GOTO CMDLBL(START))
ENDPGM
I will warn you that UNDEL isn't fast but it works great.
Matt
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[
mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Douglas Handy
Sent: Friday, May 18, 2007 2:23 PM
To: RPG programming on the AS400 / iSeries
Subject: Re: undeleting deleted records
If memory serves correctly, Dave McKenzie came up with it,
and you can read all about it just by searching for UNDEL
in the MI400 and MIDRANGE-L archives.
He did, although it did one record at a time. UNDEL was also used under
the
covers by WRKDBF to undelete specific records. WRKDBF also included a
command WRKDBFUNDL which did a global undelete of an entire file, by
cycling
through the file and using UNDEL on each deleted record.
However, WRKDBF is not longer available so unless you already have a
copy,
you should look at other alternatives.
Doug
As an Amazon Associate we earn from qualifying purchases.