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
Context
The REPORT block can be found in these contexts:
Restrictions
The REPORT block can contain these elements:
For OS/390: SQL functions cannot be called from inside SQL functions.
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.