L'esempio che segue riporta una macro che chiama una funzione REXX per generare una tabella di Net.Data che contiene due colonne e tre righe. Dopo la chiamata della funzione REXX, viene richiesta una funzione integrata, DTW_TB_TABLE() per generare una tabella HTML inviata al 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)
%}
Risultati:
COL1 COL2 [ 1 1 ] [ 1 2 ] [ 2 1 ] [ 2 2 ] [ 3 1 ] [ 3 2 ]
Se si considera che la macro Web è memorizzata nella libreria NETDATA, file REXXMAC e membro REXX1, la macro viene richiamata caricando dal browser il seguente URL:
http://hostname/cgi-bin/db2www/qsys.lib/netdata.lib/rexxmac.file/ rexx1.mbr/report