#FIX (fix a multi-value symbol) 

Top  Previous  Next

 

#FIX( symbol, fixsymbol )

#FIX

FIXes a multi-valued symbol to the value of a single instance.

symbol

A multi-valued symbol.

fixsymbol

A symbol or expression containing the value to fix the symbol to.

The #FIX statement fixes the current value of the multi-valued symbol to the value contained in the fixsymbol. This is done so that one instance of the symbol may be referenced outside a #FOR loop structure, or so you can reference the symbols dependent upon the multi-valued symbol.

The fixsymbol must contain a valid instance of one of the symbol's multiple values. If the fixsymbol does not contain a valid instance, the symbol is cleared and contains no value when referenced. Unless #ADD has been used to add a new value and fix to that instance, #FIX or #SELECT must be used to set the value in a symbol before it contains any value for Template processing outside of a #FOR loop.

#FIX is completely independent of #FOR in that #FOR always loops through every instance of the symbol, whether there is a previous #FIX for that symbol or not. If there is a previous #FIX statement for that symbol before the #FOR loop, that symbol reverts to that previous fixvalue after the #FOR terminates.

If #FIX is used within a #FOR structure, the scope of the #FIX is limited to within the #FOR in which it is used. It does not change the #FOR symbol's iteration value if both the #FOR and #FIX happen to use the same symbol.

Example:

#SET(%OneFile,'HEADER')          #! Put values into two User-defined symbols

#SET(%TwoFile,'DETAIL')

#FIX(%File,%OneFile)             #! %File refers to 'HEADER'

#FOR(%File)                      #! %File iteratively refers to all file names

#FIX(%File,%TwoFile)           #! %File refers to 'DETAIL'

#ENDFOR

                                #! %File refers to 'HEADER' again

 

See Also:     #SELECT ,#FIND