Reference
Purpose
Formats output from a function call. You can enter a table name
parameter to specify that the report is to use the data in the named
table. Otherwise, the report is generated with the first output table
found in the function parameter list, or with the default table data if no
table name is in the list.
Syntax
>>-%REPORT----+-------------+--{-------------------------------->
'-(--name--)--'
.-----------------------------.
V |
>--------+-----------------------+--+---+-----------+----------->
+-string----------------+ '-row block-'
+-if block--------------+
+-variable reference----+
+-function call---------+
+-HTML statements-------+
+-include statement-----+
+-include_url statement-+
'-while block-----------'
.-----------------------------.
V |
>--------+-----------------------+--+--%}----------------------><
+-string----------------+
+-if block--------------+
+-variable reference----+
+-function call---------+
+-HTML statements-------+
+-include statement-----+
+-include_url statement-+
'-while block-----------'
Values
- %REPORT
- The keyword for specifying formatting instructions for the output of a
function call. You can use header and footer information for the
report.
- name
- This value represents a Net.Data table or result set. See
the Report Block section in the Net.Data Administration &
Programming Guide for more information.
- string
- Any sequence of alphabetic and numeric characters and
punctuation.
- if block
- The IF block. Performs conditional string processing. String
values in the condition list are treated as numeric for comparisons if they
represent integers and have no leading or trailing white space. They
can have one leading plus (+) or minus (-) sign. See IF Block for syntax and examples.
- variable reference
- Returns the value of a variable and is specified with $ and (). For
example: if VAR='abc', then $(VAR) returns
the value 'abc'. See Variable Reference for syntax information.
- function call
- Invokes one or more FUNCTION or MACRO_FUNCTION blocks, or a
Net.Data built-in function with specified arguments. See Function Call (@) for syntax and examples.
- HTML statements
- Includes any alphabetic or numeric characters, as well as HTML tags to be
formatted for the client's browser.
- include statement
- The INCLUDE statement. Reads and incorporates a file into the
Net.Data macro. See INCLUDE Statement for syntax and examples.
- include_url statement
- The INCLUDE_URL statement. Reads and incorporates another file into
the Net.Data macro in which the statement is specified. The
specified file can exist on a local or remote server. See INCLUDE_URL Statement for syntax and examples.
- row block
- The ROW block. Displays HTML formatted data once for each row of
data that is returned from a function call. See ROW Block for syntax and examples.
- while block
- The WHILE block. Performs looping with conditional string
processing. See WHILE Block for syntax and examples.
Context
The REPORT block can be found in these contexts:
- FUNCTION statement or block
Restrictions
The REPORT block can contain these elements:
- Comment block
- IF block
- INCLUDE statements
- INCLUDE_URL statements
- ROW blocks
- WHILE blocks
- Function calls
For OS/390, OS/2, Windows NT, and UNIX operating systems:
SQL functions cannot be called from inside SQL functions.
- HTML statements
- Strings
- Variable references
For OS/390: REPORT blocks are not allowed in
MACRO_FUNCTION blocks.
Examples
Example 1: A two-column HTML table showing a list of names
and locations
%FUNCTION(DTW_SQL) mytable() {
%REPORT{
<H2>Query Results</H2>
<P>Select a name for details.
<TABLE BORDER=1>
<TR><TD>Name</TD><TD>Location</TD>
%ROW{
<TR>
<TD>
<a href="/cgi-bin/db2www/name.mac/details?name=$(V1) &location=$(V2)">$(V1)</a></TD>
<TD>$(V2)</TD>
%}
</TABLE>
%}
Selecting a name in the table calls the details HTML block of
the name.mac Net.Data macro and sends it the two
values as part of the URL. In this example, the values can be used in
name.mac to look up additional details about the
name.
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]