ANSI
The PRINT instruction sends information to the default print device/file. RPRINT is treated exactly like a PRINT instruction. The instruction uses the following format:
|
|
|
|
|
Where:
label
Optional. A Program Execution Label.
pfile
Optional. A previously defined PFILE variable that routes the output to an alternate device/file.
list
Required. A list containing any combination of character string Literals, Character String Variables, numeric literals or variables (FORM), Expressions, VARLISTs of DIM, INIT, or FORM variables, ARRAYs, individual array elements, valid control characters, and valid List Controls,
;
Optional. A semicolon that inhibits the normal carriage return and line feed.
Flags Affected: NONE
Note the following:
Individual items within {list} are separated with commas. The list of items may be continued on additional lines by terminating each continued line with a colon (:).
If a spool file/device is open, the PRINT output is directed to it. Otherwise, it is directed to the default print device/file name. Under MS-DOS, it is directed to the default system printer destination. Under Linux, it is directed to the default print device/file name specified in the user's screen definition file. If null, it is directed to the file PORT####.PRT (where the #'s are replaced with the user's port number) in an append mode if the file exists.
Under Linux, the print device/file name is locked from access by other PL/B programs until a RELEASE is executed or the program terminates, returning control to the operating system.
The {pfile} variable allows printing to an alternate print file or device. The {pfile} must have been previously opened via the SPLOPEN or a PRTOPEN (9.6B) command.
For PLBCMP GUI, the first PRINT instruction that prints to a real printer invokes the standard print dialog.
If running under the PL/B Application Server (PLBSERVE), a {pfile} beginning with an exclamation mark (!) indicates that the file or device exists at the client workstation. The exclamation mark is not part of the filename. Other runtimes such as PLBWIN ignore the leading exclamation mark and it is not part of the file name.
If a FILEPI instruction is active, it is terminated.
The first PRINT or PRTPAGE *DEFPRT instruction that starts the printing operations to perform PDF output causes a Windows runtime or client to present a standard file prep dialog to get the name from an end-user because the output PDF file name is unknown. Additionally, if the PDF output is being generated at the server system for Application Server, a standard file prep dialog is not presented and an appropriate Snn error occurs because the PDF file name is unknown.
Literals
All characters within a pair of double quotes are sent to the default printer device/file exactly as they appear in the literal.
The first character in the literal is printed at the current print location.
The print location is incremented one position to the right for every character printed and remains one position to the right of the last character printed.
Control values (Ctrl) are sent as coded without translation or verification.
Variables
The contents of variables are printed on the printer whenever they appear in the list of a PRINT instruction. The first character printed is at the current print position. The print position is bumped one position for each character printed. It remains one position to the right of the last character printed. Unless modified by a list control, they are printed as follows:
Character String Variables
The print begins with the first physical character and continues through Length Pointer (LP).
Blanks are printed for each character between the Length Pointer and Physical Length (PL).
If the Form Pointer (FP) is zero, blanks are printed for each character position to the Physical Length.
If an item within the list is a character string Array and no specific array element has been designated, every array element is printed.
Numeric Variables
The print begins with the first physical character and continues through the Physical Length.
If an item within the list is a numeric array and no specific array element has been designated, every array element is printed.
Default Print Device/File
The PRINT instruction supports a default print device/file name format that allows a Windows print device (9.4C). The default print device/file name can be specified in the runtime screen definition file or it can be set using the SETMODE *DEFPRT keyword. The new device name format that allows the Windows device to be specified is as follows:
Where:
{mode}
Optional - The {mode} can be specified as a single character that is specified as 'A', 'R', or 'W'. If a {mode} character is specified, the access to the Windows printer device is defined as follows:
W or w - A Window's printer device name is being supplied in {prtname}. This is the default Windows printer device behavior if the {mode} is not specified.
A or a - A Window's printer device name is being supplied in {prtname}. In addition, the device is opened in a manner to allow absolute pass through mode. In this mode, data is passed to the printer device without the data being affected by the operating system.
R or r - A Window's printer device name is being supplied in {prtname}. In addition, the device is opened in raw data output mode. This mode may be used for printer drivers that don't support the absolute pass through mode (A).
{prtname}
Required - The {prtname} is required. The {prtname} is is a current Windows printer device name that has been installed on the system where the runtime is executing.
Examples:
Case I ( Default Windows print device )
Case II ( Default Windows print device using 'R' printer mode )
See Also: Example Code, List Controls, Printer Instructions
![]() |