IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Need Help on sending email by including input file value.


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
wik123

New User


Joined: 13 Jul 2018
Posts: 8
Location: Nederlands

PostPosted: Mon Jul 30, 2018 2:59 pm
Reply with quote

Hi all,

Im looking for a code where JCL will read the date value from then input file and send an email by including the date value in mail content.
(with out using Cobal/EZ+ or any other, is it possible to implement this in JCL)

sample code:

//SENDMAIL EXEC PGM=IEBGENER
//SYSIN DD DUMMY <---- (input date card file)
//SYSPRINT DD SYSOUT=*
//SYSUT2 DD SYSOUT=(A,SMTP)
//SYSUT1 DD *
HELO team
MAIL FROM:<ABC.COM>
RCPT TO:<XYZ.COM>
DATA
FROM:<ABC.COM>
TO: <XYZ.COM>
SUBJECT: TEST MAIL

Hi team,

we delivered file for the date :XX-MM-YYYY (this is the value from I/p file)
Thanks

quit
.
//*
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Mon Jul 30, 2018 3:34 pm
Reply with quote

  • The input data set (NOT file) are the card images following the //SYSUT1 DD * JCL statement. I see nothing that looks like a date in that data set.
  • The data set specified by the SYSIN DD DUMMY JCL statement is used to control the operation of the IEBGENER utility. Since the data set specified by a DD DUMMY JCL statement has no data in it, obviously IEBGENER cannot insert a date from the contents of the data set.
  • The effect of this JCL is to forward the contents of the data set specified by the DD statement with DD name SYSUT1 to an e-mail server. The e-mail server inserts the current date as control data into the data it sends to the e-mail server at XYZ.COM.
  • Unless my elderly eyes deceive me, there is no date in the data set (NOT file) specified by the DD statement with DD name SYSUT1. The only date in the data sent to XYZ.COM is the date inserted in control data by the e-mail server specified by the DD statement with DD name SYSUT2.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Mon Jul 30, 2018 3:37 pm
Reply with quote

Possibly. If you change your SYSUT1 to reference the relevant system symbolic for the date that the internal reader can substitute with the relevant value.

If the required system symbolics are not there then the answer is NO because JCL only tells the OS what program to run and the resources required. It does not manipulate data.

And, as Steve pointed out, you afe on a mainframe where a file is not the same entity as a data set.
Back to top
View user's profile Send private message
wik123

New User


Joined: 13 Jul 2018
Posts: 8
Location: Nederlands

PostPosted: Mon Jul 30, 2018 4:46 pm
Reply with quote

Thanks Steve,

In description its a sample code, the required code looks like

//SENDMAIL EXEC PGM=Any JCL Utility
//SYSIN DD DSN= GDG Version/PS file <---- (input date card file)
//SYSPRINT DD SYSOUT=*
//SYSUT2 DD SYSOUT=(A,SMTP)
//SYSUT1 DD *
HELO team
MAIL FROM:<ABC.COM>
RCPT TO:<XYZ.COM>
DATA
FROM:<ABC.COM>
TO: <XYZ.COM>
SUBJECT: TEST MAIL

Hi team,

we delivered file for the date :XX-MM-YYYY (this is the value from I/p file and it not be a system date)
Thanks

quit
.
//*



steve-myers wrote:
  • The input data set (NOT file) are the card images following the //SYSUT1 DD * JCL statement. I see nothing that looks like a date in that data set.
  • The data set specified by the SYSIN DD DUMMY JCL statement is used to control the operation of the IEBGENER utility. Since the data set specified by a DD DUMMY JCL statement has no data in it, obviously IEBGENER cannot insert a date from the contents of the data set.
  • The effect of this JCL is to forward the contents of the data set specified by the DD statement with DD name SYSUT1 to an e-mail server. The e-mail server inserts the current date as control data into the data it sends to the e-mail server at XYZ.COM.
  • Unless my elderly eyes deceive me, there is no date in the data set (NOT file) specified by the DD statement with DD name SYSUT1. The only date in the data sent to XYZ.COM is the date inserted in control data by the e-mail server specified by the DD statement with DD name SYSUT2.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Mon Jul 30, 2018 5:59 pm
Reply with quote

Why not make it easy on yourself and use
Code:
//SENDMAIL EXEC PGM=IEBGENER
 //SYSPRINT DD SYSOUT=*
 //SYSUT2 DD SYSOUT=(A,SMTP)
 //SYSUT1 DD *
 HELO team
 MAIL FROM:<ABC.COM>
 RCPT TO:<XYZ.COM>
 DATA
 FROM:<ABC.COM>
 TO: <XYZ.COM>
 SUBJECT: TEST MAIL

 Hi team,

 we delivered file for the date
//        DD DISP=SHR,DSN=<date file>
//        DD *
 Thanks

 quit
 .
This puts the date on a separate line, but it requires very few changes; using symbols in your input requires that you be running at least version 2.1 of z/OS, and your site support group has to enable them.
Back to top
View user's profile Send private message
wik123

New User


