Oracle® OLAP DML Reference 10g Release 2 (10.2) Part Number B14346-02 |
|
|
View PDF |
The PAGEPRG option holds the name of a program or the text of a statement to be executed at the beginning of each page of output. You can use this program or statement to create titles and column headings on multiple pages of a report. A program can also contain other statements appropriate for execution at the start of every page. Normally, you set the value of PAGEPRG in the initialization section of a report program.
The PAGEPRG option is meaningful only when PAGING is set to YES
and only for output from statements such as REPORT and LISTNAMES.
Data type
TEXT
Syntax
PAGEPRG = {'program'|'statement'|'NONE'|'STDHDR'}
Arguments
The name of a program to be executed after every page break. When you specify the program name as a text expression, you can omit the single quotes.
The text of a statement to be executed after every page break. When you specify the statement as a text expression, you can omit the single quotes.
Indicates that no statement or program is executed automatically after a page break.
(Default) Makes STDHDR the program name that PAGEPRG stores. You can also set PAGEPRG to 'DEFAULT'
to make STDHDR the program name that PAGEPRG stores. STDHDR produces a heading with the date and time on the left and the page number on the right.
Notes
Using a STDHDR Program in a PAGPRG Program
When you create a PAGEPRG program, you can include the STDHDR program as a line in the program. Generally, you place STDHDR before the other statements that will produce the custom heading. See Example 21-22, "Creating a Custom Heading".
Keeping Header Information Current
You can use Oracle OLAP features such as TODAY, TOD, and PAGENUM in a program that is specified by the PAGEPRG option. You can also have a header program that accepts arguments, such as the title for a particular report. In this case you would set the PAGEPRG option to a text expression that invokes the report header program with arguments. See Example 21-23, "Using Program Arguments".
Setting PAGEPRG for a File
To set PAGEPRG for a file, first make the file your current outfile by specifying its name in an OUTFILE statement, then set PAGEPRG to the desired value. The new value remains in effect until you reset it or until you use an OUTFILE statement to direct output to a different outfile. When you direct output to a different outfile, PAGEPRG returns to its default value of 'STDHDR'
for the file.
When you set PAGEPRG for the default outfile, the new value remains in effect until you reset it, regardless of intervening OUTFILE commands that send output to a file. That is, the value of PAGEPRG is automatically saved for the default outfile.
Examples
Example 21-22 Creating a Custom Heading
Suppose you want each page of a report to include both the standard running page heading and the title "Annual Sales Report." To accomplish this, create a program called report.head
.
DEFINE report.head PROGRAM PROGRAM STDHDR BLANK HEADING WIDTH LSIZE CENTER 'Annual Sales Report' BLANK IF PAGENUM GT 1 THEN HEADING WIDTH LSIZE CENTER '(Continued)' BLANK END
Specify this program to execute after every page break by setting the PAGEPRG option in the report program. You can include PUSH and POP commands to save the PAGEPRG setting that is active.
PUSH PAGEPRG PAGING PAGEPRG = 'report.head' PAGING = YES ... (body of report program) POP PAGEPRG PAGING
When you run the report, each page will contain the following heading.
15JAN98 15:05:16 Page 1 Annual Sales Report
Each page after the first page will also contain the subheading "(Continued)" because of the PAGENUM test in the IF statement.
Example 21-23 Using Program Arguments
As an alternative to specifying the report name in the report.head
program, you can pass the report name to the report.head
program from your report program. You can do this by setting the PAGEPRG option to a text expression that invokes the report.head program with the report name as an argument. Suppose your report program contains the following statement.
PAGEPRG = 'CALL report.head(\'Annual Sales Report\')'
Then you can change the first few lines of the report.head program to the following.
ARGUMENT titlevar TEXT STDHDR BLANK HEADING WIDTH LSIZE CENTER titlevar