Bay City, Michigan
Sales (989) 892-9242             Support (989) 686-8860
ANSI Standard Visual PL/B Language
DOS style PRINT
The PRINT statement is the original printing technique for PL/B. There are limited built in control statements and most deal with the handling of the data, not controlling the printer. For example *LL says print the logical length of a string variable. The only list controls that affect the printer are the old *C (carriage return), *F (form feed), *L (line feed) and *N (new line).WHY would a Windows programmer need PRINT?
Using PRINT, the programmer is responsible for all printer controls. These usually are printer specific. One must decide what type of printer is in use and then use the appropriate excape sequence codes to tell the printer what to do. Selecting fonts, bolding, etc. for a LaserJet is completely different from an IBM ProPrinter dot matrix.
PRTPAGE, on the other hand, is a WINDOWs printing instruction. It sends the output to a windows printer driver and it can do everything without any regard to the specific printer. (See PRTPAGE section.)There are, in fact, times when a Windows program needs to use the PRINT instruction. The most obvious is for older printer which may not have a Windows print driver available. The second reason is for old DOS programs which are just brought over to Windows without change. Those program will have PRINTs rather than PRTPAGE.USING PRINT
PRINT is commonly used for special purpose devices such as RECEIPT printers, BAR CODE LABLE printer, and old dot matrix printers. When using those printers, you must read their manuals and provide any special codes yourself.
For simple print jobs no control codes may be necessary at all. For example the print task for a receipt printer may be just a simple list of items sold. Those can be simply printed from line to line. A bar code label printer, however, absolutely requires control codes embedded in the print string.PRINT can generally just be used as is. When you do a PRINT, the printer prints. When you're done you do your own final *F to form feed the last page out.MMCC's "DRIVERS"
On networked DOS systems, this worked fine. Printer output would be spooled under control of the network. Most networks had a setting to "truncate" a job and start printing after a given amount of time had elapsed with no print activitiy.
Under Windows 95 we learned that print jobs would not "truncate" and print until the program actually closed and returned control to Windows. In most production jobs, the user would be running from a menu program which is chaining to other programs to do tasks. Getting these to print meant that the entire system had to be exited.
The solution for Windows turned out to be the SPLOPEN/SPLCLOSE instruction. A program can issue SPLOPEN "LPT1" before starting to print. When done the program issues SPLCLOSE and Windows will immediately print the spooled job.MMCC has three canned routines for using the PRINT statement. These, in effect, are our own printer drivers. The MASTER program identifies the printer type for the specific port and that identifier is carried in COMMON. All print control is done via the included "OKI..." routines. Those routines check the type of printer and process the request using codes appropriate to that printer.Other Notes
The INCLUDE files are:
To use this routine, the program identifies the printer and a few characteristics in a string called OKIPRINT. The string is broken down via UNPACK OKIPRINT INTO OKIPT, OKITYPE, SELCPI, SELQUAL, SELLPI. These fields are:
- OKIINCWK.DBS provided work areas for most printing tasks.
- OKIINCDO.DBS is a set of routines for handling a variety of printers. This is, in effect, a multi purpose driver. Printers covered include:
- HP LaserJet
- IBM proprinter
- EPSON dot matrix
- STAR in IBM mode
- OKIDATA ML series (82/84)
- OKIDATA in IBM mode (32)
- OKIDATA Pacemark series
- OKI_CALL.DBS includes a few additional printer setting routines which supplement OKIINCDO. This was done separately for those bad old days when executable programs size was limited by the amount of available memory. Some programs would include it, others would not.OKIPT Always "P*" OKITYPE Identifies the printer: LJ, L4, IB, EP, SI, 82, 84, 32 SELCPI Characters per inch 0=proportional, 1=10cpi 2=12cpi, 3=17cpi, 4=20cpi SELLPI Lines per inch: 6, 8, 10 SELQUAL Quality: Y=Letter qual, R=draft, other = default
The above codes were originally intended to provide all commonly needed controls. The OKIPRINT string is carried in COMMON. The MASTER program sets the printer type based on some type of port configuration. From on, other programs unpack the string, change specifications, then pack the string up again. Then the program calls OKISET to set the printer accordingly.
Over time, a number of other routines were written to set specific requirements:
- OKISET: Unpacks the OKIPRINT string and sets the printer accordingly
- OKICPI: Sets the CPI only
- OKILPI: Sets the LPI only
- OKIBOLD: Sets bold ON
- OKIBOLDN: Sets bold OFF
- Plus a few other routines.
The following notes come from discussions on the Sunbelt Web board:
- The following came from a discussion of sending control codes to Windows printers over the network. The problem was getting around the Windows printer driver on the target machine.
"Matthew recently revealed to me an undocumented feature of SPLOPEN. Use SPLOPEN PFILE,DeviceName,"R". "R" is obvious for "RAW" and it works! All of our SPLOPEN routines have been modified and we have ditched the need to specify LPTx. It works great!"