Reputation: 11
How to write JCL to send an email but the content(Data) should be picked from another PDS/member. If anyone can let me know the JCL for what I need will be helpful.**
Upvotes: 0
Views: 10156
Reputation: 1
Concatenation works fine if all source data has the same DCB. If not, use SORT to create a temporary VB file with LRECL = your longest LRECL + 4. E.g., if you need to merge 80-byte PDS data with 133-byte reports, use SORT to copy everything to a VB file with LRECL=137 and send that to the sysout.
If anyone is still reading, I'd like to find out how to set up a BCC: recipient. Apparently, only TO: and CC: are supported.
Sample JCL for building the VB file:
000007 //BUILD PROC
000008 //SORT EXEC PGM=SORT
000009 //SORTOUT DD DISP=(MOD,PASS),DSN=&&EMAIL,UNIT=SYSDA,
000010 // SPACE=(CYL,(1,1)),DCB=(RECFM=VB,LRECL=430,BLKSIZE=27998)
000011 //*
000012 //SYSIN DD *
000013 OPTION COPY
000014 OUTFIL FNAMES=SORTOUT,FTOV
000015 //SORTWK01 DD SPACE=(CYL,(5,5),RLSE),UNIT=SYSDA
000016 //SORTWK02 DD SPACE=(CYL,(5,5),RLSE),UNIT=SYSDA
000017 //SORTWK03 DD SPACE=(CYL,(5,5),RLSE),UNIT=SYSDA
000018 //SORTWK04 DD SPACE=(CYL,(5,5),RLSE),UNIT=SYSDA
000019 //SORTWK05 DD SPACE=(CYL,(5,5),RLSE),UNIT=SYSDA
000020 //SYSPRINT DD SYSOUT=*
000021 //SORTMSG DD SYSOUT=*
000022 //SYSDBOUT DD SYSOUT=*
000023 //SYSUDUMP DD SYSOUT=*
000024 //SYSOUT DD SYSOUT=*
000025 //*
000026 // PEND
000027 //*
000028 //HEADER EXEC BUILD --------------------------------------------
000029 //SORT.SORTOUT DD DISP=(,PASS)
000030 //SORT.SORTIN DD *
000031 HELO MVSOSA.CAPITALONE.COM
000032 MAIL FROM:<{from address}>
000033 RCPT TO:<{to address}>
000034 DATA
000035 FROM: <{from address}>
000036 TO:<{to address>
000037 SUBJECT: {subject}
000038 MIME-Version: 1.0
000039 Content-type: multipart/mixed; boundary="=_boundary"
000040
000041 These comments don't show up in the email.
000042
000043 Note: After each boundary, one or more records describes the
000044 content that follows. After the last "Content-..." record
000045 in each section, be sure to have a blank line.
000046
000047
000049
000050 See also https://www.ibm.com/support/pages/
000051 outbound-email-attachments-using-smtp-or-cssmtp-zos
000052
000053 --=_boundary
000054 Content-Type: text/plain;
000055
000056 Good day.
000057 Please find attached the reports you wanted.
000058
000059 Regards -- Me
000060
000061 --=_boundary
000062 Content-Type: application;
000063 Content-Disposition: attachment; filename={report name}.txt
000064 Content-Transfer-Encoding: 8bit;
000065
000066 /*
000067 //STATRPT EXEC BUILD
000068 //SORT.SORTIN DD DISP=SHR,DSN={file name with report}
000069 //*
000070 //*
000071 //*-------------------------------------------------------------*
000072 //EMAILSTP EXEC PGM=IEBGENER
000073 //SYSPRINT DD SYSOUT=*
000074 //SYSIN DD DUMMY
000075 //SYSUT2 DD SYSOUT=(B,SMTP)
000076 //SYSUT1 DD DISP=(OLD,PASS),DSN=&&EMAIL
000077 //*
000078 //*==============================================================
000079 //*
Upvotes: 0
Reputation: 3761
Here is an old example but it sounds like what you are looking for. It uses IEBGENER to send an e-mail. (I didn't write the content so complain to IBM if you don't like it.)
//BATSMTP JOB (userid,nn),MSGCLASS=B,PRTY=12,MSGLEVEL=(2,1)
//*
//* Store message in a PDS
//*
//PUTMSG EXEC PGM=IEBGENER
//SYSIN DD DUMMY
//SYSUT1 DD *
HELO YOURMVS
MAIL FROM:<CAROL@YOURMVS>
RCPT TO:<[email protected]>
RCPT TO:<[email protected]>
DATA
Date: Thur, 26 Mar 92 21:48:57 EST
From: Carol <CAROL@YOURMVS>
To: <[email protected]>
Cc: <[email protected]> Subject: update
Mike: Cindy stubbed her toe. Bobby went to
baseball camp. Marsha made the cheerleading team.
Jan got glasses. Peter has an identity crisis.
Greg made dates with 3 girls and couldn't
remember their names.
.
QUIT
/*
//SYSUT2 DD DSN=MYPDS.OF.MESSAGES(MSGID1),DISP=SHR
//*
//SYSPRINT DD SYSOUT=A
//*
//* Send Message from placed in PDS in prior step
//*
//SENDMSG EXEC PGM=IEBGENER
//SYSIN DD DUMMY
//SYSUT1 DD DSN=MYPDS.OF.MESSAGES(MSGID1),DISP=SHR
//*
//SYSUT2 DD SYSOUT=(B,smtp)
//* | v
//* v SMTP address space name for external writer
//* SYSOUT class
//SYSPRINT DD SYSOUT=A
Upvotes: 3
Reputation: 293
Concatenate your PDS member with your other stuff in SYSUT1 e.g.
//SYSUT1 DD *
your stuff here
// DD DSM=your.pds(member),DISP=SHR
`You may need other stuff after your member - just concatenate more DD *. Remember that your PDS data must be LRECL=80
Upvotes: 2