E-Mailing Spoolfiles Instead of Printing

Many system managers are looking for alternatives to printing reports. Or a method for distributing reports to remote users. Emailing reports is one option. We have developed a simple script that can be invoked from any batch job to email all spoolfiles created by the job to an email address. The email recipient receives the spool files as HTML attachments with a .html extension to make opening them in a Browser a simple operation. All you need is a mail server (SMTP) server that is accessible from your HP3000 system.

Emailing the reports is as simple as adding the following line into any batch job:

!SF2EMAIL doug@beechglen.com

SF2EMAIL relies upon two programs: SF2HTMLP and MAILNM. SF2EMAIL is included in SF2HTML, a Beechglen freeware package. I have also included
the script below. MAILNM, a free utility from Telamon, is also required. You can obtain SF2HTML from http://www.beechglen.com/mpe/downloads.html. Complete download instructions are on the Freeware page. MAILNM is available from Beechglen. If you have any questions or need any help setting it up
please let us know.


SF2EMAIL


parm EmailAddy=doug@beechglen.com
# SF2EMAIL v1.1
# Written by Doug Werth (doug@beechglen.com)
# Beechglen Development Inc.
#
# Purpose:
# E-mail all spoolfiles (other than $STDLIST) to
# the user specified on the PARM line.
#
# Programs used:
# MAILNM can be downloaded from ftp://ftp.telamon.com
# SF2HTML can be obtained from http://www.beechglen.com
#
#
# *** Modify the following lines for the correct
# IP address or Name of your SMTP server, and
# a valid return address.

setvar MAILSMTPHOST,'mailserver.beechglen.com'
setvar MAILFROM,'hp3000@beechglen.com'
setvar MAILSUBJECT,'Output from !HPJobName (#!HPJobType!HPJobNum)'

# First, Identify all spool files for this job
# Use !hpjobnum as a file extension to provide
# for a unique file so that multiple batch jobs
# can generate emails simultaneously.

purge ./spfwork.!hpjobnum >$null
build ./spfwork.!hpjobnum;rec=-80,,f,ascii;msg
file workfl=./spfwork.!hpjobnum,old;dev=disc
setvar ListspfParm,"jobnum=!HPJobType!HPjobnum and filedes<>$stdlist"
listspf @;seleq=[!ListspfParm] >./spfwork.!hpjobnum >*workfl

# Next, process the list of spoolfiles. For each file foun
# use SF2HTML to turn it into an HTML file, then use MAILNM
# to mail it out.
#

while finfo("*workfl","EOF") > 0
   input SPFLine <*workfl
   if lft(SPFLine,2) = "#O"
      setvar SPFLnum,str(SPFline,3,8)
      echo Processing spool file !SPFLnum
      file SFOUT;rec=-256,,f,ascii;disc=500000
      # usage: SF2HTMLP ;info="sf# (ie 1827);parm=lines per page
      SF2HTMLP !SPFLnum,59
      MAILNM '-t !EMailAddy -ah SFOUT "See attached"'
   endif
endwhile
purge ./spfwork.!HPJobNum >$null