DEFINE PRINTER

DEFINE PRINTER([logical-printer-name=]n)
[OUTPUT operand1]

PROFILE operand2
DISP operand2
COPIES operand3

../graphics/sbc3.gif

This document covers the following topics:

For explanations of the symbols used in the syntax diagram, see Syntax Symbols.

Related Statements: AT END OF PAGE | AT TOP OF PAGE | CLOSE PRINTER | DISPLAY | EJECT | FORMAT | NEWPAGE | PRINT | SKIP | SUSPEND IDENTICAL SUPPRESS | WRITE | WRITE TITLE | WRITE TRAILER

Belongs to Function Group: Creation of Output Reports


Function

The DEFINE PRINTER statement is used to assign a symbolic name to a report number and to control the allocation of a report to a logical destination. This provides you with additional flexibility when creating output for various logical print queues.

When this statement is executed and the specified printer is already open, the statement will implicitly cause that printer to be closed. To explicitly close a printer, however, you should use the CLOSE PRINTER statement.

Syntax Description

Operand Definition Table:

Operand Possible Structure Possible Formats Referencing Permitted Dynamic Definition
operand1 C S       A                       yes no
operand2 C S       A                       yes no

Syntax Element Description:

Syntax Element Description
(n)
Printer Number (Report Number):

The report number n may be a value in the range of 0 - 31. This is the number also to be used in a DISPLAY / WRITE or CLOSE PRINTER statement.

Report number 0 indicates the output channel of the main report. Only output statements such as PRINT, WRITE or DISPLAY are affected. The INPUT statement is not affected.

logical-printer-name
Logical Printer Name:

Optionally you can assign a logical name logical-printer-name to printer n. This name can be used for the rep notation in a DISPLAY / WRITE statement.

Naming conventions for logical-printer-name are the same as for user-defined variables. Multiple logical names may be assigned to the same printer number. Unlike the value of the OUTPUT operand (see below), logical-printer-name is evaluated at compile time and therefore independent of the program control flow.

OUTPUT operand1
Printer Name:

If operand1 is a variable, its format/length must be A8 or one of the following. The name must be specified as LPTnn, where nn may be a number in the range of 1 - 31. See also Example 1.

Note:
If the output data written to a report is to be sent to an Entire Connection terminal and then be written to an NCD file on a PC, one of the printer names LPTnn (where nn is a number in the range of 1 - 31) must be specified as operand1.

Note:
The device assignments of logical printer LPTnn must be set in the Configuration Utility; see Device/Report Assignments. As Device Destination of the Physical Output Device, the value E (send data to an Entire Connection terminal) must be specified.

Additional reports can be assigned with the following names:

Report
Function
DUMMY Output to be deleted.
INFOLINE Output to the Natural infoline. For details on the infoline, see the Natural terminal command %X in the Terminal Commands documentation. See also Example 2.
SOURCE Output to the Natural source area.
NOM Output to Entire Output Management. Refer to the Entire Output Management documentation for details.
PROFILE operand2
Name of Printer Control Characters Table:

With the PROFILE clause, you specify as operand2 the name of a printer control characters table. The maximum length allowed for operand2 is 8.

Such a table is defined in the global configuration file. See Printer Profiles in the Configuration Utility documentation for details on how to set printer profiles.

DISP operand2
Disposition:

Maximum length of operand: 4 bytes.

Possible values for operand2:

DEL The temporary spool file is deleted after its content has been printed. This is the default value.
KEEP The temporary spool file is not deleted after its content has been printed.
HOLD The temporary spool file is neither deleted nor printed.
COPIES operand3
Number of Copies:

operand3 must be an integer value.

Examples

Example 1 - Printer Name Definition

/* PRINTER NAME DEFINED FOR WINDOWS
*
DEFINE PRINTER (REPORT1 = 1) OUTPUT 'LPT1'
WRITE (REPORT1) 'REPORT 1 PRINTED ON PRINTER LPT1'
END

Example 2 - Print Output to Infoline

** Example 'DPIEX1': DEFINE PRINTER                                     
************************************************************************
*                                                                       
SET CONTROL 'XI+'        /* SWITCH INFOLINE MODE ON                     
SET CONTROL 'XT'         /* INFOLINE TOP                                
*                                                                       
DEFINE PRINTER (1) OUTPUT 'INFOLINE'                                    
WRITE (1) 'EXECUTING' *PROGRAM 'BY' *INIT-USER                          
WRITE 'TEST OUTPUT'                                                     
EJECT                    /* FORCE PHYSICAL I/O                          
*                                                                       
SET CONTROL 'X'          /* SWITCH BACK TO NORMAL                       
*                                                                       
END

Output of Program DPIEX1:

EXECUTING DPIEX1   BY HTR                                                      
Page      1                                                  05-01-13  14:54:33
                                                                               
TEST OUTPUT