Sending an Email from JCL with attachment
Moderators: Frank Yaeger, DikDude, Moderator Group
-
- Member
- Posts: 1
- Joined: Sat Oct 02, 2010 1:56 am
how to attach a pdf in JCL
Hi,
I have used TXT2PDF function to create PDF encoded member in a PDS.
Now I am trying to send that PDS member as an attachment of type PDF file inside a JCL which uses IEBGENER.
The email is being sent correctly but the IEBGENER does not includes all the complete encoded file and hence which the email comes with attahment, the adobe is unable to decode or read the file and gives an error.
Can anybody please help or suggest an alternative program which used instead of IEBGENER.
Below is my JCL.
--------------------------------------------------------------------------------
//APSSLD1A JOB (PSSBTT,PSS),'ID',
// NOTIFY=APSSSS2,MSGLEVEL=(1,1),REGION=0M,MSGCLASS=C
/*NOTIFY APSSLD1 *** ADDED BY SUBMIT EXIT ***
//NORMRC EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DISP=SHR,DSN=XPSS01.SUMIT.TEMP(DEST1)
// DD DISP=SHR,DSN=XPSS01.SUMIT.TEMP(DEST2)
// DD DISP=SHR,DSN=XPSS01.SUMIT.TEMP(DEST3)
//SYSUT2 DD SYSOUT=(B,SMTP)
//SYSIN DD DUMMY
//*
---------------------------------------------------------------------------------
Member DEST 1 - this containes the details on where the email should be delivered
HELO JOBTRAC
MAIL FROM:<abc@abc.com>
RCPT TO:<abc@abc.com>
DATA
FROM: SUMIT
TO:SUMIT
SUBJECT: AUTOMATED EMAIL
MIME-VERSION: 1.0
CONTENT-TYPE: MULTIPART/MIXED; BOUNDARY="SIMPLE"
--SIMPLE
CONTENT-TYPE: TEXT/PLAIN; CHARSET="ISO-8859-1"
CONTENT-TRANSFER-ENCODING: BINARY
THIS IS TEST EMAIL FROM SUMIT
--SIMPLE
CONTENT-TYPE: APPLICATION/PDF;NAME="XYZZ.PDF"
CONTENT-TRANSFER-ENCODING: BINARY
CONTENT-DESCRIPTION: TRAVEL COSTING ONLINE REPORT
CONTENT-DISPOSITION: ATTACHMENT; "XYZZ.PDF"
--------------------------------------------------------------------------------
Dest 2 contains the encoded format for PDF
&àã
?¦
äÊÁ/ÈÑ?>à/ÈÁ à
&Ê?ÀÍÄÁÊ èìè &àã Â` (å( ?à í>ÑÎ åÁ?ÊÅÑ/
èÑÈ%Á í+.+|ï+
Á>À?¦
?¦
è`øÁ ã?>È
ëÍÂÈ`øÁ è`øÁ
á>Ä?ÀÑ>Å ëÈ/>À/ÊÀá>Ä?ÀÑ>Å
â/ËÁã?>È ä?ÍÊÑÁÊ â?%À
Á>À?¦
?¦
---------------------------------------------------------------------------
Dest 3 - contains the end qualifier
--simple--
--simle--
---------------------------------------------------------------------------
Now the problem is which I submit this JCL it does not reads the encoded file DEST2 correctly, below is what it interprets.
&
? ¦
/ ?> /
& ? & ` ( ( ? > ? /
% +.+| +
> ? ¦
? ¦
-----------------------------------------------------------------------------
As you see some of the encoded characters it is unable incorporate in the JCL
Any suggestions/comments will really appreciated.
Thanks.
Sumit
I have used TXT2PDF function to create PDF encoded member in a PDS.
Now I am trying to send that PDS member as an attachment of type PDF file inside a JCL which uses IEBGENER.
The email is being sent correctly but the IEBGENER does not includes all the complete encoded file and hence which the email comes with attahment, the adobe is unable to decode or read the file and gives an error.
Can anybody please help or suggest an alternative program which used instead of IEBGENER.
Below is my JCL.
--------------------------------------------------------------------------------
//APSSLD1A JOB (PSSBTT,PSS),'ID',
// NOTIFY=APSSSS2,MSGLEVEL=(1,1),REGION=0M,MSGCLASS=C
/*NOTIFY APSSLD1 *** ADDED BY SUBMIT EXIT ***
//NORMRC EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DISP=SHR,DSN=XPSS01.SUMIT.TEMP(DEST1)
// DD DISP=SHR,DSN=XPSS01.SUMIT.TEMP(DEST2)
// DD DISP=SHR,DSN=XPSS01.SUMIT.TEMP(DEST3)
//SYSUT2 DD SYSOUT=(B,SMTP)
//SYSIN DD DUMMY
//*
---------------------------------------------------------------------------------
Member DEST 1 - this containes the details on where the email should be delivered
HELO JOBTRAC
MAIL FROM:<abc@abc.com>
RCPT TO:<abc@abc.com>
DATA
FROM: SUMIT
TO:SUMIT
SUBJECT: AUTOMATED EMAIL
MIME-VERSION: 1.0
CONTENT-TYPE: MULTIPART/MIXED; BOUNDARY="SIMPLE"
--SIMPLE
CONTENT-TYPE: TEXT/PLAIN; CHARSET="ISO-8859-1"
CONTENT-TRANSFER-ENCODING: BINARY
THIS IS TEST EMAIL FROM SUMIT
--SIMPLE
CONTENT-TYPE: APPLICATION/PDF;NAME="XYZZ.PDF"
CONTENT-TRANSFER-ENCODING: BINARY
CONTENT-DESCRIPTION: TRAVEL COSTING ONLINE REPORT
CONTENT-DISPOSITION: ATTACHMENT; "XYZZ.PDF"
--------------------------------------------------------------------------------
Dest 2 contains the encoded format for PDF
&àã
?¦
äÊÁ/ÈÑ?>à/ÈÁ à
&Ê?ÀÍÄÁÊ èìè &àã Â` (å( ?à í>ÑÎ åÁ?ÊÅÑ/
èÑÈ%Á í+.+|ï+
Á>À?¦
?¦
è`øÁ ã?>È
ëÍÂÈ`øÁ è`øÁ
á>Ä?ÀÑ>Å ëÈ/>À/ÊÀá>Ä?ÀÑ>Å
â/ËÁã?>È ä?ÍÊÑÁÊ â?%À
Á>À?¦
?¦
---------------------------------------------------------------------------
Dest 3 - contains the end qualifier
--simple--
--simle--
---------------------------------------------------------------------------
Now the problem is which I submit this JCL it does not reads the encoded file DEST2 correctly, below is what it interprets.
&
? ¦
/ ?> /
& ? & ` ( ( ? > ? /
% +.+| +
> ? ¦
? ¦
-----------------------------------------------------------------------------
As you see some of the encoded characters it is unable incorporate in the JCL
Any suggestions/comments will really appreciated.
Thanks.
Sumit
Re: sending an email from jcl with IEBGENER with attachment.
Natarajan wrote:Try following code.
Code: Select all
//SENDMAIL JOB (XXX,YYY), // 'MAIL FILE ', // MSGCLASS=T, // CLASS=S //* //STEP01 EXEC PGM=IEBGENER //SYSIN DD DUMMY //SYSPRINT DD SYSOUT=* //SYSUT2 DD SYSOUT=(M,SMTP) //SYSUT1 DD DISP=SHR, // DSN=DEV.XXXX.TEST.FILE // DD DISP=SHR, // DSN=DEV.XXXX.TEST.FILE2(0) //*
Contents of the file DEV.XXXX.TEST.FILE :
helo JOBTRAC
MAIL FROM:<Natarajan@gmail.com>
rcpt to:<Natarajan@gmail.com>
data
FROM: xxxxx
TO: Natarajan@gmail.com
SUBJECT: test mail
Mime-Version: 1.0
Content-Type: text/plain; name="XYZZ.txt"
Content-Disposition: attachment; filename="XYZZ.txt"
DEV.XXXX.TEST.FILE2(0) is the file which should be send as attachment
Both files DCB?s should match.
Let me know, if you face any problems with this JCL
if we use the above method we are getting the following errors..............can u please help on this
Unable to deliver mail to some/all recipients.
050 DATA 00000400
501 Syntax Error. No Args after 'DATA' command
050 FROM: SANDEEP.SANDEEP.R@AEXP.COM 00000500
500 Unknown command, 'FROM'
050 TO: KALYAN.C.MUNUKOTI@AEXP.COM 00000600
500 Unknown command, 'TO'
050 SUBJECT: TEST MAIL 00000700
500 Unknown command, 'SUBJECT'
050 MIME-VERSION: 1.0 00000800
500 Unknown command, 'MIME'
050 CONTENT-TYPE: MULTIPART/MIXED; 00000900
500 Unknown command, 'CONTENT'
050 BOUNDARY="SIMPLE BOUNDARY" 00001000
500 Unknown command, 'BOUNDARY'
050 DATA 00000400 <=== You have numbers in your data ...
050 FROM: SANDEEP.SANDEEP.R@AEXP.COM 00000500 <===
050 FROM: SANDEEP.SANDEEP.R@AEXP.COM 00000500 <===
//SENDMAIL JOB (XXX,YYY),
// CLASS=9,MSGCLASS=Y,
// MSGLEVEL=(1,1),REGION=0K
//*
//STEP01 EXEC PGM=IEBGENER
//SYSIN DD DUMMY
//SYSPRINT DD SYSOUT=*
//SYSUT2 DD SYSOUT=(M,SMTP)
//SYSUT1 DD DISP=SHR,
// DSN= ARARJ1.JCLLIB.SENDMAIL.TEST(FILE1)
// DD DISP=SHR,
// DSN= ARARJ1.JCLLIB.SENDMAIL.TEST(INPUT)
//*
Hi,
Am new to mainframe i used above query to send mail... but am getting jcl error message like
STMT NO. MESSAGE
6 IEFC621I EXPECTED CONTINUATION NOT RECEIVED
7 IEFC605I UNIDENTIFIED OPERATION FIELD
8 IEFC621I EXPECTED CONTINUATION NOT RECEIVED
9 IEFC605I UNIDENTIFIED OPERATION FIELD
Plz clarify..
Regards,
Aravindan
// CLASS=9,MSGCLASS=Y,
// MSGLEVEL=(1,1),REGION=0K
//*
//STEP01 EXEC PGM=IEBGENER
//SYSIN DD DUMMY
//SYSPRINT DD SYSOUT=*
//SYSUT2 DD SYSOUT=(M,SMTP)
//SYSUT1 DD DISP=SHR,
// DSN= ARARJ1.JCLLIB.SENDMAIL.TEST(FILE1)
// DD DISP=SHR,
// DSN= ARARJ1.JCLLIB.SENDMAIL.TEST(INPUT)
//*
Hi,
Am new to mainframe i used above query to send mail... but am getting jcl error message like
STMT NO. MESSAGE
6 IEFC621I EXPECTED CONTINUATION NOT RECEIVED
7 IEFC605I UNIDENTIFIED OPERATION FIELD
8 IEFC621I EXPECTED CONTINUATION NOT RECEIVED
9 IEFC605I UNIDENTIFIED OPERATION FIELD
Plz clarify..
Regards,
Aravindan
[quote="Aravindan"]//SENDMAIL JOB (XXX,YYY),
// CLASS=9,MSGCLASS=Y,
// MSGLEVEL=(1,1),REGION=0K
//*
//STEP01 EXEC PGM=IEBGENER
//SYSIN DD DUMMY
//SYSPRINT DD SYSOUT=*
//SYSUT2 DD SYSOUT=(M,SMTP)
//SYSUT1 DD DISP=SHR,
// DSN= ARARJ1.JCLLIB.SENDMAIL.TEST(FILE1)
// DD DISP=SHR,
// DSN= ARARJ1.JCLLIB.SENDMAIL.TEST(INPUT)
//*
Hi,
Am new to mainframe i used above query to send mail... but am getting jcl error message like
STMT NO. MESSAGE
6 IEFC621I EXPECTED CONTINUATION NOT RECEIVED
7 IEFC605I UNIDENTIFIED OPERATION FIELD
8 IEFC621I EXPECTED CONTINUATION NOT RECEIVED
9 IEFC605I UNIDENTIFIED OPERATION FIELD
Plz clarify..
Regards,
Aravindan[/quote]
Hi i have solved this problem and thats because i have not specified job name properly..
But after the job run am not receiving the mail..
// CLASS=9,MSGCLASS=Y,
// MSGLEVEL=(1,1),REGION=0K
//*
//STEP01 EXEC PGM=IEBGENER
//SYSIN DD DUMMY
//SYSPRINT DD SYSOUT=*
//SYSUT2 DD SYSOUT=(M,SMTP)
//SYSUT1 DD DISP=SHR,
// DSN= ARARJ1.JCLLIB.SENDMAIL.TEST(FILE1)
// DD DISP=SHR,
// DSN= ARARJ1.JCLLIB.SENDMAIL.TEST(INPUT)
//*
Hi,
Am new to mainframe i used above query to send mail... but am getting jcl error message like
STMT NO. MESSAGE
6 IEFC621I EXPECTED CONTINUATION NOT RECEIVED
7 IEFC605I UNIDENTIFIED OPERATION FIELD
8 IEFC621I EXPECTED CONTINUATION NOT RECEIVED
9 IEFC605I UNIDENTIFIED OPERATION FIELD
Plz clarify..
Regards,
Aravindan[/quote]
Hi i have solved this problem and thats because i have not specified job name properly..
But after the job run am not receiving the mail..
-
- Member
- Posts: 1
- Joined: Wed Feb 10, 2016 8:12 pm
from SMTP Email - body with an attachment question
http://ibm mainframes .com/about 55814.html
//SENDMAIL EXEC PGM=IEBGENER
//SYSIN DD DUMMY
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD *
HELO MAINFRAME
MAIL FROM: <TESTUSER1@TEST.COM>
RCPT TO: <TESTUSER2@TEST.COM>
DATA
FROM: <TESTUSER1@TEST.COM>
TO: <TESTUSER2@TEST.COM>
SUBJECT: This is a test mail
CONTENT-TYPE: MULTIPART/MIXED; BOUNDARY="SIMPLE BOUNDARY"
--SIMPLE BOUNDARY
Hello
Please check the attached file.
Bye.
--SIMPLE BOUNDARY
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=Attachment.txt
// DD DISP=SHR,DSN=AttachedMainframeDataset
// DD *
.
QUIT
/*
//SYSUT2 DD SYSOUT=(B,SMTPStartedtaskName)
//SYSOUT DD SYSOUT=*
http://ibm mainframes .com/about 55814.html
//SENDMAIL EXEC PGM=IEBGENER
//SYSIN DD DUMMY
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD *
HELO MAINFRAME
MAIL FROM: <TESTUSER1@TEST.COM>
RCPT TO: <TESTUSER2@TEST.COM>
DATA
FROM: <TESTUSER1@TEST.COM>
TO: <TESTUSER2@TEST.COM>
SUBJECT: This is a test mail
CONTENT-TYPE: MULTIPART/MIXED; BOUNDARY="SIMPLE BOUNDARY"
--SIMPLE BOUNDARY
Hello
Please check the attached file.
Bye.
--SIMPLE BOUNDARY
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=Attachment.txt
// DD DISP=SHR,DSN=AttachedMainframeDataset
// DD *
.
QUIT
/*
//SYSUT2 DD SYSOUT=(B,SMTPStartedtaskName)
//SYSOUT DD SYSOUT=*
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page