#!/usr/bin/ksh # # Make sure the PATH variable includes # where Suprtool and STExport usually reside. # PATH=$PATH:/usr/local/bin:/opt/robhome/bin webmaster="webmaster\@mycompany.com" # # Create a temporary logfile # and get a filename for the temporary extract file # temp_sxlog=`mktemp` touch $temp_sxlog temp_sxdata=`mktemp` # # Run Suprtool and extract the data. # - Read commands using "here-is" # - write messages to temporary logfile # suprtool <> $temp_sxlog Open Allbase /users/allbase/db/PartsDBE demo Select * From demo.sales Item purchasedate, date, yyyymmdd Item deliverydate, date, yyyymmdd Item price, decimal, 2 Item salestax, decimal, 2 Item salestotal, decimal, 2 If purchasedate <= \$today(-1) Sort customernum Output $temp_sxdata,Link Exit !EOD if [ $? -eq 1 ] then echo "Content-type: text/html\n\n"; echo "\n"; echo "\n"; echo "Comment Form Error\n"; echo "\n"; echo "\n"; echo "

Comment Form Error

\n"; echo "
\n"; echo "

\n"; echo "Form input was not proccessed. Please mail your "; echo "remarks to $webmaster"; echo "

\n"; echo "Content of the Suprtool/STExport logfile"; echo "

";
   cat $temp_sxlog
   echo "
", "\n"; echo "\n"; echo "\n"; exit 1 else # # Must go to the target directory # because of filename limit in STExport # and get a filename to store html output # cd /users/demo/public_html > /dev/null temp_stexpdata=`mktemp -d .` # # Execute STExport to create the html file # stexport <> $temp_sxlog Input $temp_sxdata HTML Table Title "Orders Created Yesterday" \ Heading "Orders Created Yesterday (sorted by customer)" Heading Fieldnames Date YYYYMMDD "/" Output $temp_stexpdata.html Exit !EOD if [ $? -eq 1 ] then echo "Content-type: text/html\n\n"; echo "\n"; echo "\n"; echo "Comment Form Error\n"; echo "\n"; echo "\n"; echo "

Comment Form Error

\n"; echo "
\n"; echo "

\n"; echo "Form input was not proccessed. Please mail your "; echo "remarks to $webmaster"; echo "

\n"; echo "Content of the Suprtool/STExport logfile"; echo "

";
      cat $temp_sxlog
      echo "
", "\n"; echo "\n"; echo "\n"; exit 1 else echo "Location: http://www.robelle.com/~demo/$temp_stexpdata.html\n" rm $temp_sxlog > /dev/null rm $temp_sxdata > /dev/null exit 0 fi fi