Quiz and Sendmail
Tracy Johnson
vzeo5z3y at verizon.net
Tue Apr 11 09:53:52 CDT 2006
I've been e-mailing quiz reports for some years using sendmail in the HP environment. Although it can be done with just plainwrap Quiz and sendmail, it is also more difficult to script/code. Below is a list of some useful tools to help you in your quest:
(If you already know this stuff, my apologies if I sound patronizing.)
o MPEX/3000 (from VESoft)
o Security/3000 (from VESoft)
o Sheetmate (from Hillary Software)
o txt2pdf (from Sanface)
o MPEX/3000
One of the things I discovered along the way, was that sendmail DOES NOT LIKE the extra disc space added to the end of Quiz reports when SET REP DEV DISC is used. Since I already had MPEX, the method to clear this up was:
%ALTFILE MYREPORT;FLIMIT=EOF;XLTRIM;LOCAL;DELACD
This cleans it up nicely. It also holds helps with txt2pdf.
o Security/3000
Although used for a plethora of other reasons, mostly to eliminate job passwords and provide text menus, another little known feature is the elegant double colon (::) method for prompting of variables in job streams. Yes you can do this with pure Quiz to build a streamable job file but the complexity is less. I typically use it thus:
::prompt string address = "Enter email address: "
Where the variable {address} is used later.
o Sheetmate (from Hillary Software)
There are many ways to get reports into Excel or Access out of Quiz such as ODBC or hard coding comma delimited reports, this is just another one of them. Sheetmate takes much of the risk out of users taking ODBC into their own hands and hogging the system. At the same time it helps you avoid tedious coding of comma delimited Quiz reports. It converts Quiz subfiles directly into Excel (although I have to use FORMAT 7.)
In Quiz:
>SET SUBFILE NAME MYREPA KEEP FORMAT 7
In Sheetmate:
$INPUT MYREPA
$FORMAT EXCEL
$OUTPUT MYREPORT
o txt2pdf (from Sanface)
On the other hand, if you don't want a spreadsheet and prefer .pdf, this is good way to go. The price is right too, when I bought it a few years ago, it was only slightly over a hundred bucks. On my system, I typically go into the shell.
sh
perl -w /txt2pdf/txt2pdf.pl -configure /txt2pdf/txt2pdf.cfg -v -landscape ./MYREPORT -m .
exit
(The perl command above is on one line in case it gets wrapped.)
It is also much happier if you prefix it with the MPEX %ALTFILE command I mentioned above.
Finally going into sendmail itself:
sh
uuencode MYREPORT myreport.xls > myreport
cat myreport | mailx -s "Myreport.xls" {address}
rm myreport
exit
If it were a converted pdf it would have instead:
sh
uuencode MYREPORT.pdf myreport.pdf > myreport
cat myreport | mailx -s "Myreport.pdf" {address}
rm myreport
exit
"uuencode" mime encodes the file so you may attach it.
"cat" pipes the encoded file into sendmail.
Since it there is no such thing as a temp file in the the shell I need to manually "rm" the uuencoded file, since I probably won't need it again.
BT
Tracy Johnson
Ye olde fashioned text games at:
http://hp3000.empireclassic.com/
NNNN
More information about the powerh-l
mailing list