I found something that sends a spool file to an e-mail addr using SNDDST. When it does the SNDDST, I get a CPC9033 that says "Send distribution completed successfully." However, I don't receive the e-mail.
The basic things it does are:
1) cpysplf to a file in qtemp
2) cpytopcd
3) snddst
I hesitate to post the source because it's so huge. Hopefully this isn't information overkill. TIA for any help anyone can give me.
This is a program called "X" on my system so I don't have to keep typing in this info over and over. (I just type in "call x")
Command SPLF2EML:
SPLF2EMLC -- CPP for SPLF2EML:
There are 3 commands in the CPP: RTVSPLFAST, MOVDIAGMSG & RSNESCMSG
RTVSPLFAST:
MOVDIAGMSG:
RSNESCMSG:
The basic things it does are:
1) cpysplf to a file in qtemp
2) cpytopcd
3) snddst
I hesitate to post the source because it's so huge. Hopefully this isn't information overkill. TIA for any help anyone can give me.

This is a program called "X" on my system so I don't have to keep typing in this info over and over. (I just type in "call x")
Code:
SPLF2EML JOB(226212/QSECOFR/FVLDSP03) + SPLFNAM(PRINTERA) SPLFNBR(1) + ??TOINTNET(USER@SOMETHING.COM) + MSG('See attached.')
Command SPLF2EML:
Code:
/* CRTCMD CMD(mylib/SPLF2EML) + */ /* PGM(*LIBL/SPLF2EMLC) + */ /* SRCFILE(mylib/mysrcf) + */ /* SRCMBR(SPLF2EML) + */ /* TEXT('Spoolfile to e-mail') */ CMD PROMPT('Create splf/email attachment') PARM KWD(JOB) TYPE(Q00BF) SNGVAL( (* )) MIN(1) PROMPT('Qualified job name') Q00BF: QUAL TYPE(*NAME) LEN(10) MIN(1) QUAL TYPE(*NAME) LEN(10) PROMPT('Job user') QUAL TYPE(*CHAR) LEN(6) RANGE( '000000' '999999') PROMPT('Job number') PARM KWD(SPLFNAM) TYPE(*NAME) LEN(10) MIN(1) PROMPT('*SPLF name') PARM KWD(SPLFNBR) TYPE(*INT4) DFT(*LAST) RANGE( -1 9999) SPCVAL( (*ONLY 0) + (*LAST -1)) PROMPT('*SPLF number') PARM KWD(TOINTNET) TYPE(*CHAR) LEN(253) EXPR(*YES) CHOICE(*NONE) + PROMPT('Internet Recipient') PARM KWD(MSG) TYPE(*CHAR) LEN(256) DFT('See attached.') EXPR(*YES) + PROMPT('Message') DEP CTL(*ALWAYS) PARM( (TOINTNET))
Code:
/* */ /* SPLF2EML: A basic means of e-mailing AS/400 spoolfiles... */ /* */ SPLF2EML: PGM PARM(&PQJOB &PSPLFNAM &PSPLFNBR &PINTNETADR &PMSG) DCL VAR(&PQJOB) TYPE(*CHAR) LEN(26) /* Qualified job name... */ DCL VAR(&PSPLFNAM) TYPE(*CHAR) LEN(10) /* Spoolfile name... */ DCL VAR(&PSPLFNBR) TYPE(*CHAR) LEN(4) /* Spoolfile number... */ DCL VAR(&PINTNETADR) TYPE(*CHAR) LEN(253) /* Recipient internet address... + */ DCL VAR(&PMSG) TYPE(*CHAR) LEN(256) /* An additional message to go with + the spoolfile... */ /* */ /* Spoolfile name and number... */ /* */ DCL VAR(&SPLFNAM) TYPE(*CHAR) LEN(10) DCL VAR(&SPLFNBR) TYPE(*DEC) LEN(5) /* Spoolfile number: *CHAR... */ DCL VAR(&SPLFNBR_C) TYPE(*CHAR) LEN(5) /* Recipient internet address... */ DCL VAR(&INTNETADR) TYPE(*CHAR) LEN(253) /* A message to go with the spoolfile... */ DCL VAR(&MSG) TYPE(*CHAR) LEN(256) /* */ /* Break out the qualified job name... */ /* */ DCL VAR(&JOB) TYPE(*CHAR) LEN(10) DCL VAR(&JOBUSER) TYPE(*CHAR) LEN(10) DCL VAR(&JOBNBR) TYPE(*CHAR) LEN(6) /* */ /* Spoolfile attributes, used to find spoolfile record length... */ /* */ DCL VAR(&SPLFA) TYPE(*CHAR) LEN(1142) /* Used for spoolfile record length... */ DCL VAR(&RLEN) TYPE(*DEC) LEN(9) /* */ /* Temporary workfile and folder names... */ /* */ DCL VAR(&SPLFPF) TYPE(*CHAR) LEN(10) VALUE(#$SPLFPF) DCL VAR(&SPLFFLR) TYPE(*CHAR) LEN(12) VALUE(#$SPLF.FLR) /* Working document name... */ DCL VAR(&DOCNAM) TYPE(*CHAR) LEN(12) /*---------------------------------------------------------------------------*/ /* */ /* Global monitor message... */ /* */ MONMSG MSGID(CPF0000 CPF9999 MCH0000) EXEC(GOTO CMDLBL(STDERR)) /*---------------------------------------------------------------------------*/ /* */ /* Get parameter values into working fields... */ /* */ CHGVAR VAR(&JOB) VALUE(%SST(&PQJOB 1 10)) CHGVAR VAR(&JOBUSER) VALUE(%SST(&PQJOB 11 10)) CHGVAR VAR(&JOBNBR) VALUE(%SST(&PQJOB 21 6)) CHGVAR VAR(&INTNETADR) VALUE(&PINTNETADR) CHGVAR VAR(&MSG) VALUE(&PMSG) CHGVAR VAR(&SPLFNAM) VALUE(&PSPLFNAM) CHGVAR VAR(&SPLFNBR) VALUE(%BIN(&PSPLFNBR)) /* */ /* Convert special-values for *ONLY and *LAST... */ /* */ IF COND(&SPLFNBR *EQ 0) THEN(DO) CHGVAR VAR(&SPLFNBR_C) VALUE('*ONLY') ENDDO ELSE CMD(IF COND(&SPLFNBR *EQ -1) THEN(DO)) CHGVAR VAR(&SPLFNBR_C) VALUE('*LAST') ENDDO ELSE CMD(DO) CHGVAR VAR(&SPLFNBR_C) VALUE(&SPLFNBR) ENDDO /* */ /* Get Spoolfile Attributes structure for the specified spoolfile name and */ /* number and job name. Note that job name '*' can't be broken out into */ /* its qualified parts (unless we retrieve the current job's name first)...*/ /* */ IF COND(&PQJOB *EQ '*') THEN(DO) RTVSPLFAST SPLFA(&SPLFA) JOB(*) SPLFNAM(&SPLFNAM) SPLFNBR(&SPLFNBR) ENDDO ELSE CMD(DO) RTVSPLFAST SPLFA(&SPLFA) JOB(&JOBNBR/&JOBUSER/&JOB) SPLFNAM(&SPLFNAM) + SPLFNBR(&SPLFNBR) ENDDO /* Extract the spoolfile record length... */ CHGVAR VAR(&RLEN) VALUE(%BIN(&SPLFA 429 4) + 1) /* */ /* Delete any temporary workfile we might've created earlier... */ /* */ DLTF FILE(QTEMP/&SPLFPF) MONMSG MSGID(CPF2105) /* Create a workfile appropriate to our current spoolfile... */ CRTPF FILE(QTEMP/&SPLFPF) RCDLEN(&RLEN) /* */ /* Copy our current spoolfile into our temporary workfile. Note that we use */ /* *FCFC for forms control. Note that job name '*' can't be broken out into*/ /* its qualified parts (unless we retrieve the current job's name first)...*/ /* */ IF COND(&PQJOB *EQ '*') THEN(DO) CPYSPLF FILE(&SPLFNAM) TOFILE(QTEMP/&SPLFPF) SPLNBR(&SPLFNBR_C) + CTLCHAR(*FCFC) ENDDO ELSE CMD(DO) CPYSPLF FILE(&SPLFNAM) TOFILE(QTEMP/&SPLFPF) JOB(&JOBNBR/&JOBUSER/&JOB) + SPLNBR(&SPLFNBR_C) CTLCHAR(*FCFC) ENDDO /* */ /* Delete any temporary work folder we might've created earlier... */ /* */ DLTDLO DLO(&SPLFFLR) MONMSG MSGID(CPF8A16) /* Create a work folder for our spoolfile document... */ CRTFLR FLR(&SPLFFLR) MONMSG MSGID(CPF8A18) /* Create a document name based on spoolfile name... */ CHGVAR VAR(&DOCNAM) VALUE(%SST(&SPLFNAM 1 8) *TCAT '.TXT') /* */ /* Get our spoolfile from our workfile into our work document... */ /* */ CPYTOPCD FROMFILE(QTEMP/&SPLFPF) TOFLR(&SPLFFLR) TODOC(&DOCNAM) REPLACE(*YES) SNDDST TYPE(*DOC) TOINTNET((&INTNETADR)) DSTD('AS/400 report') MSG(&MSG) + DOC(&DOCNAM) FLR(&SPLFFLR) /* */ /* General cleanup before exit... */ /* */ DLTF FILE(QTEMP/&SPLFPF) DLTDLO DLO(&DOCNAM) FLR(&SPLFFLR) DLTDLO DLO(&SPLFFLR) RETURN /* */ /* Standard error processing... */ /* */ STDERR: MOVDIAGMSG MONMSG MSGID(CPF0000 MCH0000) RSNESCMSG MONMSG MSGID(CPF0000 MCH0000) RETURN ENDPGM
There are 3 commands in the CPP: RTVSPLFAST, MOVDIAGMSG & RSNESCMSG
RTVSPLFAST:
Code:
/* CRTCMD CMD(mylib/RTVSPLFAST) + */ /* PGM(QSYS/QUSRSPLA) + */ /* SRCFILE(mylib/mysrcf) + */ /* SRCMBR(RTVSPLFAST) + */ /* TEXT('Retrieve Spool File Attribute Struture */ /* ALLOW( + */ /* *IREXX + */ /* *BREXX + */ /* *BPGM + */ /* *IPGM) */ CMD PROMPT('Retrieve *splf attr struct') PARM KWD(SPLFA) TYPE(*CHAR) LEN(1142) RTNVAL(*YES) MIN(1) + PROMPT('Attributes structure') PARM KWD(STRUCLEN) TYPE(*INT4) CONSTANT(1142) MIN(1) PARM KWD(FORMATNAM) TYPE(*NAME) LEN(8) CONSTANT(SPLA0100) MIN(1) PARM KWD(JOB) TYPE(Q0161) SNGVAL( (* )) MIN(1) PROMPT('Qualified job name') Q0161: QUAL TYPE(*NAME) LEN(10) MIN(1) EXPR(*YES) QUAL TYPE(*NAME) LEN(10) EXPR(*YES) PROMPT('Job user') QUAL TYPE(*CHAR) LEN(6) RANGE( '000000' '999999') EXPR(*YES) PROMPT('Job + number') PARM KWD(INTJOBID) TYPE(*CHAR) LEN(16) CONSTANT(' ') MIN(1) PARM KWD(INTSPLFID) TYPE(*CHAR) LEN(16) CONSTANT(' ') MIN(1) PARM KWD(SPLFNAM) TYPE(*NAME) LEN(10) MIN(1) EXPR(*YES) PROMPT('*SPLF name') PARM KWD(SPLFNBR) TYPE(*INT4) DFT(*LAST) RANGE( -1 9999) SPCVAL( (*ONLY 0) + (*LAST -1)) EXPR(*YES) PROMPT('*SPLF number')
Code:
/* CRTCMD CMD(mylib/MOVDIAGMSG) + */ /* PGM(QSYS/QMHMOVPM) + */ /* SRCFILE(mylib/mysrc) + */ /* SRCMBR(MOVDIAGMSG) + */ /* ALLOW( + */ /* *IREXX + */ /* *BREXX + */ /* *BPGM + */ /* *IPGM) */ CMD PROMPT('Move Diagnostic Message') PARM KWD(MSGKEY) TYPE(*CHAR) LEN(4) CONSTANT(' ') PARM KWD(MSGTYP) TYPE(*CHAR) LEN(10) CONSTANT(*DIAG) PARM KWD(NBRTYPS) TYPE(*INT4) CONSTANT(1) PARM KWD(MSGQ) TYPE(*CHAR) LEN(10) CONSTANT(*) PARM KWD(STCKCNT) TYPE(*INT4) CONSTANT(1) PARM KWD(ERRCOD) TYPE(*INT4) CONSTANT(0)
Code:
/* CRTCMD CMD(mylib/RSNESCMSG) + */ /* PGM(QSYS/QMHRSNEM) + */ /* SRCFILE(mylib/mysrc) + */ /* SRCMBR(RSNESCMSG) */ CMD PROMPT('Resend Escape Message') PARM KWD(MSGKEY) TYPE(*CHAR) LEN(4) CONSTANT(' ') PARM KWD(ERRCOD) TYPE(*INT4) CONSTANT(0)
Comment