Introduction | Reporter Commands | Index |
Syntax: |
PRINTER device-name [,printer-control] [;printer-control] ... PRINTER PROMPT [,printer-control] [;printer-control] ... PRINTER file-name[.extension][,directory-name][,T|S|D|H] where: T = text file S = standard data format (also called "SDF") D = comma-delimited fields H = comma-delimited fields, with header record containing field names note: For output to delimited files (D or H), an extra parameter may be used to specify the delimiter character. The syntax for this parameter is: DELIMITER is "delimiter-character" PRINTER TERMINAL[,HTML|TEL|132] HTML = display output in default web browser TEL = output on TeleVideo terminal or other 132-column workstation 132 = 132-column Comet workstation |
Placement: | Place the PRINTER command before the REPORT command and after any ERASE, MARGIN, or LOG commands. |
Discussion: |
The PRINTER command sends your report output to a
printer, a print spooler, a terminal or Comet screen, disk file,
or web browser.
Printing to a printer or spooler Optionally, you can include one or more printer control codes in the PRINTER statement. These control codes must be valid MTB printer mnemonics or hex control codes. The control code(s) will be sent to the printer at the beginning of each page. (This feature was added because of user comments that the default printer settings are restored on Novell networks if printing delays are encountered.) In general, here is the syntax for using printer controls: PRINTER LP1,(PrinterMnemonic1);(PrinterMnemonic2) PRINTER LP2,"@xxxxxx@";(PrinterMnemonic1)All of the characters following the comma (after the device name) are simply copied into a FORMAT statement and compiled into the report.
Printing to a user-specified device Optionally, you can include one or more printer control codes in the PRINTER PROMPT statement. See above for details.
Printing to a disk file You may also include a parameter to specify the file format. If you do not include this parameter, the entire report (including page headers, column headings, and line breaks) is written to a sequential data file. The following options are available for this parameter:
Notes:
Printing to the terminal screen or web browser
|
History: |
|
Example 1: |
The following report will be printed on LP2:
PRINTER LP2 INPUT CUSTOMER REPORT PRINT CUST.NAME,CUST.NUMBER |
Example 2: |
The following report will be printed on print spooler SP2 with
a spool job message:
PRINTER SP2,(Spool Message="Customer Name Listing") INPUT CUSTOMER REPORT PRINT CUST.NAME,CUST.NUMBER |
Example 3: |
The following report will be displayed on the user's screen:
PRINTER TERMINAL INPUT CUSTOMER REPORT PRINT CUST.NAME,CUST.NUMBER |
Example 4: |
The following report will be displayed in HTML format in the user's web browser:
PRINTER TERMINAL,HTML INPUT CUSTOMER REPORT PRINT CUST.NAME,CUST.NUMBER |
Example 5: |
The following report will prompt the user for a printer name
when the report is run:
PRINTER PROMPT INPUT CUSTOMER REPORT PRINT CUST.NAME,CUST.NUMBER |
Example 6: |
The following report will be written to a text file
named MYREPORT.TXT on directory RPT:
PRINTER MYREPORT.TXT,RPT,T INPUT CUSTOMER REPORT PRINT NAME,PHONE,CREDIT.LIMIT |
Example 7: |
The following report will be written to a standard data format file
named MYREPORT.DAT on directory RPT:
PRINTER MYREPORT.DAT,RPT,S INPUT CUSTOMER REPORT PRINT NAME,PHONE,CREDIT.LIMITHere is a sample of the disk file format: John Smith (800) 555-1212 5000.00 Jane Doe (800) 555-1313 6000.00 |
Example 8: |
The following report will be written to a comma-delimited file
named MYREPORT.CSV on directory RPT::
PRINTER MYREPORT.CSV,RPT,D INPUT CUSTOMER REPORT PRINT NAME,PHONE,CREDIT.LIMITHere is a sample of the disk file format: "John Smith","(800) 555-1212",5000.00 "Jane Doe","(800) 555-1313",6000.00 |
Example 9: |
The following report will be written to a comma-delimited file, and
will include a header record with field names:
PRINTER MYREPORT.CSV,RPT,H INPUT CUSTOMER REPORT PRINT NAME,PHONE,CREDIT.LIMITHere is a sample of the disk file format. Note the header record. "NAME","PHONE","CREDIT.LIMIT" "John Smith","(800) 555-1212",5000.00 "Jane Doe","(800) 555-1313",6000.00 |
Example 10: |
The following report will be written to delimited file with a user-specified
delimiter character of "|".
PRINTER MYREPORT,RPT,D,DELIMITER IS "|" INPUT CUSTOMER REPORT PRINT NAME,PHONE,CREDIT.LIMITHere is a sample of the disk file format. "John Smith"|"(800) 555-1212"|5000.00 "Jane Doe"|"(800) 555-1313"|6000.00 |
Example 11: |
The following report will be written to delimited file with a user-specified
delimiter character of "@09@" (the tab character).
PRINTER MYREPORT.TAB,RPT,D,DELIMITER IS "@09@" INPUT CUSTOMER REPORT PRINT NAME,PHONE,CREDIT.LIMITHere is a sample of the disk file format. The fields are separated by a tab. "John Smith" "(800) 555-1212" 5000.00 "Jane Doe" "(800) 555-1313" 6000.00 |