Defining Columns and Rows

The COLUMNS 1 29 57 command defines the starting position for three columns. The first column starts at character position 1, the second at character position 29, and the third at character position 57.

The ex9a.sqr program writes the first address into the first column, the second address into the second column, and the third address into the third column. The program writes the fourth address into the second row of the first column, following the first label. When 10 lines of labels are complete, a new page starts. After the last page of labels is printed, the program prints a summary page showing the number of labels that were printed.

Note the technique for composing the last line of the label. The city, state, and zip columns are moved to string variables. The command LET $last_line = &city || ', ' || &state || ' ' || $zip combines the city, state, and zip code, plus appropriate punctuation and spacing, into a string, which it stores in the $last_line variable. In this way, city, state, and zip code are printed without unnecessary gaps.

The program defines two counters: #label_count and #label_lines. The first counter, #label_count, counts the total number of labels and prints it on the summary page. The second counter, #label_lines, counts the number of rows of labels that were printed. When the program has printed the number of lines that are defined by {MAX_LABEL_LINES}, it starts a new page and resets the #label_lines counter.

After each row of labels, the NEXT-LISTING command redefines the print position for the next row of labels as line 1. NEXT-LISTING skips the specified number of lines (SKIPLINES) from the last line that was printed (NO-ADVANCE) and sets the new position as line 1.

Note the use of the ALTER-PRINTER command. This command changes the font in which the report is printed.

The sample program prints the labels in 10-point Times Roman, which is a proportionally spaced font. In Microsoft Windows, you can use proportionally spaced fonts with any printer that supports fonts or graphics. On other platforms, SQR directly supports HP LaserJet printers and PostScript printers.

In the sample program, the DECLARE-LAYOUT command defines a page width of 10 inches. This width accommodates the printing of the third column, which contains 30 characters and begins at character position 57. SQR assumes a default character grid of 10 characters per inch, which would cause the third column to print beyond the paper edge if this report used the default font. The 10-point Times Roman that is used here, however, condenses the text so that it fits on the page. The page width is set at 10 inches to prevent SQR from treating the third-column print position as an error.

See Printing Charts.