[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: Printing
Ray,
I would be happy to do that.
This approach combines SQR with DOS as the SQR code writes a text flat file,
then makes a system call to a batch file which routes the printer output.
There are multiple batch files, one for each printer, and SQR decides which
file to call based on some criteria in the report (such as a warehouse
location). In addition, the batch file not only sends the flat file to a
printer but also appends it to a log file for archiving and then deletes the
flat file so another one can take its place.
The procedure for calling the batch files could be something like this:
begin-procedure file_out !routes printing based on location
evaluate $stloc
when = '<location A>'
move 'c:\temp\prntA.bat' to $command
when = '<location B>'
move 'c:\temp\prntB.bat' to $command
end-evaluate
call system using $command #status
!delay timer - gives output printer time to complete before another call
while #timer != 1000000
add 1 to #timer
end-while
move 0 to #timer
end-procedure
The delay timer is just to make sure another output does not call the next
batch file too early, resulting in the current one getting deleted. The
variable "$stloc" is selected earlier in the program.
An example of the batch file for an output named "prnt.txt" might be:
@echo off
if exist c:\temp\prnt.txt goto print
exit
:print
type c:\temp\prnt.txt > lpt1
type c:\temp\prnt.txt >> c:\temp\logs\prnt.log
type c:\temp\spaces.txt >> c:\temp\logs\prnt.log
del c:\temp\prnt.txt
exit
This .bat looks for the output flat file and if it exists sends it to a
printer (in this case LPT1 but any network address would do such as
\\printers\prt1). The "spaces.txt" file is just a text file with empty lines
for separation between appends.
It's important to note that as the SQR code "builds" the output text file it
must keep track of how many lines have been written in order to create a
virtual page. The printer will only see a giant text file and will not
determine on its own where the end of each page is. I include a rowcounter in
my code that gets re-set at the end of each "page" and writes a "footer" to
the current "page", then a "header" to the next "page".
Hopefully this is enough to offer some explanation. Feel free to make
comments, suggestions, etc. or if anything is unclear I'll be happy to
elaborate. I must also give credit to some folks at Shell Oil who designed
the batch file approach and have been using it for fax outputs for a number of
years. The above is a collaborative effort, not only mine.
___________________________________
Chris Snow, Integrity Information Services
(800)724-5939 pgr
chris_snow@msn.com
'As Knowledge Increases, Wonder Deepens'
Charles Morgan
-----Original Message-----
From: Ray Brunner
Sent: Tuesday, November 25, 1997 8:31 AM
To: chris_snow@msn.com
Subject: Printing
Sometime ago you mentioned that you had developed a solution for
routing reports to various printers in dos. Could you share that with
the rest of the sqr listserv?
Thanks
*************************
Ray Brunner
rabrunne@syr.edu
443-9262
Syracuse University
*************************