Thanks for your help.
I will update you later.
/* Send dataset as an attachment via SMTP MIME */
recipient = 'someuser@somewhere.com'
jes_node = 'jes_node_name_to_get_to_smtp'
subj = 'Subject Line Here'
msg_body = 'Message Body Here'
full_dsdata_name = 'MAINFRAME_DATA_SET_NAME_HERE'
file_att = full_dsdata_name
SMTP.1 = "HELO "jes_node
SMTP.2 = "MAIL FROM:<somehost@someplace.com>"
SMTP.3 = "RCPT TO:<"recipient">"
SMTP.4 = "DATA"
SMTP.5 = "Date: "date(w) date(m) day year time()
SMTP.6 = "From: HOST <somehost@someplace.com>"
SMTP.7 = "To: <"recipient">"
SMTP.8 = "Subject: "subj
SMTP.9 = "MIME-VERSION: 1.0"
SMTP.10 = "CONTENT-TYPE: MULTIPART/MIXED; BOUNDARY=""SIMPLE BOUNDARY"""
SMTP.11 = "--SIMPLE BOUNDARY"
SMTP.12 = "CONTENT-TYPE: TEXT/PLAIN"
SMTP.13 = " "
SMTP.14 = "Do not reply to this email"
SMTP.15 = " "
SMTP.16 = msg_body
SMTP.17 = "--SIMPLE BOUNDARY"
SMTP.18 = "CONTENT-DISPOSITION: ATTACHMENT; FILENAME="file_att".txt"
SMTP.19 = "CONTENT-TYPE: TEXT/PLAIN"
SMTP.20 = " "
Address "OPSDYNAM"
"allocate fi(input) dataset('"full_dsdata_name"') shr"
say "File" full_dsdata_name "allocated."
Address "TSO"
"execio * diskr input (finis"
/* Next line must equal the last hardcoded SMTP.XX number, adding 1 */
n = 21 /* This portion and below DO are needed to get this to work - SMTP.n is the line read from the file */
do while queued() > 0
parse pull mychain
SMTP.n = mychain
n = n + 1
end
SMTP.n = "."
n = n + 1
SMTP.n = "QUIT"
Address "OPSDYNAM"
"free f(input)"
Address "TSO"
"alloc f(smtpout) sysout(a) writer(cssmtp)" /* SMTP or CSSMTP */
say "CSSMTP writer Allocation Return Code:" rc
say "Allocated" SMTPOUT
Address "TSO"
"execio * diskw smtpout (STEM SMTP. FINIS"
say "EXECIO of SMTPOUT TO SMTP WRITER RETURN CODE:" rc
Address "OPSDYNAM"
"free f(smtpout)"
if rc = 0 then do
say "File" full_dsdata_name "sent to SMTP for attachment",
"processing."
end
/* End of send email attachment routine */