Substitutions

<< Click to Display Table of Contents >>

Navigation:  Reference > Pre-processor >

Substitutions

AE substitutions

If an AE appears on its own in brackets, the value is substituted directly into the text. If the AE is zero or negative the run fails.

If Loop is 5, the Pre-processor will substitute [Loop+6] with the number 11. In this case, no leading zeros are inserted.

If an index preceded by one or more zeros appears in brackets, the value of the index is substituted with leading zeros. If Loop is 2, the Pre-processor will substitute for the string "[00Loop]" the string "002". The maximum allowed is 4 leading zeroes.

If an AE preceded by an ampersand (&) appears in brackets, the value is computed and the appropriate letter(s) of the alphabet in upper case is substituted. If the AE is 1, "A" is substituted, for 2 "B" and so on. If the value is greater that 26 then two or more letters are used, for example 27=AA and 28=AB. If an AE is preceded by tilde (~), the appropriate letter(s) of the alphabet in lower case is substituted. If Loop is 5, the Pre-processor will substitute [&Loop+6] with the letter K and [~Loop+6] with the letter k.

Examples of valid substitution commands:

[Extra]

[Trial+Standard-1]

[&NextOne][Base]

[&5]

[0Year]

[~Loop2]

ODBC cell references

If a cell reference appears on its own in brackets, the cell contents as a character string is substituted.

VERY IMPORTANT: All cells in a spreadsheet for use with CL must be formatted as text. The only safe way to do this is to format all cells in the sheet as text before entering any contents. Formatting as text after entering the contents is not always successful.

IMPORTANT: if the cell contains a value then the character representation may not be as expected. For example a cell containing the number 23 will be output as 23.0. To avoid this problem set an index to the cell and use the index instead.

Examples of valid substitution commands:

[dlList.type]

or:

[*set Whole=dlList.type]

[Whole]

See Spreadsheet cell references for an example of how to access a spreadsheet file in the pre-processor.

PP commands can be used in a substitution unless [*NOPPINDB] is used

Data set references

If a data set reference appears on its own in brackets, the set number and item number are evaluated and the appropriate text string is substituted. If the first item of the PP data set number 2 is the text "Base", and ThisOne has been set to the number 1, the Pre-processor substitutes the string "Base" for "[2.ThisOne]".

NOTE: leading blanks and new lines in a data set item are ignored by the Pre-processor but embedded and trailing blanks are not.

PP code is ignored in data set references unless M=P is used. For CSV data sets PP code is parsed unless [*NOPPINCSV] is used. M=P can then be used to override this setting for individual CSV data sets.

Examples of valid substitution commands:

[5.ButterType]

Text substitutions

IMPORTANT: the text 15.0 is a valid whole number:

[*set Mytext=’15.0’]

[MyText]

The text output is 15 not 15.0.

To make sure that text is substituted preceded the index name with @, so using:

[*set Mytext=’15.0’]

[@MyText]

The text output will be 15.0.

The @ can be followed by ~ for lower case and & for upper case so :

[*set Mytext=’This Item’]

[MyText]

[@MyText]

[@~MyText]

[@&MyText]

will output:

This Item

This Item

this item

THIS ITEM