If you are not happy with the performance of Net.Data, you can use the START_ROW_NUM report variable to set the row number to begin displaying results in a Net.Data table. Using this variable with RPT_MAX_ROWS breaks large tables into smaller sets.
 
The following macro is an example of a complete implementation of next/previous functionality using START_ROW_NUM.
 
The table results are saved in a variable and passed to a REXX function, which determines whether there is a boundary condition for the rows and so whether the next and previous buttons display. For example: It will not display next if there are no more records.
 
The query must be performed each time, since variables are not persistent across macro invocations. If you have V4R1, you could also perform the query once, store the table data in a flat file, and then read the data back in on subsequent invocations, rather than running the query again. 
 
Note: To use this sample code, replace the query in myQuery() with your own query.
%define {   START_ROW_NUM = "1"   RPT_MAX_ROWS = "25"   resultTable = %table%}%function(DTW_SQL) myQuery(OUT table) {   select * from NETDATADEV.CUSTOMER   %report{%}%}%function(DTW_REXX) displayRows(INOUT startRow, direction,                           table, IN pageSize) { if (direction = 'next') then    do       startRow = startRow + pageSize       if ((table_ROWS+1) - startRow < pageSize) then          direction = 'prev_only'       else          direction = 'both'    end else if (direction = 'previous') then    do       startRow = startRow - pageSize       if (startRow = 1) then          direction = 'next_only'       else          direction = 'both'    end else if (direction = '') then    do       startRow = 1       if (startRow + pageSize > table_ROWS) then          direction = 'neither'       else          direction = 'next_only'       end%}%html(report) {@myQuery(resultTable)@displayRows(START_ROW_NUM, submit, resultTable,        RPT_MAX_ROWS)%if (submit == "both" || submit == "next_only")   %endif%if (submit == "both" || submit == "prev_only")   %endif%}
 
Reference the macro by loading the following URL in a browser, where the Web macro is stored in library NETDATA, file SQLMAC7, and member STARTROW
 
http://hostname/cgi-bin/db2www/qsys.lib/netdata.lib/sqlmac7.file/startrow.mbr/report
Still have questions? We can help. Submit a case to technical support

Last Modified On:
You don't have the appropriate permissions.
No, open a new Support Case