HP-UX SNAplus2 RJE User's Guide

Program Output with PDIRs
Output Program Example
Appendix A162
#This script requires that the output file contains at least
#three PDIRs. There is a header, a trailer and at least one
#other section of output. Otherwise, it will not work.
#Change the name of the printer= statement to assign the
#desired printing program.
#The location of the temporary output file is the 14th
#parameter passed to the program. From this name the script
#can get the name of the PDIR file.
output file=$14
pdir_file=$output_file.i
###################################################
#Turn off output from stdout or stderr; comment these lines
#out for debugging purposes
exec 2> /dev/null
exec 1> /dev/null
###########################################################
exec 3< $pdir_file
integer count=2
integer n=0
integer copies
integer offset
integer end
integer trailer
integer start_header
integer start_trailer
integer start_body
#Read in PDIR first 5 values into arrays
while read -u3 offset[n] type[n] date[n] time[n] form[n] \
fcb[n] train[n]
do
((n = n + 1))
done
#end = last line of PDIR file
((end = n - 1))
#exit if we have not read at least 5 lines (3 PDIRs plus OPEN and
#CLOSE statements)
if ((end < 5))
then
exit 1
fi