5: Creating the Demonstration System Reports

5.9 Selecting Records in Reports

In the previous example we created a report program that prints a label for each subscriber in the subscriber file. Often times, however, it isn’t necessary to print all of the records in a RMSfile. In many cases only certain records in a file are to be included. Processing only these required records is referred to as record selection. There are fields on the Report Description form that are used to enter the criteria for record selection. These are the fields labeled Field Name, Condition, and Value. The idea in record selection is to express a relationship that must exist between a data field value in the report’s RMSfile and some other value for a record to be selected. The other value may be a string, number, variable, or that of another data field. To help illustrate this concept, our next example is a modification of the report created in the previous example so that only labels for the subscribers who live in the state of California are printed.

Before we begin, we’ll create a ‘working copy’ of the report created in our previous example. To do this, select choice M1 - Copy Report Program from the Report Generator Menu. You are presented with the Copy Logical Report parameter form. Enter labels into the Report Name To Copy field and labelsca into the Report Name To Create field. (Note: Again it is assumed that no report file by this name already exists.) Doing this leaves the original report, labels, unchanged and creates a new report, labelsca, which is identical to the original. Press the STORE key <F5>. After the system reports the completion of the report copy, press the RETURN key. The Report Generator Menu is redisplayed. We may now modify our copy without worrying about ruining our original. To do so, select choice D2 -Modify Report Program from this menu. You are presented with the Modify Logical Report parameter form. Enter labelsca in the Enter Logical Report Name field and press the STORE key <F5>.

The specifications used in the previous example are used again in this example. We need to update the Report Description screen, however, to add the selection criterion so that only the subscribers who live in California are selected. For our example, the criterion would be:

This indicates that we want all the records where the field state has a value equal to (EQ) the string (‘delimited’, or signified, by the double-quote character) CA.

Since this is the only modification required for our example, you may simply press the EXIT key <F8> after storing the contents of the Report Description screen. This saves the report file and and returns you to the Report Generator Menu.