$printline="O*N%1d5TG%5d ,CLS=%.8s,XXX,BAT=, \n"; $dest_mailbox=shift(@ARGV); $file=shift(@ARGV); $message_class=shift(@ARGV); # Set up a temp file as a holding file for valid lines $rand = int(rand(10000)); $tempfile="$file" . "$rand"; print "!Creating temp file: $tempfile!\n"; while (-f $tempfile) { $rand = int(rand(10000)); $tempfile="$file" . "$rand"; } # # Open the input file and temporary file # open (FILE, "$file") or &exit_with_error("!Error opening file for read: $file!\n"); open (TEMP, ">>$tempfile") or &exit_with_error("!Error opening file for write: $tempfile!\n"); # $total_lines=0; $hort=0; ** Prints to temp file the header record ** printf TEMP $printline,$hort, $dest_mailbox, $message_class; ** Prints to temp file the data from another file ** while () { $total_lines++; chomp($_); print TEMP "$_\n"; $data_lines++; } } ** Prints to TEMP file the trailer record. $hort=9; printf TEMP $printline, $hort, $dest_mailbox, $message_class;