; mvsmail
Documents
Resources
Learning Center
Upload
Plans & pricing Sign in
Sign Out
Your Federal Quarterly Tax Payments are due April 15th Get Help Now >>

mvsmail

VIEWS: 15 PAGES: 23

  • pg 1
									Sending Email on MVS via SMTP
                -Or-
          You‟ve Got Mail!
       (from the mainframe)
                -or-
         Sleepless in SMTP
             Jon Gibbens
          jon@provista.com
A Familiar Phone Conversation?
 “Hello, this is Jon..”
   • “Yes, this is Steve Bigwig here, did my extracts
     run last night??”
 “Let me check. <click click>  Yes, they are
  done..the job ran last night at 3am”
   • “Ok, and could you tell me how many records
     were on it?”
 <click click> “ Yeah, 500.”
   • “Thanks”
 Next week..same exact phone call!!!
Introduction
 Need to notify users when certain
    conditions have been met, such as...
    • Reports Printed/Ready
    • Files transferred
    • Jobs completed/failed
   Provide some kind of automated reporting -
    ie..send data to someone on a regular basis
How about using Email?
 Email can help bridge the communication
  gap between you (the developer) and end
  users.
 The rest of the world uses email to notify
  people about things, why not you and your
  MVS-based FOCUS programs?
Presentation Agenda
 How does it work?
  • Note Control File
 Sample JCL (Inline & Procedure)
 Sample FOCEXEC code
 Sending a report via email
 Advanced Usage (URL‟s, HTML)
 WWW resources
Q&A
How does it work?
 In a nutshell:
  • 1 - Dynamically create your NOTE CONTROL FILE
    or use one that you have already created.
  • 2 - NOTE CONTROL file contains the “secret
    handshake” as well as your note body text.
  • 3 - Send NOTE CONTROL file off to SMTP via
    IEBGENER.
 SMTP allows for sending of email to any
  connected Intranet or Internet host.
 Note Control File - REQUIRED ELEMENTS
 (or....What‟s the secret handshake?)
1. HELO HOST - HOST is name of the MVSHOST (defined
   in SYS1.PARMLIB(IEFSSNxx)
2. MAIL FROM:<email address> -sender of note
3. RCPT TO:<email address> - 1 line per email
   recipient (as many recipients as you want)
4. DATA - seperator between RCPT TO & SUBJECT
5. SUBJECT - subject line of note
6. Note Body
Sample Note Control file
HELO HOST
MAIL FROM:<JON@PROVISTA.COM>
RCPT TO:<JONATHAN.GIBBENS@SCHWAB.COM>
DATA
SUBJECT: TEST OF MAILING OUT

THIS IS A TEST OF EMAIL :)

JON GIBBENS




•Note Control file generated with FOCUS/Dialogue Manager
(using -WRITE statements)
  JCL section of a procedure
//**********************************************************************
//* PS020: EXECUTE IEBGENER PROGRAM TO SEND EMAIL NOTIFICATION VIA SMTP
//**********************************************************************
//PS020 EXEC PGM=IEBGENER
//**********************************************************************
//SYSIN    DD DUMMY
//SYSUT1   DD DSN=&WKPDS..NOTECNTL.TEST,DISP=SHR
//SYSUT2   DD SYSOUT=(B,SMTP)
//SYSOUT   DD SYSOUT=X
//SYSPRINT DD SYSOUT=X




•IEBGENER - copies sequential dataset from any device to any device.
•Input step in SYSUT1 - location of Note Control File
•Output step in SYSUT2 - passes control to SMTP program
              JCL with note control file
                   included inline
//MA#JOGA1 JOB (TEST,MF#1),'JON MAIL TEST',CLASS=9,MSGCLASS=T,
// NOTIFY=MF#JOG,USER=MF#JOG
//IEBGENER EXEC PGM=IEBGENER
//SYSIN DD DUMMY
//SYSUT1 DD *
HELO HOST
MAIL FROM:<JON@PROVISTA.COM>
RCPT TO:<JONATHAN.GIBBENS@SCHWAB.COM>
DATA
SUBJECT: TEST OF MAILING OUT

