IBM Books

Net.Data Reference Guide


Table Variables


AIX HP-UX OS/2 OS/390 OS/400 SCO SUN Win NT
X X X X X X X X

Table variables contain an array of values and the associated column names. Use table variables to pass groups of values to a function. The individual elements of a table can be referred to in a REPORT block of a function. Table variables are often used for output from a SQL function and input to a report, but you can pass them as IN, OUT, or INOUT parameters to any non-SQL function also. Tables can only be passed to SQL functions as OUT parameters. See TABLE Statement for syntax and more information.

Example 1: The HTML report block calls an SQL query, saves the result in a TABLE variable, then passes the variable to a REXX function.

%DEFINE{
	DATABASE = "iddata"
	MyTable = %TABLE(ALL)
	DTW_DEFAULT_REPORT = "no"
%}
 
%FUNCTION(DTW_SQL) Query(OUT table) {
select * from survey
%}
 
%FUNCTION(DTW_REXX) showTable(IN table) {
  Say 'Number of Rows: 'table_ROWS
  Say 'Number of Columns: 'table_COLS
  do j=1 to table_COLS
    Say "Here are all of the values for column " table_N.j ":"
    do i = 1 to table_ROWS
       Say "<B>"i"</B>: " table_V.i.j
    end
  end
%}
 
%HTML (report){
<HTML>
<PRE>
@Query(MyTable)
<p>
@showTable(MyTable)
</PRE>
</HTML>
%}                                                             


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]