The following sample program uses the MAILSPLF command:
****************************************************************************************
PGM

DCL VAR(&RTNSPOOL) TYPE(*CHAR) LEN(10)
DCL VAR(&RTNJOB) TYPE(*CHAR) LEN(10)
DCL VAR(&RTNUSER) TYPE(*CHAR) LEN(10)
DCL VAR(&RTNJNBR) TYPE(*CHAR) LEN(6)
DCL VAR(&RTNSPLNBR) TYPE(*CHAR) LEN(6)

/******************************************************/
/* RUN REPORT PROGRAM */
/******************************************************/
CALL PGM(RPT100)

/******************************************************/
/* RETRIEVE SPOOL FILE INFO FOR REPORT */
/******************************************************/
ERSNUM SPLF(RPT100P) JOB(*) SPLNBR(*LAST) +
RTNSPLF(&RTNSPOOL) RTNJOBNAME(&RTNJOB) +
RTNJOBUSER(&RTNUSER) RTNJOBNUM(&RTNJNBR) +
RTNSPLNUM(&RTNSPLNBR)

/******************************************************/
/* MAIL SELECTED REPORT */
/******************************************************/
MAILSPLF FILE(&RTNSPOOL) +
JOB(&RTNJNBR/&RTNUSER/&RTNJOB) +
SPLNBR(&RTNSPLNBR) +
TOADDRESS(test@test.com) +
FRADDRESS(admin@as400.com) +
SUBJECT('AS/400 Report') CONVTYPE(PDF) +
SMTPHOST(LOCALHOST)
ENDPGM 

****************************************************************************************

Still have questions? We can help. Submit a case to Technical Support.

Last Modified On: December 10, 2016