parm recipients=!HPUSER.!HPACCOUNT,& subject='HP3000 spoolfiles',& seleq="jobnum=!HPJOBTYPE!HPJOBNUM",& entry=main comment This MAILSPF command file e-mails one or more output spoolfiles as MIME comment multipart attachments. Syntax: comment comment mailspf recipients="user1@some.host, user2@some.host, ...", comment subject="subject header of e-mail message", comment seleq=":LISTSPF SELEQ criteria *without* []" comment comment The default SELEQ criteria will select all output spoolfiles created comment by the session or job that is invoking MAILSPF. comment comment An example of a job that e-mails all of its created spoolfiles: comment comment job reports,user.account comment comment generate first report spoolfile comment run report1 comment comment generate second report spoolfile comment run report2 comment comment e-mail all spoolfiles (including $STDLIST) comment xeq mailspf someuser@some.host,"Output from the reports job" comment eoj comment comment MAILSPF was developed under MPE/iX 5.5 PowerPatch4 and uses Sendmail/iX comment (http://www.bixby.org/mark/sendmailix.html) as a mail transport. Note comment that other mail transports may be used as long as the transport will comment accept a fully formatted message that includes headers. comment comment Where to obtain this CI command file: comment comment http://www.bixby.org/ftp/pub/mpe/mailspf.ci comment or comment ftp://ftp.bixby.org/pub/mpe/mailspf.ci comment comment How to contact the author: comment comment Mark Bixby comment email: mark@bixby.org comment web: http://www.bixby.org/mark/ comment comment Change History comment comment 1.0 April 8, 1998 comment comment Initial public release. if UPS("!entry") = 'MAIN' then comment comment Purge the :LISTSPF temp output file if it exists. comment file mailspfl,oldtemp if FINFO('*mailspfl','exists') then purge mailspfl,temp endif comment comment Call :LISTSPF with the selection criteria and capture the output. comment file mailspfl;temp;rec=,,b;disc=2147483647 setvar CIERROR 0 setvar JCW 0 continue listspf o@;detail;seleq=[!seleq] >*mailspfl if CIERROR <> 0 or JCW <> 0 then comment comment Something went wrong. Stop. comment print mailspfl purge mailspfl,temp reset mailspfl return endif file mailspfl,oldtemp comment comment Purge the mail message temp file if it exists. comment file mailspfm,oldtemp if FINFO('*mailspfm','exists') then purge mailspfm,temp endif comment comment Start creating the message as a temp file. comment build mailspfm;temp;rec=,,b;disc=2147483647 comment Generate a MIME boundary string. setvar mailspf_sep RHT(RPT('-',36)+"!HPSUSAN!HPPIN!HPCPUMSECS",36) comment comment Generate all of the message headers. comment echo To: !recipients>*mailspfm if HPJOBNAME = '' then setvar mailspf_from & '"#!HPJOBTYPE!HPJOBNUM !HPUSER.!HPACCOUNT" !' else setvar mailspf_from & '"#!HPJOBTYPE!HPJOBNUM !HPJOBNAME,!HPUSER.!HPACCOUNT" !' endif echo From: !mailspf_from >>*mailspfm echo Subject: !subject>>*mailspfm echo MIME-Version: 1.0>>*mailspfm echo Content-Type: multipart/mixed; boundary="!mailspf_sep">>*mailspfm echo >>*mailspfm comment comment Generate the preamble (not normally displayed by MIME mail clients). comment echo This is a multi-part message in MIME format.>>*mailspfm comment comment Generate the first body which contains the :LISTSPF output. comment echo --!mailspf_sep>>*mailspfm echo Content-Type: text/plain; charset=us-ascii>>*mailspfm echo Content-Transfer-Encoding: 7bit>>*mailspfm echo >>*mailspfm print *mailspfl >>*mailspfm comment comment Generate a body for each spoolfile. comment xeq !HPFILE entry=listspf <*mailspfl comment comment That's all, folks. comment echo --!mailspf_sep-->>*mailspfm comment comment Mail the message. comment xeq SENDMAIL.PUB.SENDMAIL "-t" <*mailspfm comment comment Clean up. comment purge mailspfl,temp purge mailspfm,temp reset mailspfl reset mailspfm reset mailspfs deletevar mailspf_@ elseif UPS("!entry") = 'LISTSPF' then comment comment Scan the :LISTSPF output, looking for spoolfile lines. comment while SETVAR(mailspf_word,& STR(SETVAR(mailspf_line,INPUT()),1,POS(' ',mailspf_line)-1)) <> 'INPUT' do if LFT(mailspf_word,1) = '#' then comment comment Found a spoolfile; generate a message body for it. comment xeq !HPFILE entry=file endif endwhile elseif UPS("!entry") = 'FILE' then comment comment Do a magic :FILE equate for the spoolfile name. comment setvar mailspf_file RHT(mailspf_word,-2)+'.OUT.HPSPOOL' file mailspfs=!mailspf_file,old;nomulti comment comment Generate the body headers. comment echo --!mailspf_sep>>*mailspfm echo Content-Type: text/plain; charset=us-ascii; name="!mailspf_file">>*mailspfm echo Content-Transfer-Encoding: 8bit>>*mailspfm echo >>*mailspfm comment comment Generate the body content. Note that CCTL bytes are stripped. comment xeq CAT.HPBIN.SYS <*mailspfs >>*mailspfm endif