THIS IS A TEST OF EMAIL :)

JON GIBBENS

/*
//SYSUT2 DD SYSOUT=(B,SMTP)
//SYSOUT DD SYSOUT=X
//SYSPRINT DD SYSOUT=X
Sample Note generated by JCL
  ( as viewed in Exchange)
Sample Scenario
 Want to let Steve Bigwig know when his job
  ran, and how many records it pulled.

 Sample Focexec to follow writes out the #
  system time & date, and the # of records in
  a flat file. Also creates our NOTE CONTROL
  FILE.
FOCUS code to create NOTE
Control File
 Focexec is EMLSAMP1
  • Includes a utility I use for creating most of my
    email related && variables
 This code would go AFTER „data extract‟
  portion of the program.
 Would be part of a JCL job/procedure
-*
                                    EMLSAMP1 Focexec
                                                               -***********************************************************
TABLE FILE <whatever>
                                                               -* NOTE CONTROL FILE UTILITY
SUM CNT.ACCOUNTS
                                                               -* JON GIBBENS - PROVISTA SOFTWARE INTL. - JON@PROVISTA.COM
BY CODE
                                                               -*
-*
                                                               -* SET UP && VARIABLES FOR CREATION OF NOTE CONTROL FILE
-*EMLSAMP1: JONATHAN GIBBENS
                                                               -* NOTE: ALL OF THESE -SETS COULD BE INSIDE OF AN INCLUDE
-*FOCEXEC ABOVE DOES EXTRACT FOR STEVE BIGWIG
                                                               -*       FILE FOR CONVENIENCE AND CODE PORTABILITY
-*
                                                               -**
END
                                                               -** INPUTS:
-* =====================================================
                                                               -**     &RCPT1-5 = UP TO FIVE VALID EMAIL ADDRESSES
-* SET THE SYSTEM TIME VARIABLE
                                                               -**     &SUBJECT = THE SUBJECT OF THE NOTE
-* =====================================================
                                                               -**
-SET &STIME = '        ';
                                                               -**     OUTPUTS: ESSENTIAL VARIABLES FOR AN EMAIL MESSAGE
-SET &STIME = HHMMSS(&STIME);
                                                               -**
-*
                                                               -**     &HELOLINE = 'HELO HOST' - FIRST LINE OF EMAIL MESSAGE
-* =====================================================
                                                               -**                    WHERE HOST IS THE MAIL SUBSYSTEM
-* SET UP 3 BODY LINES FOR EMAIL MESSAGE -
                                                               -**     &RCPTLNE1='RCPT TO:<RPCT1>' FIRST RECIPIENT
-* DATE/TIME/RECORDS/LINES
                                                               -**     &RCPTLNE2='RCPT TO:<RPCT2>' 2ND RECIPIENT
-* =====================================================
                                                               -**     &RCPTLNE3='RCPT TO:<RPCT3>' 3RD ""
-SET &NEATDATE = EDIT(&YYMD,'9999/99/99');
                                                               -**     &RCPTLNE4='RCPT TO:<RPCT4>' 4TH ""
-SET &BODY1 = ' YOUR EXTRACT RAN ON ' | &NEATDATE | ' AT ' |
                                                               -**     &RCPTLNE5='RCPT TO:<RPCT5>' 5TH ""
-               &STIME;
                                                               -**     &SUBLINE = 'SUBJECT: &SUBJECT'
-SET &BODY2 = ' THE NUMBER OF LINES IN YOUR EXTRACT WAS ' |
                                                               -**     &TOEND = '>'          - THE END OF THE 'TO' LINE
-               &LINES;
                                                               -**     &DATALINE = 'DATA' - PUT AFTER 'TO' LINE(s)
-SET &BODY3 = ' THE NUMBER OF RECORDS IN YOUR EXTRACT WAS '|
                                                               -**     &SUBBEG = 'SUBJECT:' - BEGINNING OF SUBJECT LINE
                &RECORDS;
                                                               -**     &SIGLINE1='THANKS! HAVE A NICE DAY!'
-*
                                                               -**     &BLANKLINE = ' ' - SPACES/BLANKS
-* =====================================================
                                                               -**************************************************************
-* SET UP THE RECIPIENTS OF THE NOTE, AND THE SUBJECT
                                                               -**DEFAULT THE ESSENTIAL ELEMENTS-
-* =====================================================
                                                               ***************************************************************
-SET &RCPT1='JONATHAN.GIBBENS@SCHWAB.COM';
                                                               -DEFAULTS &HELOLINE = 'HELO HOST'
-SET &RCPT2='STEVEB@COMPANY.COM';
                                                               -DEFAULTS &TOBEG     = 'RCPT TO:<'
-SET &SUBJECT = 'FILE EXTRACTS FOR ' | &NEATDATE;
                                                               -DEFAULTS &TOEND     = '>'
-*
                                                               -DEFAULTS &DATALINE = 'DATA'
-*
                                                               -DEFAULTS &SUBBEG    = 'SUBJECT: '
                                                               -DEFAULTS &RCPT1=' '
                                                               -DEFAULTS &RCPT2=' '
                                                               -DEFAULTS &RCPT3=' '
                                                               -DEFAULTS &RCPT4=' '
                                                               -DEFAULTS &RCPT5=' '
                                                               -DEFAULTS &SUBJECT = ' '
                                                               -DEFAULTS &BLANKLINE = ' '
                                                               -RUN
                                         EMLSAMP1 Focexec
-*
-* ------------------------------------------------------------         -
                                                                       -* ---------------------------------------------------------------
-* SET UP THE RCPT TO: LINES - UP TO 5 PEOPLE CAN BE SENT THE EMAIL    -* =====================================================
-* READ IN THE &RCPT1,&RCPT2,&RCPT3,&RCPT4,&RCPT5 VARIABLES            -* WRITE OUT THE HELOLINE & THE FROM LINE
-* OUTPUT IN THE FORMAT:    RCPT TO:<EMAIL ADDRESS>                    -* =====================================================
-* ------------------------------------------------------------        -*
-*                                                                     -WRITE NOTECNTL &HELOLINE
-SET &RCPTLNE1 = &TOBEG || &RCPT1 || &TOEND;                           -WRITE NOTECNTL &FROMLINE
-SET &RCPTLNE2 = &TOBEG || &RCPT2 || &TOEND;                           -*
-SET &RCPTLNE3 = &TOBEG || &RCPT3 || &TOEND;                           -* =====================================================
-SET &RCPTLNE4 = &TOBEG || &RCPT4 || &TOEND;                           -* WRITE OUT THE RECIPIENT(S)
-SET &RCPTLNE5 = &TOBEG || &RCPT5 || &TOEND;                           -* =====================================================
-*                                                                     -*
-* ------------------------------------------------------------        -WRITE NOTECNTL &RCPTLNE1
-* SET UP THE SUBJECT LINE - READ IN &SUBJECT;                         -WRITE NOTECNTL &RCPTLNE2
-* ------------------------------------------------------------        -*
-*                                                                     -* =====================================================
-SET &SUBLINE = 'SUBJECT: ' | &SUBJECT;                                -* WRITE OUT THE DATA SEPERATOR & SUBJECT LINE
-                                                                      -* =====================================================
********************************************************************   -*
-**INSTALLATION SPECIFIC VARIABLES                                     -WRITE NOTECNTL &DATALINE
-** &FROMLINE - EMAIL ADDRESS FOR THE SENDER (CAN BE ANY EMAIL         -WRITE NOTECNTL &SUBLINE
-**             ADDRESS)                                               -*
-** &SIGLINE1 - LINE TO END THE EMAIL                                  -* =====================================================
********************************************************************   -* WRITE OUT THE BODY OF THE NOTE
-*                                                                     -* =====================================================
-DEFAULTS &FROMLINE = 'MAIL FROM:<THEBIGMAINFRAME@COMPANY.COM>'        -*
-DEFAULTS &SIGLINE1 = 'THANKS! HAVE A NICE DAY!!'                      -WRITE NOTECNTL &BLANKLINE
-DEFAULTS &SIGLINE2 = 'QUESTIONS/PROBLEMS? EMAIL                       -WRITE NOTECNTL &BODY1
TECHSUPPORT@COMPANY.COM'                                               -WRITE NOTECNTL &BODY2
-                                                                      -WRITE NOTECNTL &BODY3
********************************************************************   -WRITE NOTECNTL &BLANKLINE
***                                                                    -WRITE NOTECNTL &SIGLINE1
-*                                                                     -WRITE NOTECNTL &SIGLINE2
-* ---------------------------------------------------------------     -*
-* WRITE OUT THE NOTE CONTROL FILE: NOTECNTL                           -*
-*   NOTE CONTROL FILE IS A FLAT FILE ALLOCATED AS MOD                 -* =========================================================
-*   FOR SIMPLE NOTES, IT CAN BE FIXED FORMAT, 80 CHARACTERS, 27920    -* END OF JOB EMLSAMP1
BLKS                                                                   -* =========================================================
Resulting file from EMLSAMP
HELO HOST
MAIL FROM:<THEBIGMAINFRAME@COMPANY.COM>
RCPT TO:<JONATHAN.GIBBENS@SCHWAB.COM>
RCPT TO:<STEVEB@COMPANY.COM>
DATA
SUBJECT: FILE EXTRACTS FOR 1999/09/10

 YOUR EXTRACT RAN ON 1999/09/10 AT 16.53.44
 THE NUMBER OF LINES IN YOUR EXTRACT WAS      27
 THE NUMBER OF RECORDS IN YOUR EXTRACT WAS    1000

THANKS! HAVE A NICE DAY!!
QUESTIONS/PROBLEMS? EMAIL TECHSUPPORT@COMPANY.COM
Sending a report via email
 To send a small report (less than the
  maxiumum line length of your email client)
  1. Turn off page-breaks (SET PAGE=NOPAGE )
  2. Put NOTE CONTROL FILE elements into your
     HEADER (ie..HELO,MAIL FROM,RCPT TO,DATA)
  3. Save file in WP format and then send off to
     IEBGENER using JCL in examples.
    Advanced Usage
   URLs - Exchange/Outlook or Netscape mail (other
    mail clients as well) will read any URL‟s you
    include in your note and will activate them
    • So, if you are doing Intranet type reporting, you can
      point users to where the reports are.
   Can do fancier HTML formatting if include MIME
    tags and HTML code (example to follow)
    • Only really works if email client fully supports HTML, or
      at least, supports the features that YOU need.
                   Note Control File with a URL
                    along with resulting note.
HELO HOST
MAIL FROM:<JON@PROVISTA.COM>
RCPT TO:<JONATHAN.GIBBENS@SCHWAB.COM>
DATA
SUBJECT: TEST OF USING URL IN NOTE

A good site to visit for FUSE-related
   information is:
http://www.csuhayward.edu/FOCUS/ncalfuse.htm
                    Note Control File with HTML
                    along with resulting note.
HELO HOST
MAIL FROM:<THEBIGMAINFRAME@SCHWAB.COM>
RCPT TO:<JONATHAN.GIBBENS@SCHWAB.COM>
DATA
SUBJECT: A HTML TEST NOTE
MIME-Version: 1.0
Content-type: text/html; charset=“us-ascii”
<HTML>
<BODY>
<H1>Here’s the big header of the note</H1>
<P>
Hey, here’s an HTML note that will have you
    seeing <font face=“Arial” size=“+5”
    color=red>RED</font>
</BODY>
</HTML>
WWW Resources
 Dave‟s MVS Mail Page -
  http://users.ticnet.com/davea/mvs/mvsmail
 Decoding Internet Attachments -
  http://pages.prodigy.net/michael_santovec/decode.htm
  - To find out more about MIME tags, and different
  compatibility issues with different email clients
Questions?
Download this presentation
Northern California FUSE Homepage:
http://www.csuhayward.edu/FOCUS/mvsmail.ppt

								
To top