Any report that will be used over and over should show the date and possibly the time the report was printed. This can be done easily with visual reportfiles by printing special fields called wtr parameters. A wtr parameter is much like a field name except that it begins with a dollar sign ($) and does not exist in any RMSfile. The parameters $todays_date and $todays_time are used to print the date and time on a report, respectively. These parameters contain the system date and time you started the report. In this section, we will incorporate these parameters, as well as others, into a report such as the one we've just created.
In the C/Base Tutorial manual, a 'working copy' of the report was created in order to maintain the integrity of the original file. Toolkit does this using the rtpcopy(C-1) command and then a choice is selected to edit the new logical reportfile. When using wtrdef directly, however, there is no need to do this, since you may achieve the same results by using the rptfile and newrptfile arguments to name the original and new reportfiles, respectively. One consideration to be made when using wtrdef is that the new reportfile cannot be an undefined logical reportfile. Instead, the newrptfile must either be an existing logical reportfile or a pathname for a reportfile to be created. (Note: any report created that is not a logical report can be added to the report catalog later by using the -a flag available with the rptadmin(C-1) command.)
In our example, we intend to modify our original example and create a new logical reportfile. First we will make a copy of the reportfile we just created, demo~mymag, and then make modifications to this copy. Copying the reportfiles demo~mymag to demo~newmag is performed by entering:
c:\> rptcopy demo~mymag demo~newmag
To modify our newly created reportfile demo~newmag, enter:
c:\> rptedit demo~newmag
c:\> wtrdef demo~newmag
The rptcopy command listed above created a logical reportfile entry in the reportfile catalog for demo~newmag. Now that our new logical reportfile has been created, anytime we wish to start from our template demo~mymag, we can use wtrdef as described above as follows:
c:\> wtrdef demo~mymag demo~newmag
Doing this leaves the original report (i.e., mymag) unchanged, but allows you to use it as a template from which to fashion your new report. This means that we may now make modifications to the report without worrying about ruining or changing our original.
The screen below shows the form that is displayed:
With the Report Description form displayed, press the SWITCH key <F7> to display the Page Heading screen. Move the terminal cursor to the column immediately following the word L i s t and press the Space Bar 13 times. Now press the ADD key <F6>. This displays a Field Description form which should be filled in as shown below:
Storing the contents of this Field Description form will cause the Report Section screen to be redisplayed as shown in the following screen:
Notice that the parameter is shown as a date field.
In order to print the starting time of the report, move the cursor down to the next line (but still in the same column). Now press the ADD key <F6> once again and another blank Field Description form will be displayed, which should be filled in as shown:
Storing the contents of this Field Description form again causes the Report Section screen to be redisplayed:
Notice that this parameter is shown as a time field. You may also notice that adding this field has given 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 Insert Line key. This new line will serve to separate the 'system information' from the field headings and the body of the report. If your keyboard lacks the 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 lacks the Insert Line key, you may wish to contact your system administrator or review Chapter 11, Creating Terminal Definitions for information on how to simulate or duplicate this feature.)
Another feature which is usually a requirement for most reports is the printing of page numbers on each page. Built into wtr(C-1) is an automatic page counter. All you have to do in order 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 parameter $page.
In order to include this parameter 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 form as shown in the following screen:
After pressing the STORE key <F5>, the Report Section screen is redisplayed, as shown in the following screen:
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. The screen should appear as in the following screen:
After pressing a key (i.e., any key) to redisplay the current Report Section, you may press the EXIT key <F8> to write the reportfile to the file designated by the command that invoked the visual report (in this case, the pathname defined for the logical report demo~newmag) and return to the system prompt.