$ZCOllate()

Returns the transformed representation of the first argument glvn in a normalized form using the alternative transform specified by the second argument intexpr; the return can be used as an operand to the follows (]) or sorts-after (]]) operator such that, if both operands are in the normalized form, the result is independent of alternative collation.

The format for the $ZCOLLATE() function is:

$ZCO[llate](glvn,intexpr[,{0|1}])

Note that because the forward transform is to the GDS global storage format, the reverse transform always shows a global form. This is not material when the result is used for most comparisons, but for some uses the applcation might need to remove the leading up-arrow (^).

Please see the section on $ZATRANSFORM() for a similar alternative.

Example of $ZCOllate()

Example:

GTM>write $zwrite($zcollate("A(""foo"")",0))
"A"_$C(0,255)_"foo"_$C(0,0)
GTM>write $zcollate($zcollate("A(""foo"")",0),0,1)
^A("foo")
GTM>

The first WRITE in this example shows the readable form or the value produced by the $ZCOLLATE() revealing the details of how GT.M internally represents this key using default (M) collation. The second WRITE shows how the combination of the transform and reverse transform restores the value to the original representation.