Joined: 13 Jul 2018
Posts: 8
Location: Nederlands

PostPosted: Tue Jul 31, 2018 11:54 am
Reply with quote

Thanks Robert for your help.

For IEBGENER SYSIN was mandatory right ?
and if I modify the code like below and submitted

Hi team,

we delivered file for the date :
//SYSIN DD DSN=file
// DD *
Thanks
quit
.

Then I am not getting data above SYSIN (Hi team... etc).



Read more: ibmmainframes.com/viewtopic.php?t=66754#ixzz5MoJM8Z3B


Robert Sample wrote:
Why not make it easy on yourself and use
Code:
//SENDMAIL EXEC PGM=IEBGENER
 //SYSPRINT DD SYSOUT=*
 //SYSUT2 DD SYSOUT=(A,SMTP)
 //SYSUT1 DD *
 HELO team
 MAIL FROM:<ABC.COM>
 RCPT TO:<XYZ.COM>
 DATA
 FROM:<ABC.COM>
 TO: <XYZ.COM>
 SUBJECT: TEST MAIL

 Hi team,

 we delivered file for the date
//        DD DISP=SHR,DSN=<date file>
//        DD *
 Thanks

 quit
 .
This puts the date on a separate line, but it requires very few changes; using symbols in your input requires that you be running at least version 2.1 of z/OS, and your site support group has to enable them.
icon_sad.gif icon_smile.gif icon_sad.gif icon_sad.gif
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Tue Jul 31, 2018 1:39 pm
Reply with quote

Please read Robert's solution carefully. He has amended the SYSUT1, i.e. the input data not the input IEBGENER control statements (SYSIN). As you are not using any IEBGENER control statements - you are doing a straight copy of concatenated data - SYSIN will be DUMMY.

You need to read about IEBGENER in the utilities manual.

Another point about posting: use the code tags when presenting code, data, screenshots and anything with multiple embedded spaces or spaces in column 1. If you do not know how to use the code tags use the post reply button not the quick reply button or search the entire forum for 'code tags' especially posts by 'expat'.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Tue Jul 31, 2018 11:36 pm
Reply with quote

Since you are new, I'll explain how the email is being sent via IEBGENER and hope it helps you figure out the problem.

IEBGENER with no SYSIN, simply copies whatever data you provide in SYSUT1 to SYSUT2.
In this case, your SYSUT1 is
Code:
HELO team
MAIL FROM:<ABC.COM>
RCPT TO:<XYZ.COM>
.
.
.


So this data gets copied to SYSUT2. If you have a PS dataset as SYSUT2 instead of SYSOUT, then it would have the contents of SYSUT1.

In our case, SYSUT2 is assigned to SYSOUT=(A,SMTP). This statment assigns the external writer called "SMTP" output class of A to the SYSUT2 statement.

The external writer "SMTP" understands the data it receives through SYSUT2 and sends the email.

The program sending the data to SMTP could be IEBGENER or SORT or FTP or anything that could write data to a DD statement and SMTP writer will send the email of whatever data it received.
Back to top
View user's profile Send private message
phunsoft

New User


Joined: 19 Jul 2018
Posts: 11
Location: Switzerland

PostPosted: Wed Aug 01, 2018 1:50 am
Reply with quote

vasanthz wrote:
Since you are new, I'll explain how the email is being sent via IEBGENER and hope it helps you figure out the problem.

IEBGENER with no SYSIN, simply copies whatever data you provide in SYSUT1 to SYSUT2.
In this case, your SYSUT1 is
Code:
HELO team
MAIL FROM:<ABC.COM>
RCPT TO:<XYZ.COM>
.
.
.


So this data gets copied to SYSUT2. If you have a PS dataset as SYSUT2 instead of SYSOUT, then it would have the contents of SYSUT1.

In our case, SYSUT2 is assigned to SYSOUT=(A,SMTP). This statment assigns the external writer called "SMTP" output class of A to the SYSUT2 statement.

The external writer "SMTP" understands the data it receives through SYSUT2 and sends the email.

The program sending the data to SMTP could be IEBGENER or SORT or FTP or anything that could write data to a DD statement and SMTP writer will send the email of whatever data it received.


PMFJI, but to be correct I'd like to mention that the JES SPOOL plays a major role in this. Neither IEBGENER, nor SORT, nor FTP are sending the data to SMTP. They are simply writing a SYSOUT data set, i.e. writing data to the JES spool.

On the other hand, there is a program running on the system which looks for SYSOUT data sets in the JES SPOOL with certain attributes. In this case output class A and writer name SMTP. That program -- the SMPT program -- then reads the data set, sends it off as mail, and then deletes the data set from the spool. The external writer (SMPT) does not care for the DD name under which the data sets has been written earlier on.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Wed Aug 01, 2018 2:00 am
Reply with quote

Quote:
there is a program running on the system which looks for SYSOUT data sets in the JES SPOOL with certain attributes.

Thanks for the correction. It makes sense now for SMTP being a started task & be always running looking for stuff, instead of being an adhoc batch utility.

Thanks,
Vasanth.S
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top