Printing with SQR

This chapter discusses how to:

 

Click to jump to parent topicSpecifying Output File Types by Using SQR Command-Line Flags

Except on the Microsoft Windows platform, SQR does not actually print a report. SQR creates an output file that contains the report, but does not print it directly. The output file can be a printer-specific file or an SQR portable file (SPF). SQR portable files have a default extension of .spf or .snn (for multiple reports).

The following table summarizes SQR command-line flags and the types of output that they produce:

Command-Line Flag

Output File Extension

File Format

Suitable Usage

-PRINTER:EH

.htm

Enhanced HTML

Intranet or internet

-PRINTER:HP

.lis

PCL

HP LaserJet printer

-PRINTER:HT

.htm

HTML

Intranet and internet

-PRINTER:LP

.lis

US ASCII

Line printer

-PRINTER:PS

.lis

PostScript

PostScript printer

-PRINTER:WP

None.

Output goes directly to the default printer without being saved to a file. You can set the default printer by using the Microsoft Windows Control Panel.

Not applicable

Microsoft Windows

-NOLIS

.spf or .snn

SQR Portable file

SQR Print and SQR Viewer can print this file to different printers.

-KEEP

.spf or .snn (in addition to the .lis file that is normally created)

SQR Portable file and the format of the .lis file

SQR Print and SQR Viewer can print this .spf file to different printers.

No flag

.lis

US ASCII, PCL, or PostScript

Line printer, HP LaserJet, or PostScript, respectively

Note. When no flags are specified, SQR produces a line printer output unless it is otherwise set in the SQR program with DECLARE-PRINTER, USE-PRINTER-TYPE, or the PRINTER-TYPE option of DECLARE-REPORT.

SPF is a printer-independent file format that supports all of the SQR graphical features, including fonts, lines, boxes, shaded areas, charts, bar codes, and images.

This file format is useful for saving the output of a report. SPFs can be distributed electronically and read with the SQR Viewer. Producing SPF output also enables you to decide later where to print it. Use SQR Viewer or SQR Print to print an SPF.

Click to jump to parent topicUsing 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 three methods:

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 the output. On platforms other than Microsoft Windows, if the 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 is a one-way conversion—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 a report output to the 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.

See Also

Creating Multiple Reports from One Program