Using the DECLARE-PRINTER Command

The DECLARE-PRINTER command specifies printer-specific settings for the output file types that SQR supports: line printer, PostScript, HP LaserJet, and HTML. The DECLARE-PRINTER command itself does not cause the report to be produced for a specific printer. To specify a specific format, use one of these methods:

  • The -PRINTER:xx command-line flag.

    For example -PRINTER:PS produces PostScript output. If the program creates multiple reports, such as the sample program ex18a.sqr, the -PRINTER:xx flag produces the same output format for all of the reports.

  • The USE-PRINTER-TYPEcommand.

    You must use this command before you print because SQR cannot switch the printer type in the middle of a program. USE-PRINTER-TYPE PS, for example, produces PostScript output.

  • The PRINTER-TYPE option of the DECLARE-REPORT command.

    You normally use the DECLARE-REPORT command when a program generates more than one report.

For example, the following code example produces PostScript output for the labels report:

declare-report labels
    layout=labels
    printer-type=ps
end-declare

The DECLARE-PRINTER command defines settings for line printers, PostScript, or HP LaserJet printers. Specify the type of printer by using the type option of the DECLARE-PRINTER command or one of the predefined printers: DEFAULT-LP, DEFAULT-PS, DEFAULT-HP, and DEFAULT-HT.

A program can have more than one DECLARE-PRINTER command if you define settings for each of the printer types. The settings for a particular printer take effect only when output is produced for that printer. When the program generates multiple reports, you can define settings for each printer for each report. To make a DECLARE-PRINTER command apply to a specific report, use the FOR-REPORTS option.

The output file normally has the same name as the program, but with a different file extension. The default file extension is .lis for PostScript (PS), HP LaserJet (HP), or Line Printer (LP). If you are generating an SPF, the default extension is .spf. If you want SQR to use another name for the output file (including a user-defined file extension), use the -F option on the command line. For example, to use chapter1.out as the output of the sample program ex1a.sqr, use this command to run SQR:

sqr ex1a username/password -fchapter1.out

When a program creates more than one report, you can name the output file by using multiple -F flags:

sqr ex20a username/password -flabel.lis -fletter.lis -flisting.lis

You cannot directly name .spf files. You can still use the -F command-line flag to name the file, but you cannot control the file name extension. For example:

sqr ex20a username/password -flabel.lis -fletter.lis -flisting.lis -nolis

The -NOLIS command-line flag causes SQR to produce .spf files instead of .lis files. The actual file names are label.spf, letter.s01, and listing.s02. The second .spf file is named .s01 and the third is named .s02. SQR supplies file extensions such as these when a program generates multiple reports.

Different operating systems require different techniques for printing output. On platforms other than Microsoft Windows, if output is in SPF format, you first use SQR Print to create the printer-specific file. For example, the following command invokes SQR Print to create a PostScript file named myreport.lis from the output file named myreport.spf:

sqrp myreport.spf -printer:ps

This conversion is one-way—an .spf file can be converted to an .lis file, but an .lis file cannot be converted to an .spf file.

The following table summarizes the commands and command-line options that you can use on different systems to send report output to a printer. Consult your operating system documentation for details.

Operating System

Command

Command-Line Options

UNIX

lp myreport.lis

lp myreport.lis -d ...

Use -D for printer destination. You can use the UNIX at command to schedule the printing time.

Microsoft Windows

SQR prints directly. You can also use SQR Viewer.

Use the Print Setup dialog box in SQR Print or the SQR Viewer to select a printer destination. Use SQR Print to print multiple copies.

You can also use the File Manager Copy command to copy the file to the printer destination (for example, lpt1).

Check with your systems administrator about other procedures or commands that are applicable to printing output files at your site.