basic.printer
Toggles crt/Spooler output or closes entry.
Syntax
printer on printer off printer close printer num.expression
Description
controls the output from subsequent 'print', 'heading', 'footing' or 'page' statements.
'printer on' directs output to the system printer, via the Spooler.
'printer off' directs output from subsequent 'print' statements to the terminal.
'printer close' indicates that the current (printer) output is completed. This closes all open Spooler entries generated by the current process, and releases control of the print job(s) to the Spooler. 'printer close' is implicit when the Pick/BASIC program stops and returns to TCL, or the calling PROC or executing program.
'num.expression' evaluates as follows:
-1 'printer close'
0 'printer off'
>=1 'printer on'
See the 'crt' statement for directing output to the terminal while 'printer on' is in effect.
Example
print 'press <return> to begin printing'
printer on
print 'this is the first line'
The first string is displayed, print output is turned on, and the second string
is Sent to the spooler.
crt 'print? ':;input answer
printer (answer='y')
The printer is turned on if the variable 'answer' is the letter
'y'.
printer on
print rec<5>
if rec<6>='' then
printer off
print 'error in attribute 6'
print 'press <return> to continue ':
input continue
printer on
end
This section of program turns off the printer to display an error message and
prompt for operator intervension. When the printer is turned back on, output is
appended to the currently open spooler file.
10 *
print 'do you want to print? ':
input ans
if ans # 'y' then stop
printer on
print 'the amount is ':amount
print ...
....
printer close
printer off
goto 10
In this example, a single section of a larger program sends output to the
Spooler, closes the job when finished, and continues execution of the program.
See Also
User Comments
What do you think?
Share your experience or ask a question by using the form below.
Login to leave your comments.
