How to compose html tags/script format from mainframe batch COBOL? And send that formatted tags in an email attachment through mainframe JCL?
Asked
Active
Viewed 3,045 times
1 Answers
7
Since you didn't say, I'm assuming that you're using IEBGENER to send an email from the mainframe.
With JCL that looks something like this:
//MAILPROC EXEC PGM=IEBGENER
//SYSABEND DD SYSOUT=*
//SYSTOTAL DD SYSOUT=*
//SYSLIST DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSUT2 DD SYSOUT=(A,SMTP)
//SYSIN DD DUMMY
//*
//SYSUT1 DD DSN=USERID.INPUT.CARDS,DISP=SHR
// DD DSN=USERID.DCOL.DATASETS,DISP=SHR
And with input cards that look something like this:
HELO MAILST1
MAIL FROM: <NAME@COMPANY.COM>
RCPT TO: <NAME@COMPANY.COM>
DATA
FROM: <NAME@COMPANY.COM>
TO: <NAME@COMPANY.COM>
SUBJECT: TEST ATTACHMENT
MIME-VERSION: 1.0
CONTENT-DISPOSITION:ATTACHMENT;FILENAME="TEXT_FILE.TXT"
CONTENT-TYPE: TEXT/PLAIN
or
CONTENT-TYPE: INLINE
or
CONTENT-TYPE: TEXT/HTML
You're going to need the HELO code that your particular mainframe uses.
Here's an example of what might be in TEXT_FILE.TXT:
<BR><FONT SIZE=3 FACE=CALIBRI>
THIS IS AN AUTOMATED MESSAGE GENERATED FROM THE MVS JOB XXXXXX
AT ZZZZZZ TO NOTIFY THE USER ABOUT THE DETAILS OF THE PRODUCTION LOG
FOR DIFFERENT JOBS THAT HAVE EXECUTED OVER THE DAY.
<BR><BR>
As you can see, you just include the HTML as part of the text. It's treated as text on the mainframe and used in an email program that processes HTML.

Gilbert Le Blanc
- 50,182
- 6
- 67
- 111
-
this formatted text should populate from COBOL program - i.e. where the cobol program is performating some calcluations; the results I want to populate in HTML tags format. I can use this IEBGENER once I have publish that formatted text(in html) from cobol – Prareed Oct 01 '12 at 19:40
-
1@Pranu Reddy: Yes. You write a Cobol program that produces the email you want. Then you pass the output from the Cobol program into the IEBGENER job step. – Gilbert Le Blanc Oct 01 '12 at 19:45
-
1Good answer, but you might want try `CONTENT-TYPE: TEXT/HTML` rather than `TEXT/PLAIN`. Also ensure your HTML content is well formed and hopefully valid too. – NealB Oct 02 '12 at 14:31
-
You should also ask your mainframe guys if they run a smtp or other mail process you can use. Several exist. – Wudang Nov 28 '18 at 08:55