Home > Ask the AS/400 Experts > iSeries Backup and Recovery Questions & Answers > Sending a message to an output file after backup completion
Ask The iSeries 400 Expert: Questions & Answers
EMAIL THIS

Sending a message to an output file after backup completion

Ken Graap EXPERT RESPONSE FROM: Ken Graap

Pose a Question
Other iSeries 400 Categories
Meet all iSeries 400 Experts
Become an Expert for this site


iSeries news and advice
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


>
QUESTION POSED ON: 01 May 2008
How can you send a message to an output file from scheduled back-up -- after being successfully completed or otherwise?

>
EXPERT RESPONSE
I suggest that you create a special message queue for backup processes and send completion and/or error messages there instead of trying to write them to spool or to a physical file. It is much easier and just as functional

Use the CRTMSGQ command to create your Message Queue. For example, to create a message queue in library QGPL:

CRTMSGQ MSGQ(QGPL/BACKUPMSGS) 
      TEXT('Messages from Backup Processes') 
      SIZE(5 1 10) 
      MSGQFULL(*WRAP)                                                        
 

Use the SNDPGMMSG command to send messages to it.

Here is some example CLP code showing how to capture and resend error messages and a completion message, to a particular message queue:

             PGM                                                       
/* ************************************************************** */   
/*                                                                */   
/* DECLARE PROGRAM VARIABLES                                      */   
/*                                                                */   
/* ************************************************************** */   
             DCL        &ERRORSW *LGL                     /* Std err */
             DCL        &MSGID *CHAR LEN(7)               /* Std err */
             DCL        &MSGDTA *CHAR LEN(100)            /* Std err */
             DCL        &MSGF *CHAR LEN(10)               /* Std err */
             DCL        &MSGFLIB *CHAR LEN(10)            /* Std err */
/* ************************************************************** */   
/*                                                                */   
 /* GLOBAL MESSAGE MONITOR                                         */   
 /*                                                                */   
 /* ************************************************************** */   
              MONMSG     MSGID(CPF0000) EXEC(GOTO CMDLBL(STDERR1))      
 /* ************************************************************** */   
 /*                                                                */   
 /* PROGRAM LOGIC                                                  */ 
 /*                                                                */   
 /* ************************************************************** */ 
                                                                  
            /* your backup code would go here */

SNDPGMMSG  MSGID(CPF9898) MSGF(QCPFMSG) +           
MSGDTA('Backups have completed normally) + 
          TOMSGQ(QGPL/BACKUPMSGS) +    
          MSGTYPE(*COMP)                               
 /* ************************************************************** */ 
 /*                                                                */ 
 /* NORMAL END OF PROGRAM                                          */ 
 /*                                                                */ 
 /* ************************************************************** */ 
  END:        RETURN                                                  
 /* ************************************************************** */ 
 /*                                                                */ 
 /* STANDARD ERROR PROCESSING                                      */ 
 /*                                                                */ 
 /* ************************************************************** */ 
  STDERR1:               /* Standard error handling routine */        
    IF         &ERRORSW SNDPGMMSG MSGID(CPF9999) +          
    IF         &ERRORSW SNDPGMMSG MSGID(CPF9999) +            
                 MSGF(QCPFMSG) MSGTYPE(*ESCAPE) /* Func chk */
             CHGVAR     &ERRORSW '1' /* Set to fail ir error occurs */ 
 STDERR2:    RCVMSG     MSGTYPE(*DIAG) MSGDTA(&MSGDTA) MSGID(&MSGID) + 
                  MSGF(&MSGF) MSGFLIB(&MSGFLIB)                
   IF         (&MSGID *EQ '       ') GOTO STDERR3            
      SNDPGMMSG  MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) +           
                   MSGDTA(&MSGDTA) TOMSGQ(QGPL/BACKUPMSGS) +    
                   MSGTYPE(*INFO)                               
      SNDPGMMSG  MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) +           
                   MSGDTA(&MSGDTA) MSGTYPE(*DIAG)               
      GOTO       STDERR2 /* Loop back for addl diagnostics */   
 STDERR3:    RCVMSG     MSGTYPE(*EXCP) MSGDTA(&MSGDTA) MSGID(&MSGID) + 
                   MSGF(&MSGF) MSGFLIB(&MSGFLIB)                
        SNDPGMMSG  MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) +           
                   MSGDTA(&MSGDTA) TOMSGQ(QGPL/BACKUPMSGS) +    
                   MSGTYPE(*INFO)                               
        SNDPGMMSG  MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) +           
                   MSGDTA(&MSGDTA) MSGTYPE(*ESCAPE)             
     ENDPGM                                                    

To view these messages you would use the command: DSPMSG MSGQ(QGPL/BACKUPMSGS)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


RELATED CONTENT
iSeries Backup and Recovery
SAVF FTP on AS400 LAN: 504 Binary image transfer required for save files
ASP configuration restore
Automatic email for backup job log on AS/400
Decrease iSeries downtime caused by SAVSYS backup
Adding journal tapes to the BRMS media pool on AS/400
Killing option 21 backup midsave
Transferring data via FTP on AS/400 systems
Ensuring sufficient iSeries system backup for data protection
Finding initialization information for LTO tapes in AS/400
Saving a message from a user's message queue

Data backup, storage and retrieval on iSeries
SAVF FTP on AS400 LAN: 504 Binary image transfer required for save files
Automatic email for backup job log on AS/400
Decrease iSeries downtime caused by SAVSYS backup
Deleting iSeries audit logs
Adding journal tapes to the BRMS media pool on AS/400
Killing option 21 backup midsave
Ensuring sufficient iSeries system backup for data protection
Finding initialization information for LTO tapes in AS/400
Performing full AS/400 backups
Back up your System i over the holiday
Data backup, storage and retrieval on iSeries Research

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary



Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice

HomeNewsTopicsITKnowledge ExchangeTipsBlogsAsk the ExpertsMultimediaWhite PapersProducts
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 1999 - 2008, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts