Purpose
The DEFINE block or statement defines variables names. Variable names must begin with a letter or underscore (_) and contain any alphanumeric characters or underscore. All variable names are case sensitive except N_columnName and V_columnName (See "Implicit Table Variables" for more information about these two exceptions.).
Syntax
>>-%define---+-| define entry |----------------------+---------><
+-{--+---------------------------+--%}--+
| +---------------------+ |
| V | |
+---+-------------------++--+
+-define entry------+
+-include statement-+
define entry
+-----------------------+
V |
|--+-variable name--=--+-"----+--------------------++--"---++--|
| | +-string-------------+ ||
| | +-variable reference-+ ||
| | +-function call------+ ||
| | +-----------------------+ ||
| | V | ||
| +-{----+--------------------++--%}--+|
| | +-string-------------+ ||
| | +-variable reference-+ ||
| | +-function call------+ ||
| | +-(new_line)---------+ ||
| +-exec statement--------------------+|
| +-table statement-------------------+|
| +-envvar statement------------------+|
| +-| conditional variable |----------+|
+-list statement-----------------------------------------+
conditional variable
+-----------------------+
V |
|--variable name--?---+-"----+--------------------++--"---+----->
| +-string-------------+ |
| +-variable reference-+ |
| +-function call------+ |
| +-----------------------+ |
| V | |
+-{----+--------------------++--%}--+
+-string-------------+
+-variable reference-+
+-function call------+
>--+-----------------------------------------+-----------------|
| +-----------------------+ |
| V | |
+-:--+-"----+--------------------++--"---++
| +-string-------------+ |
| +-variable reference-+ |
| +-function call------+ |
| +-----------------------+ |
| V | |
+-{----+--------------------++--%}--+
+-string-------------+
+-variable reference-+
+-function call------+
Parameters
Context
Must be in a macro IF block or outside all other blocks in the declaration part of the Net.Data macro.
Restrictions
Can contain the following elements:
Examples
Example 1: Simple variable definitions.
%DEFINE var1 = "orders" %DEFINE var2 = "$(var1).html"During run time, the variable reference $(var2) is evaluated as orders.html.
Example 2: Include quotes in a string by using two consecutive quotes. Two quotes alone is a null string.
%DEFINE hi = "say ""hello""" %DEFINE empty = ""When displayed, the variable hi has the valuesay "hello". The variable empty is null.
Example 3: A DEFINE block lets you define multiple variables with one DEFINE statement.
%DEFINE{ DATABASE = "testdb"
home = "http://www.software.ibm.com"
SHOWSQL = "YES"
PI = "3.14150"
%}
Example 4: This example of a definition block lets you define one variable spanning multiple lines.
%DEFINE text = {This variable definition
spans two lines
%}