Incode Systems Home Page Incode Systems, Inc.


(Page) Read Set .RS



Reads a "set" of properties in the form:

"VARNAME","VARVALUE" or "VARNAME"="VARVALUE" or VARNAME=VARVALUE

(If VARNAME or VARVALUE contain an =, they must be surrounded by double quotes)

Where VARNAME is the name of the variable to which VARVALUE is to be assigned.

PAGE continues to read name/value pairs until it encounters the first line which starts with a *. The contents of the line are assigned to the variable named on the .RS line.

Avoid using both .RS and .RV on the same file.

This command in PAGE:

.RS TAG

Would read the following data file.

"VAR1","VAL1" "VAR2","VAL2" *TAGVAL*

With the result that the variable named VAR1 would be assigned the value VAL1, VAR2 would be assigned the value VAL2, and the variable TAG would be assigned the value TAGVAL (Note: Tag values MUST begin with a * in column 1).

If useful, a set of properties may have a tag both at the beginning and the end. Use a different tag value for the beginning and the end and use an additional .RS to read the leading tag. Below is a typical example of a single data file containing "Header" and "Detail" information in the same file:

*HEADER* "LASTNAME","Doe" "FIRSTNAME","John" "PHONE","555-1234" *END_HEADER* *DETAIL* "QTY",1 "UNIT","EA" "DESCRIPTION","Garden Rake" "PRICE",3.85 *END_DETAIL* *DETAIL* "QTY",2 "UNIT","BG" "DESCRIPTION","Fertilizer" "PRICE",6.79 *END_DETAIL*

Now, here are the commands used to access the data:

.DF DATA .RS TAG .IF "&TAG&"="*HEADER*" .. Here comes a new header record .IF .IF "&TAG&"="*DETAIL*" .. Here comes a new detail record .IF .RS TAG .IF "&TAG&"="*END_HEADER*" .. Header record has just been loaded .IF .IF "&TAG&"="*END_DETAIL*" .. Detail record has just been loaded .IF