SUBROUTINE INSERTCONVITEM_A
* Insert a preprepared HTML fragment using RWA_INSERT_CONV_ITEM.
* Use the aTokens and aValues parameters to insert data
* extracted from a Reality file.

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

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

* Set up the aTokens array to contain the tokens used in the
* fragment.
TOKENS = "NAME"
TOKENS<-1> = "ADDRESS"
TOKENS<-1> = "TOWN"
TOKENS<-1> = "DATE"

* Get some data to insert.
PERFORM "LIST-SPREAD GUESTS '318'" CAPTURING VALUES
* The data is in the third attribute.
VALUES = VALUES<3>
* LIST-SPREAD returns tab-separated data; we need a dynamic array.
VALUES = CHANGE(VALUES, TAB, AM)
* The first attribute is the item-id, which we don't need.
DEL VALUES<1>

* Get the fragment with the data inserted.
DETAILS = ""
CALL RWA_INSERT_CONV_ITEM(DETAILS, ...
"REALWEB-ITEMS", ...
"pdet.htm", ...
TOKENS, ...
VALUES, ...
"#")

* Get the URL of the Reality item server.
STYLESHEET = ""
CALL RW_GET_PARAM("__isurl", STYLESHEET)
* Specify the location of the stylesheet.
STYLESHEET = STYLESHEET : "/REALWEB-ITEMS/blue.css"

* Start the HTML page.
CALL RW_START_HTML_PAGE("Personal Details", "", STYLESHEET, "", RWD_BODY)

* Insert a heading.
HEAD = "Personal Details"
CALL RWS_HEADING(HEAD, 3, "")

* Output the processed web page.
CALL RW_PUT(HEAD : DETAILS)

* Complete the page.
CALL RW_END_PAGE
RETURN

The item "pdet.htm" contains:

<p>Name: #NAME#</p>
<p>Address: #ADDRESS#</p>
<p>Town: #TOWN#</p>
<p>Start date: #DATE#</p>