Thank you Rory, I will try that program when time allows.

Jack Derham
Direct Systems, Inc.

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Hewitt, Rory
Sent: Wednesday, August 17, 2005 6:07 PM
To: midrange-l@xxxxxxxxxxxx
Subject: RE: Restore a source member

Jack,

I wrote the following program (called RECYCLE) and changed the RMVM
command to use it as a Validity Checker. It's saved my life MANY
times...

Note that it should be compiled with USRPRF(*OWNER) and then owned by
QSECOFR, otherwise you may get auth errors. Obviously you can add
processing to save different source members, omit them etc. based on
user profile etc.

RECYCLE - Save deleted source members

========================================================================
=

             PGM        PARM(&QFILE &MBR)                              
                                                                       
             DCL        VAR(&QFILE) TYPE(*CHAR) LEN(20)                
             DCL        VAR(&MBR) TYPE(*CHAR) LEN(10)                  
             DCL        VAR(&FILE) TYPE(*CHAR) LEN(10)                 
             DCL        VAR(&LIB) TYPE(*CHAR) LEN(10)                  
             DCL        VAR(&TEXT) TYPE(*CHAR) LEN(50)                 
                                                                       
             MONMSG     MSGID(CPF0000 MCH0000) EXEC(GOTO CMDLBL(ERROR))
                                                                       
             CHGVAR     VAR(&FILE) VALUE(%SST(&QFILE 1 10))            
             CHGVAR     VAR(&LIB) VALUE(%SST(&QFILE 11 10))            
                                                                       
/* Check for QRCYCSRC in QRPLOBJ and create if necessary */            
                                                                       
             CHKOBJ     OBJ(QRPLOBJ/QRCYCSRC) OBJTYPE(*FILE)           
             MONMSG     MSGID(CPF0000) EXEC(DO)                        
                RCVMSG     MSGTYPE(*EXCP) RMV(*YES)                 
                QSYS/CRTSRCPF FILE(QRPLOBJ/QRCYCSRC) RCDLEN(112) +  
                              TEXT('Saved deleted source members')  
             ENDDO                                                  
                                                                    
/* Copy the source file member into QRPLOBJ/QRCYCSRC */             
                                                                    
             QSYS/CPYSRCF FROMFILE(&LIB/&FILE) +                    
                          TOFILE(QRPLOBJ/QRCYCSRC) FROMMBR(&MBR) +  
                          TOMBR(*FROMMBR) MBROPT(*REPLACE)          
             CHGVAR     VAR(&TEXT) VALUE(&LIB |< '/' || &FILE)      
             CHGPFM     FILE(QRPLOBJ/QRCYCSRC) MBR(&MBR) TEXT(&TEXT)
                                                                    
             GOTO       CMDLBL(ENDPGM)                              
                                                                    
 ERROR:      RCVMSG     MSGTYPE(*EXCP) RMV(*YES)                    
                                                                    
 ENDPGM:     RMVMSG     CLEAR(*ALL)                                 
             ENDPGM                                                 

========================================================================
=

HTH,

Rory

p.s. Credit where credit is due - I cribbed this from someone else a
long time ago, so I'd hesitate to take full (or indeed, any) credit for
it. I think it was posted to one of the forums several years ago.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.