Variable substitution


A variable is assumed when the variable recognition character is detected.

This character defaults to an ampersand (&) and can be changed for each member processed through the )DEFAULT directive.

Related topic

The following rules apply when processing a line:

  • When a variable is detected in the input stream, it is replaced with its value. A variable is any string preceded by an &, which can be overridden by the )DEFAULT directive.
  • The characters that follow the & up to a blank or a slash (/ ) are assumed to be the variable name. If the variable name is followed by a /, the / is discarded during processing.
  • The contents of a variable string beginning with two ampersand signs (&&x) are assumed to be that string less one ampersand sign (per substitution pass).
  • If a variable is not found, nothing is inserted and the variable instruction is discarded, which is comparable to the variable substitution in the Rules Processor.
  • When the variable value's length exceeds the maximum length of the record, variable substitution processing is terminated, and the variable is treated as a null value.

Optionally, a variable (without intervening blanks or /) can be followed directly by one or two parameters, separated by colons. These parameters must be constants and must allow for substring processing for the variable. The first parameter indicates the beginning location in the contents of the variable, while the second one designates the length of the substring. If the length of the substring should exceed the actual length of the contents of the variable, the variable will be implicitly truncated.

Example

This example resolves the variable VAR, and inserts its contents beginning with the second character, into the output stream.

Example

This example resolves the variable VAR and inserts its contents, beginning with the second character for a length of three, into the output stream. If the variable contents are shorter than four characters, substitution ends with the last character.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*