Create HTML tags using batch COBOL in Mainframe.

OS/VS COBOL, COBOL II, Enterprise COBOL for z/OS. OpenCOBOL and OOCobol.
Post Reply
Niketan
Registered Member
Posts: 20
Joined: Mon Aug 19, 2013 4:07 pm

Create HTML tags using batch COBOL in Mainframe.

Post by Niketan »

Hi,

Can someone please help me on this task. I am trying to compose html tags/script format from mainframe batch COBOL. And send that formatted tags in an email attachment through mainframe JCL. Can this be done, if yes- can you please guide me with an example?
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1891
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Create HTML tags using batch COBOL in Mainframe.

Post by Robert Sample »

It may -- or may not -- be possible depending upon how your site is set up. z/OS supports SMTP to allow email from the mainframe, but it is not a required component so it may not be executing at your site . Unless your site has SMTP (or another email transfer package) installed, you're not going to be sending emails from your mainframe.

Assuming that your site supports SMTP, you code your COBOL program to create an output file with the HTML tags you want around the text you want. You then write the SMTP commands in the correct format to another file to use SMTP to send the email. The exact format of the SMTP commands can be found by a Google search (hint: you'll be using MIME) but you may have to experiment for a while to get the precise commands you need.
Niketan
Registered Member
Posts: 20
Joined: Mon Aug 19, 2013 4:07 pm

Re: Create HTML tags using batch COBOL in Mainframe.

Post by Niketan »

Hi,

I have created a sample file to send with name SAMPLE_FILE.TXT like this:

Code: Select all

<BR><FONT SIZE=11 FACE=ARIAL>
THIS IS A SAMPLE MESSAGE GENERATED BY NIKETAN AT ZZZZZZ TO NOTIFY THE USER ABOUT THE DETAILS OF THE PRODUCTION JOBS THAT HAVE EXECUTED.
<BR>
And used this JCL to send the email:

Code: Select all

//MAILPROC EXEC PGM=IEBGENER
//SYSABEND DD SYSOUT=*
//SYSTOTAL DD SYSOUT=*
//SYSLIST DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSUT2 DD SYSOUT=(B,SMTP)
//SYSIN DD DUMMY
//*
//SYSUT1 DD DSN=INPUT.CARD,DISP=SHR
//       DD DSN=MY.DATASET,DISP=SHR
INPUT.CARD details are:

Code: Select all

HELO MVS
MAIL FROM: <NAME@SOME.COM>
RCPT TO: <NAME@SOME.COM>
DATA
FROM: <NAME@SOME.COM>
TO: <NAME@SOME.COM>
SUBJECT: TEST ATTACHMENT
MIME-VERSION: 1.0
CONTENT-DISPOSITION:ATTACHMENT;FILENAME="SAMPLE_FILE.TXT"
CONTENT-TYPE: TEXT/HTML
It seems to dothe job. If there is a better way of doing it, please help me.
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1891
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Create HTML tags using batch COBOL in Mainframe.

Post by Robert Sample »

If what you have is doing the job, why are you wanting a better way? And since you are doing what you were advised to do, why would you even think there is a better way? What you have is standard z/OS -- if there IS a "better way", you would have to contact your site support group and find out what is available at your site to make it better.
Niketan
Registered Member
Posts: 20
Joined: Mon Aug 19, 2013 4:07 pm

Re: Create HTML tags using batch COBOL in Mainframe.

Post by Niketan »

I just wanted to ask about other experiences, Thanks all. It's working for now.
Post Reply

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

Register

Sign in

Return to “IBM COBOL, GnuCOBOL (OpenCOBOL), OOCobol.”