SQL/MP Report Writer Guide

Customizing a Report
HP NonStop SQL/MP Report Writer Guide527213-001
4-45
Using TACL to Pass Parameters
In Figure 4-17, an command file named SELREPT contains a SELECT command and
report definition used to produce a monthly accounts summary. Because the report is
not always printed during the month to which it applies, the month is passed as a
parameter value instead of computed using the CURRENT_TIMESTAMP function. The
printing date is computed with the CURRENT_TIMESTAMP function.
The TACL macro shown in Figure 4-16
is defined in a file named TMREPT01. A
parameter named RPTMONTH is used to pass the month and year to which the report
applies to the REPORT TITLE command specified in the macro.
To run the report, you enter the following command at the TACL prompt:
MYTACL > RUN TMREPT01 June, 2001
The parameter value “June, 2001” is inserted in the REPORT TITLE command. (The
TACL process must have been started with a process name if you want to use the
INLINE facility.)
The report title appears as follows:
Accounts Summary for June, 2001 (Printed on 07/03/03)
The lines of the TACL macro perform the following operations:
1. Declares the beginning of a TACL macro and specifies a frame for keeping track of
pushed variables.
Figure 4-17. Example of TACL Macro for Passing Parameter
1
12
11
10
9
8
7
6
5
4
3
2
? TACL MACRO
# FRAME
#SET #INLINEPREFIX // [#PUSH #INLINEPREFIX]
#SET #INLINEECHO -1 [#PUSH #INLINEECHO ]
#PUSH RPTMONTH
#SET RPTMONTH %*%
SQLCI /INLINE/
// SET LIST_COUNT 0;
// OBEY SELREPT;
// REPORT TITLE "Accounts Summary for [RPTMONTH]", SPACE,
// "(Printed on ", CURRENT_TIMESTAMP AS DATE *, ")" ;
// LIST ALL;
// EXIT;
#UNFRAME
VST0417.vsd