Assigning Files to Local Printers

For runtimes that use a_termcap, you may assign files to local printers. This makes it easy to switch between local and spooled printing in a single program--all you need to do is assign to a different device.

To assign a file to a local printer, assign the file to the filename LOCALPRINT. The file must be either a print file or a line sequential file, and it must be opened for OUTPUT or EXTEND.

If the terminal does not have enable-print/disable-print control sequences defined for it, you will receive an error 35 when you try to open the file. Otherwise, the open will succeed and you should be able to use WRITE statements normally. Note that the runtime has no way of knowing whether or not a printer is actually attached to the terminal.

The runtime sends an enable-print sequence prior to each line and a disable-print sequence after each line. If you prefer, you may assign to LOCALPRINT-C instead (the C stands for "continuous"). If you do this, then a single enable-print sequence is sent prior to printing the first line, and a disable-print sequence is sent when the file is closed. Note that this will cause any terminal output to be printed, so this should be used with care.

For runtimes that do not use a_termcap (such Windows), you should assign directly to the print device instead. This facility is not currently available under VMS.