PPWIZARD is a free preprocessor for HTML, REXX, Visual Basic or any text files.
[Bottom][Contents][Search][Prev]: #Continue[Next]: #Debug
\ -> Commands -> #Data


This command is a simple way to define sets of related information which you may wish to pass to a macro.

The command is used to mark the start and end of a block of "rows" of related information (the end marker has no parameters). Each row between these markers (except blank lines which are ignored) should contain exactly the previously specified number of quoted columns. The "#(" command can be used to allow a row to span multiple lines.

For simple lists this command may be overkill (as a simple parse loop can easily split parameters) however for more complex "structures" this command can be very useful. As there is no "magic" delimiter all characters can be used in all columns.

The "<?Data>" symbol provides a simple mechanism to retrieve the information at a later time. Data is collected without first expanding any symbols contained in the line. You may need to use <?RestartLine> to force symbol expansion.

In many ways this command is simply another type of "data importing" command. Also note that most #import types can also import into a #data structure.


[WhiteSpace]#data  [["]DataName["] [["]#Cols["]]]

The "DataName" parameter specifies the name of the "data" being accumulated. PPWIZARD uses a stem variables (of the same name) to hold the data. "stem.0" holds the number of data rows while "stem.2.3" refers to column 3 in row 2. In general you would probably use the "<?Data>" symbol to access the information.

The "#Cols" parameter specifies the number of columns in each row of data. Each row of data must have exactly this many parameters. If not specified then the number of columns for each row is taken from the first line.


;--- Define three rows ---
#data Fred 3
   ;--- Row 1 ---
   "1a" "1b" '1c'

   ;--- Row 2 ---
   #( ' '

   ;--- Row 3 ---
   #if [1 = 1]
       '3a t' '3b t'    \
       "3c t"
       '3a f' '3b f'    \
       "3c f"

   ;--- "import" some more rows ---
   #include "MoreRows.DB"

;--- Use the values (PPWIZARD) ---
#if  ['<?Data:Fred>' = '']
   There is no #data structure called "Fred"!
   There are <?Data:Fred.?> rows of data
   each with <?Data:Fred.*.?> columns.
   "Fred" was defined at <?Data:Fred>.

   #{ FOR @@X = 1 to <?Data:Fred.?>
       === Row <??@@X> of <?Data:Fred.?> ===
       <?Space>   * Col 1 = <?Data:Fred.@@X.1>
       <?Space>   * Col 2 = <?Data:Fred.@@X.2>
       <?Space>   * Col 3 = <?Data:Fred.@@X.3>

;--- Display the values (REXX) ---
#DefineRexx ''
   do  @@X = 1 to Fred.0
       call Say ''
       call Say '=== Row ' || @@X || ' of ' || Fred.0 || ' ==='
       call Say '   * Col 1 = ' || Fred.@@X.1
       call Say '   * Col 2 = ' || Fred.@@X.2
       call Say '   * Col 3 = ' || Fred.@@X.3

email me  any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Search][Prev]: #Continue[Next]: #Debug

My whole website and this manual itself was developed using PPWIZARD (free preprocessor written by Dennis Bareis)
Sunday November 05 2017 at 10:00am