SUBROUTINE TABLE_S1
* Create a simple table using the RWS_TABLE routines.

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

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

* Start the HTML page.
CALL RW_START_HTML_PAGE("Simple RWS_Table Example", "", "", "", "")

* Initialise the HTML string buffer.
HTML = ""

* Create a caption for the table.
TEXT = "Areas giving rise to faults in software"
CALL RWS_TABLE_CAPTION(TEXT, "")
HTML = HTML : TEXT

* Assemble some data to go in the table.
* Headings.
TEXT = "Phase giving rise to fault":AM:"Percentage of total faults"
* For each heading...
FOR I = 1 TO DCOUNT(TEXT, AM)
* Tag the text as a heading cell.
S = TEXT<I>
CALL RWS_TABLE_HEADER(S, "")
TEXT<I> = S
NEXT I
* Tag the text as a table row.
CALL RWS_TABLE_ROW(TEXT, "")
HTML = HTML : TEXT

* Data.
TEXT = "Requirements definition":VM:"38"
TEXT<-1> = "Maintenance (operation)":VM:"32"
TEXT<-1> = "Design":VM:"23"
TEXT<-1> = "Installation":VM:"7"
* For each row...
FOR I = 1 TO DCOUNT(TEXT, AM)
* For each cell in the row...
FOR J = 1 TO DCOUNT(TEXT<I>, VM)
* Tag the text as a table cell.
S = TEXT<I,J>
CALL RWS_TABLE_DATA(S, "")
TEXT<I,J> = S
NEXT J
* Tag the attribute as a table row.
S = TEXT<I>
CALL RWS_TABLE_ROW(S, "")
TEXT<I> = S
NEXT I
HTML = HTML : TEXT

* Create the table.
HTML = CONVERT(HTML, AM:VM, LF:TAB)
CALL RWS_TABLE(HTML, "")

* Output the HTML.
CALL RW_PUT(HTML)

* Complete the page.
CALL RW_END_PAGE
RETURN