5: Creating the Demonstration System Reports

5.4 Modifying an Existing Report

Any report that is used over and over should show the date and possibly the time the report was printed. This can be done easily within the Report Generator by printing special fields called variables . A variable is much like a field name except that it begins with a dollar sign ( $ ) and does not exist in any RMSfile. The variables $todays_date and $todays_time are used to print the date and time on a report, respectively. These variables contain the system date and time you started the report. In this section, we will incorporate these, as well as other, variables into a report such as the one we’ve just created.

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 a parameter form asking the name of the report you wish to copy and the name of the new report. For the name of the report to copy enter mymag. For the name of the new report enter mag. (Note: It is assumed that no report file by this name already exists.) Doing this leaves the original report, mymag, unchanged and creates a new report, mag, which is identical to the original.

Now press the STORE key <F5>.

The progress of the copy operation appears as follows:

When you push 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 a parameter form asking you for the logical name of the report that you wish to modify. Enter mag.

When the Report Description form is displayed, press the SWITCH key <F7> to display the Page Heading screen. Move the cursor to the column immediately following the word L i s t and press the Space Bar 13 times. Press the ADD key <F6> to display a new Field Description screen.

Storing the contents of this Field Description screen redisplays the Report Section screen.

Notice that the variable is shown as a date field.

To print the starting time of the report, move the cursor down to the next line (but still in the same column). Press the ADD key <F6> to display a new Field Description form.

Storing the contents of this Field Description screen redisplays the Report Section screen.

Notice that this variable is shown as a time field.

Adding this field gives the Page Heading section a ‘cluttered’ look by crowding too much information into too small an area. This can be alleviated by adding a blank line within the Page Heading section itself. Move the cursor down 1 line (so that it is directly over the Y of Yearly Rate) and press the <Pg Up> key. This new line will serve to separate the ‘system information’ from the field headings and the body of the report. If your keyboard has no Insert Line key, you may wish to re-key these headings on the fourth line and ‘space over’ the third line so that your output matches that which is printed in this chapter. (Note: If your keyboard has no Insert Line key, you may wish to read C/Base Reference Manual Chapter 11, Creating Terminal Definitions for information on how to simulate or duplicate this feature.)

Most reports require page numbers printed on each page. Built into the Report Generator is an automatic page counter. All you have to do to print the current page number at the top of each page is to include this counter in the Page Heading section. The counter’s value (i.e., the current page number) is stored in the variable $page.

To include this variable as a part of your report, move the cursor to the first blank column immediately following the date field and press the Space Bar 7 times. Now type Page and press the Space Bar once. With the cursor positioned at this location, press the ADD key <F6> and make the necessary entries to the Field Description screen.

After pressing the STORE key <F5>, the Report Section screen is redisplayed.

At this point, you may select the PICTURE function (by pressing the GOLD key <F1> followed by the P key) to make sure things are ‘lined up’ as they should be.

After pressing a key (i.e., any key) to redisplay the current Report Section, you may press the EXIT key <F8> to save the reportfile and return to the Report Generator Menu.