The Report Writer is distributed with a configuration to print on stock paper. This paper is used for most of your reports. The size of the paper is measured in lines down and columns across. In addition, there are two margins: the first print line and the last print line. These two margins govern where your report is printed. When the last line is reached, spacing is done to advance the paper up to the next first print line at which point headings are processed.
Even though these attributes are configured into the Report Writer, there are ways of temporarily changing the configuration for a report. By changing these attributes, you are able to print on almost any kind of special form. The statement that changes the report attributes is the SET statement. In its simplest form it look like:
SET attribute := expression;
The attributes stated above can be changed with the following key word attributes:
Suppose you needed to change the form length to 56 lines. The SET statement for this would be
SET PAGELENGTH := 56;
As indicated in Chapter 10, Report Writer Programming Reference, the symbol = may be used in place of :=. This means the previous SET statement can also be:
SET PAGELENGTH = 56;
If you are printing a report that depends on a particular page length, you must set PAGELENGTH attribute.
You can have more than one SET statement; however, the SET command allows for an abbreviated form. Suppose you wanted to set up the report to print on your screen. You could use the following SET statements:
SET PAGELENGTH := 24;
SET PAGEWIDTH := 80;
SET FIRSTLINE := 1;
SET LASTLINE := 24;
With the short form of the SET statement, you could also use the following code to accomplish the same thing:
SET PAGELENGTH := 24,
PAGEWIDTH := 80,
FIRSTLINE := 1,
LASTLINE := 24;
This one statement accomplishes the same thing as the four individual SET statements above it.
Printing mailing labels is one use of changing report attributes. Suppose you need to do the following:
Produce mailing labels from the subscriber file. There is one label across the page, each label is 1 inch (or 6 lines at 6 lines per inch) down and 3.5 inches (or 35 columns at 10 characters per inch) across. Lines 1 and 5 of the labels are to be left blank. You must show the subscriber name, first address line, the second address line (if any), the city, state, and zip code.
This report is similar to the ones in section 3. The only difference is that the report is printed on labels instead of stock paper. The MAIN procedure must first set all of the attributes for the mailing labels. We do not need page headings so we don't have to set the page break. The only other thing the MAIN procedure needs to do is sort the subscriber file and then process the sorted records.
The detail procedure is almost the same as before, only here, it is necessary to get the printer spaced to the top of the next label. We could print the correct number of empty lines to do this but this would mean special code to handle the second address line. The way to avoid this is to define one label as a page, and have the Report Writer skip to the start of the next page (label) after printing a label. This can be done with the BP function of the PRINT statement. This function causes the next output to be printed on the start of the next page. After making these changes the report program looks like:
/* print mailing labels for subscribers */
FILE labels IS "sub"
FIELDS IN labels ARE
subscriber, name, address,
city, state, zip;
SET PAGELENGTH := 6,
FIRSTLINE := 1,
LASTLINE := 5;
SELECT FROM labels
SORTED BY subscriber;
FOR EACH labels
PROCEDURE details /* print one label */
PRINT name, NL,
address , NL;
IF address  NE "" THEN
PRINT address , NL;
PRINT city, ", ", state, " ", zip, BP;
Produce mailing labels for the magazine whose code is "rd". The labels used for this problem are 1.5 by 4 inches (9 lines by 40 columns). In addition to the information shown by the example of this section, the magazine code and the number of subscriptions left must be shown on the first line followed by a blank line.