REPORT Block

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--+
         '-while block--------'
 
      .--------------------------.
      V                          |
>--------+--------------------+--+--%}-------------------------><
         +-string-------------+
         +-if block-----------+
         +-variable reference-+
         +-function call------+
         +-HTML statements----+
         +-include 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.

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:

Restrictions

The REPORT block can contain these elements:

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)&loc=$(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 | Index ]