This chapter discusses how to:
Specify output file types by using SQR command-line flags.
Use the DECLARE-PRINTER command.
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 |
.htm |
Enhanced HTML |
Intranet or internet |
|
.lis |
PCL |
HP LaserJet printer |
|
.htm |
HTML |
Intranet and internet |
|
.lis |
US ASCII |
Line printer |
|
.lis |
PostScript |
PostScript printer |
|
None. Output goes directly to the default printer without being saved to a file. You can set the default printer by using the Windows Control Panel. |
Not applicable |
Windows |
|
.spf or .snn |
SQR Portable file |
SQR Print and SQR Viewer can print this file to different printers. |
|
.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.
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:
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.
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.
The DECLARE-REPORT command is normally used 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-PRINTERcommand 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. |
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