SUBROUTINE MAKETABLE2
* Create a simple table and populate it with data from
* a Reality file. Draw borders round the cells.

* Include the RealWeb definitions.
INCLUDE #RW.INCLUDE.DEFS FROM /SYSFILES/REALWEB,BP

EQU AM TO CHAR(254)
EQU VM TO CHAR(253)
EQU TAB TO CHAR(9)

* Start the HTML page.
CALL RW_START_HTML_PAGE("RW_MAKE_TABLE Example 2", "", "", "", "")

TEXT = "Hotel Guests"
CALL RWS_HEADING(TEXT, 2, "")
CALL RW_PUT(TEXT)

* Assemble some data to go in the table.
* Get some data to insert.
PERFORM "SORT-SPREAD GUESTS < '200' " : ...
"ROOM NAME ADDRESS CITY STATE ZIP ID-SUPP" ...
CAPTURING aData
* The headings are in the second attribute.
DEL aData<1>
aHeadings = aData<1>
* SORT-SPREAD returns tab-separated data; we need a dynamic array.
aHeadings = CHANGE(aHeadings, TAB, AM)
* The data is in the third attribute onwards.
DEL aData<1>
* SORT-SPREAD returns tab-separated data; we need a dynamic array.
aData = CHANGE(aData, TAB, VM)

* Give the table a border.
aClass = ""
aClass<2> = "border"

* Create the table.
CALL RW_MAKE_TABLE(aHeadings, aData, "", aClass, RWD_IGNORE_EMPTY_ROWS)

* Complete the page.
CALL RW_END_PAGE
RETURN