以下例子显示了调用 REXX 函数来生成具有两列三行的 Net.Data 表格的宏。在对 REXX 函数的调用之后, 将调用一个内部函数 DTW_TB_TABLE() 来生成一个要返回给浏览器的 HTML 表格。
%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)
%}
结果:
COL1 COL2 [ 1 1 ] [ 1 2 ] [ 2 1 ] [ 2 2 ] [ 3 1 ] [ 3 2 ]