Simple MAILSPLF CL Program Sample with basic error handling - Support

Simple MAILSPLF CL Program Sample with basic error handling

From Support

Jump to: navigation, search

Very Simple MAILSPLF sample that attempts to send a report via email. If the email fails (CPF9898), the job will send a message to QSYSOPR.

This is a nice way to notify users if a report doesn't get send correctly with MAILSPLF.

/***********************************************************/           
/* ATTEMPT TO SEND REPORT VIA MAILSPLF. IF ERRORS OCCUR,   */           
/* SEND A MESSAGE TO QSYSOPR.                              */           
/***********************************************************/           
             MAILSPLF   FILE(RPT100) JOB(*) +                           
                          TOADDRESS('SUPPORT@RJSSOFT.COM')              
             /* SEND ERROR MESSAGE IF MAILSPLF ERROR OCCURS */          
             MONMSG     MSGID(CPF9898) EXEC(DO)                         
             SNDMSG     MSG('Error occurred while emailing report to +  
                          email recipient') TOUSR(*SYSOPR)   
             ENDDO
Personal tools