IBM Books

Net.Data Administration and Programming Guide for OS/400

REXX Language Environment Example

The following example shows a macro that calls a REXX function to generate a Net.Data table that has two columns and three rows. Following the call to the REXX function, a built-in function, DTW_TB_TABLE(), is called to generate an HTML table that is sent back to the browser.

%DEFINE myTable = %TABLE
%DEFINE DTW_DEFAULT_REPORT = "NO"     
 
%function(DTW_REXX) genTable(out out_table) {
  out_table_ROWS = 3
  out_table_COLS = 2
 
  /* Set Column Headings */
  do j=1 to out_table_COLS
    out_table_N.j = 'COL'j
  end
 
  /* Set the fields in the row */
  do i = 1 to out_table_ROWS
    do j = 1 to out_table_COLS
      out_table_V.i.j = '[' i j ']'
    end
  end
%}
 
%HTML(REPORT)  {
 @genTable(myTable)
 @DTW_TB_TABLE(myTable)
%}

Results:

  COL1      COL2 
[ 1 1 ]   [ 1 2 ] 
[ 2 1 ]   [ 2 2 ] 
[ 3 1 ]   [ 3 2 ]  

Assuming that the Web macro is stored in library NETDATA, file REXXMAC, and member REXX1, the macro is reference by loading the following URL from a browser:

http://hostname/cgi-bin/db2www/qsys.lib/netdata.lib/rexxmac.file/
  rexx1.mbr/report


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