SETPTR |
|
|
The SETPTR command sets print unit characteristics.
Format
SETPTR unit {, width, depth, top.margin, bottom.margin, mode {, options }} SETPTR DISPLAY {LPTR {printer}} SETPTR unit, DISPLAY
where
If only unit is given, the current settings of the print unit are reported.
Use of the DEFAULT keyword in place of a unit number records the default values to be used when a new print unit is accessed without prior use of SETPTR to define its settings. Note that this operation does not affect the default printer, print unit 0, which is configured with standard default settings on entry to QM. These can be changed with a SETPTR command specifying unit 0.
The third form of SETPTR with a unit number and the DISPLAY keyword shows the current settings in a form that can be captured by a program and later used to restore the settings by executing a SETPTR command with the captured value appended.
When using printer modes 3 or 6, a check is made to see if there is a catalogued subroutine named HOLD.FILE.LOGGER and, if there is, this is called when the file is opened and again when it is closed. This subroutine can be used, for example, to build a log of hold file entries or to take some action after the file has been closed. The subroutine takes three arguments; the print unit number, a flag indicating if this is an open (1) or a close (0), and the pathname of the file being created.
The options available are:
id is the name of the record to be created in the $HOLD file. If omitted, a default name of Punit is used. The optional NEXT keyword causes QM to attach an underscore and a cyclic sequence number to the end of the name so that successive output is stored separately. Note that this sequence number is shared across all printer output directed to the $HOLD file by all processes, thus two successive jobs from one process may have non-adjacent sequence numbers. The default behaviour is for the sequence number to be four digits, cycling through the range 0001 to 9999. The next available sequence number is stored in field 2 of a record named $NEXT in the dictionary of the $HOLD file. An alternative number of digits in this value may be specified in field 3 of this dictionary record and must be in range 3 to 9. The sequence number can be determined using the GETPU() function or the @SEQNO variable. If id is a quoted null string, the underscore is omitted. These two variants of the AS clause may be combined (AS FILE name NEXT id). When used in this way the sequence number management process described above uses the dictionary of the named file. Use of AS NEXT "" will create items where the name is just the sequence number.
Mode 5 provides a way to print on printers connected to the client system. For users connecting to QM from AccuTerm using a terminal type with the -at suffix, the AT option can be used to select a printer name which is known to the client PC.
The SPOOLER option can be used to access another standard operating system spooler package or to direct output to a user written shell script or program to perform custom processing. The $SPOOLERS record in the VOC of the QMSYS account can be used to configure different options from those described above. See Printing for details. As an aid to diagnosing printing problems, the SPOOL.COMMAND option of the OPTION command can be used to display the operating system command used to initiate printing.
GDI Printers The following additional options can be used with GDI mode printers on Windows. If neither of the FONT and FONT.SIZE options is present, the printer's default font is used, otherwise default values are as shown below.
PCL Printers The following additional options are available. Although the values set will be saved and can be accessed by application software, they only affect printing when used with the PCL option. In many cases, the list of acceptable parameter values can be extended by modifying the SYSCOM $PCLDATA record.
When setting a print unit to PCL mode, if the above parameters are not specified, printing defaults to 10 cpi, 6 lpi, medium weight using A4 paper and the Roman8 symbol set. These defaults can be modified by adding an X-type record named $PCL to the VOC. This record must have an X as the first character of field 1. Remaining fields may contain any of the CPI, LPI , PAPER.SIZE, SYMBOL.SET and WEIGHT parameters as described above. For example: 0001: X 0002: PAPER.SIZE LETTER 0003: LPI 5
Note: The quality of PCL implementations varies widely and these options may not give the expected results on some printers. In particular, setting some font metrics may cause inconsistent character placement. It is the application developer's responsibility to ensure that the printed results are acceptable.
Windows Printing
On Windows systems, two styles of interface with the underlying Print Manager are supported. The GDI mode uses the Windows Graphical Device Interface API calls. Non-GDI mode uses an alternative set of API calls. For most purposes, the non-GDI mode is likely to be preferable.
The GDI parameter to SETPTR sets GDI mode and the RAW parameter sets non-GDI mode. The default is normally non-GDI but this can be modified by setting the GDI configuration parameter to 1.
Special Print Modes
Use of mode 4 (stderr) allows an application developer to direct output from a QM console session to the standard error file handle. It is the user's responsibility to ensure that this points to an appropriate destination as the default settings may cause the screen display to be overwritten. Data sent to a mode 4 printer is output immediately rather than being buffered by QM. Headings, footings and other pagination related features are ignored for printers in mode 4.
Mode 5 print units direct output to the terminal auxiliary printer port, typically to a printer local to the client. The data is buffered by QM until the print unit is closed and then sent to the terminal prefixed by the string defined in the mc5 terminfo entry for the selected terminal type. The data will be followed by the string defined by the mc4 terminfo entry. The mc5/mc4 pair should be set to the control codes necessary to enable/disable the printer port. For users connecting to QM via AccuTerm with a terminal type that has a -at suffix, the AT option to SETPTR can be used to select a printer name that is known to the client PC.
The SETPTR DISPLAY command displays a report of the settings of all print units. The optional LPTR keyword directs this report to a printer.
The $SETPTR.DEFAULTS VOC Record
When setting print unit configuration, the SETPTR command checks for an X-type record named $SETPTR.DEFAULTS in the VOC or, if not found, in the QMSYS VOC. If this record exists, fields 2 onwards can be used to set default options that will effectively be inserted after the mode value. Each field corresponds to a different print mode such that field 2 is used for mode 1, field 3 is used for mode 2 (currently not supported on QM), field 4 is used for mode 3 and so on. Thus, a $SETPTR.DEFAULTS record that reads 1: X 2: NEWLINE CRLF, INFORM would behave as though these two options were present when setting a print unit into mode 1. Because the default options are inserted between the mode and options elements of the command, they can be overridden by other options specifically set in the command.
Examples
SETPTR 0,80,66,3,3,1,AT laser,BRIEF Directs print unit 0 output to a printer named "laser" with a page shape of 80 columns by 66 lines and a 3 line top and bottom margin. The BRIEF option suppresses the normal confirmation prompt.
SETPTR 0,80,66,0,0,3,AS SALES_REPORT,BRIEF Directs print unit 0 output to a record named "SALES_REPORT" in the $HOLD file. The BRIEF option suppresses the normal confirmation prompt.
SETPTR 0,,,,,3 Directs print unit 0 output to the default $HOLD file record (P0), leaving all page shape parameters unchanged.
See also: |