Hi,
I've used IEBGENER in JCL to send an email. Though now, I'd like to send an email from a COBOL program. Is calling IEBGENER possible? Or is there any another way one can send an email from within a COBOL program?
Thanks.
Can we call IEBGENER from COBOL?
-
- New Member
- Posts: 5
- Joined: Sat Apr 26, 2014 11:31 pm
-
- Global Moderator
- Posts: 490
- Joined: Sun Aug 25, 2013 7:24 pm
Re: Can we call IEBGENER from COBOL?
When you are sending an e-mail. IEBGENER is doing nothing special, just copying an input file to an output file. If you define a DDname in the JCL with the same characteristics as the output file in IEBGENER then write to that file you will "send an e-mail from COBOL".
Persoanlly, I'd not want that done. I'd just write to a file and then have something copy it for e-mailing later. Makes lots of things more simple. Usring rings up and says "sorry, I deleted that e-mail, can you send it again?" and you say "sure, let me just restore the data which was updated, and give it an hour or so".
Persoanlly, I'd not want that done. I'd just write to a file and then have something copy it for e-mailing later. Makes lots of things more simple. Usring rings up and says "sorry, I deleted that e-mail, can you send it again?" and you say "sure, let me just restore the data which was updated, and give it an hour or so".
- Robert Sample
- Global Moderator
- Posts: 1891
- Joined: Fri Jun 28, 2013 1:22 am
- Location: Dubuque Iowa
Re: Can we call IEBGENER from COBOL?
As stated, you don't need to use IEBGENER -- merely define a file in COBOL, open it for output, write the SMTP (assuming you are using SMTP) commands to that file, and when you close it SMTP will get the email to process. The DD statement in your JCL will be the same as your IEBGENER SYSUT2 (but don't call it SYSUT2 in your COBOL program -- probably would be okay, but I would want to test a bit before using it in a COBOL program since COBOL uses SYSUTn statements for compiler things).
As pointed out, you'll need to consider the need for restart should the email not be delivered, or need to be delivered to a different email address. I would probably place the SMTP commands in an input data set to make it easier to change the email characteristics.
As pointed out, you'll need to consider the need for restart should the email not be delivered, or need to be delivered to a different email address. I would probably place the SMTP commands in an input data set to make it easier to change the email characteristics.
-
- New Member
- Posts: 5
- Joined: Sat Apr 26, 2014 11:31 pm
Re: Can we call IEBGENER from COBOL?
Thanks William and Robert.
I don't follow this statemment. Just merely closing the file will get e-mail across? is it?...when you close it SMTP will get the email to process.
- Robert Sample
- Global Moderator
- Posts: 1891
- Joined: Fri Jun 28, 2013 1:22 am
- Location: Dubuque Iowa
Re: Can we call IEBGENER from COBOL?
SMTP won't process the email until the file is closed (and hence fully available). As long as your SMTP commands in the file are properly formatted, SMTP handles the details of sending the email.
Note that in general mainframe data sets that are open by a program may have records written by the program that will not be available to other programs until the data set is closed. This is not unique to SMTP.
Note that in general mainframe data sets that are open by a program may have records written by the program that will not be available to other programs until the data set is closed. This is not unique to SMTP.
Create an account or sign in to join the discussion
You need to be a member in order to post a reply
Create an account
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute