![]() | ![]() | ![]() | ![]() | ![]() |
Any variable which starts with 'x' has a special characteristic in that they are not replaced until just before a line is written to the output file. The only invalid character in the name of the variable is '>'.
The replacements are made in a single pass from left to right. The replacement contents may not itself contain codes you wish to be interpreted in any way as the text will be output as specified. You have some control over when the replacement occurs, see the ExpandX option.
The name of the symbol represents a variable whose contents was previously defined with the '=x=' operator of the #RexxVar command. For complex values you may need to first use #evaluate to calculate the value.
Variables of this type are useful if you wish to use characters that can't be entered by the editing tool you are using. They also provide an emergency way out which might get you past instances where the character might otherwise be interpreted in a manner other than you wish. For example if you must have the string "<?Version>" in your output (and not have it replaced by the version number)! Another example is that "<?x09>" is the only way to get a tab into the generated output.
This is a Standard Definition which always exists (you don't need to #define it). Note that you can create your own variations or completely new ones (see the examples).
The 256 rexx variables "x00" to "xFF" have been preset to represent their ASCII character codes. This means that "<?x09>" would get replaced with a tab character and "<?x41>" would get replaced with "A".
You could if you wished change the appropriate rexx variables to change the replacement value. For example you could decide the code for "<" gets replaced by "<" instead.
Note that it would generally be better to "name" your ASCII codes as they would then be easier to understand, for example "xTAB" is a lot easier to understand than "x09"!
It is highly recommended that you do not use "<?x0A>" codes to generated newlines, you should use "<?NewLine>".
#define Tab <?x09> Col1<$Tab>Col2<$Tab>Col3
#evaluate 'Tab' "d2c(9)" #RexxVar "TAB" =x= "<$Tab>" ;;TAB Char #RexxVar "LA" =x= "<" ;;'<' Char #RexxVar "RA" =x= ">" ;;'>' Char Col1<?xTab>Col2<?xTab>Col3 <?xLA> = Less than <?xRA> = Greater than
![]() | ![]() | ![]() | ![]() | ![]() |