| 
 | 
Hi Marvin
This is a CL that I use to automate data sends from programs, feel free to
adapt it:
             PGM        PARM(&EMAIL &FILE &LIB &PGM)
 
             DCL        VAR(&EMAIL)   TYPE(*CHAR) LEN(80)
             DCL        VAR(&WMAIL)   TYPE(*CHAR) LEN(82)
             DCL        VAR(&FILE)    TYPE(*CHAR) LEN(10)
             DCL        VAR(&LIB)     TYPE(*CHAR) LEN(10)
             DCL        VAR(&PGM)     TYPE(*CHAR) LEN(10)
             DCL        VAR(&DOC)     TYPE(*CHAR) LEN(12)
             DCL        VAR(&USER)    TYPE(*CHAR) LEN(10)
             DCL        VAR(&MSG)     TYPE(*CHAR) LEN(512)
             DCL        VAR(&MSGDTA)  TYPE(*CHAR) LEN(512)
             DCL        VAR(&CRLF)    TYPE(*CHAR) LEN(2) VALUE(X'0D25')
 
/* First, create a folder for the user to store the file in...
*/ 
 
             RTVJOBA    USER(&USER)
 
             CRTFLR     FLR(EMAIL) TEXT('Files for Emailing')
             MONMSG     MSGID(CPF8A18)
 
             CRTFLR     FLR(&USER) INFLR(EMAIL) TEXT('Temporary +
                          folder for emailing')
             MONMSG     MSGID(CPF8A18)
 
/* Next, copy the Database File to an Import (CSV) file...
*/
 
             CRTPF      FILE(QTEMP/STMF) RCDLEN(2048) SIZE(*NOMAX)
             MONMSG     MSGID(CPF7302)
 
             CPYTOIMPF  FROMFILE(&LIB/&FILE) TOFILE(QTEMP/STMF) +
                          MBROPT(*REPLACE) RCDDLM(*EOR)
 
/* And then copy it to the "newly" created folder...
*/
 
             CHGVAR     VAR(&DOC) VALUE(&PGM *TCAT '.CSV')
 
             CPYTOPCD   FROMFILE(QTEMP/STMF) TOFLR(&USER) +
                          TODOC(&DOC) REPLACE(*YES)
 
/* Now we should be in a position to email it using the SNDDST command...
*/
 
             CHGVAR     VAR(&MSGDTA) VALUE(&CRLF *CAT &DOC)
             RTVMSG     MSGID(MSG0001) MSGF(AUKMSGF) +
                          MSGDTA(&MSGDTA) SECLVL(&MSG)
 
             SNDDST     TYPE(*DOC) TOINTNET((&EMAIL)) DSTD('Download +
                          Request') MSG(&MSG) DOC(&DOC) FLR(&USER)
             MONMSG     MSGID(CPF0000)
 
             ENDPGM
I use a message file to hold the text I want to include in the body of the
email:
Message identifier . . . . . . . > MSG0001       Name
Message file . . . . . . . . . . > AUKMSGF       Name
  Library  . . . . . . . . . . . >   AUKGPL      Name, *LIBL, *CURLIB
First-level message text . . . .   'Download File Email Message (see 2nd
Level 
ext)'
 
Second-level message text  . . .   'Dear User,&1&1Please find attached the
download file &2 as requested.&1&1Regards,&1&1System Administrator.'
 
Severity code  . . . . . . . . .   0             0-99, *SAME
Message data fields formats:                                              
  Data type  . . . . . . . . . .   *CHAR         *SAME, *NONE, *QTDCHAR...
  Length . . . . . . . . . . . .   2             Number, *VARY            
  *VARY bytes or dec pos . . . .   0             Number                   
                                                                          
  Data type  . . . . . . . . . .   *CHAR         *QTDCHAR, *CHAR, *HEX... 
  Length . . . . . . . . . . . .   12            Number, *VARY            
  *VARY bytes or dec pos . . . .   0             Number                   
Hope it helps
Jonathan
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Marvin Radding
Sent: 25 August 2006 16:11
To: midrange-l@xxxxxxxxxxxx
Subject: Using SNDDST to email physical files
I am trying to email a flat file from the AS/400. When it successfully
emails the file, it contains garbage.  I can't seem to get it right.  Does
anyone have any utilities or service programs that can assist in this?
Marvin
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.