Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Need Help on sending email by including input file value.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
wik123

New User


Joined: 13 Jul 2018
Posts: 6
Location: india

PostPosted: Mon Jul 30, 2018 2:59 pm    Post subject: Need Help on sending email by including input file value.
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: 682
Location: The Universe

PostPosted: Mon Jul 30, 2018 3:34 pm    Post subject:
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: 2126
Location: UK

PostPosted: Mon Jul 30, 2018 3:37 pm    Post subject: Reply to: Need Help on sending email by including input file value.
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: 6
Location: india

PostPosted: Mon Jul 30, 2018 4:46 pm    Post subject:
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: 8410
Location: Dubuque, Iowa, USA

PostPosted: Mon Jul 30, 2018 5:59 pm    Post subject: Reply to: Need Help on sending email by including input file value.
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: 6
Location: india

PostPosted: Tue Jul 31, 2018 11:54 am    Post subject: Re: Reply to: Need Help on sending email by including input file value.
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: http://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: 2126
Location: UK

PostPosted: Tue Jul 31, 2018 1:39 pm    Post subject: Reply to: Need Help on sending email by including input file value.
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: 1621
Location: Oregon

PostPosted: Tue Jul 31, 2018 11:36 pm    Post subject:
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    Post subject:
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: 1621
Location: Oregon

PostPosted: Wed Aug 01, 2018 2:00 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Transferring file to Mainframes Shinoj Vijayakumar IBM Tools 3 Thu Dec 06, 2018 2:35 pm
No new posts Convert VBA file to FB! Vignesh Sid SYNCSORT 5 Mon Dec 03, 2018 1:27 pm
No new posts Another 39 File Status on VB file socker_dad COBOL Programming 5 Tue Nov 27, 2018 6:11 am
No new posts How to handle different file length b... javen777 DFSORT/ICETOOL 15 Mon Nov 26, 2018 12:13 pm
No new posts COBOL file declaration jithinraghavan COBOL Programming 2 Fri Nov 16, 2018 10:54 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us