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:
$ZCOL[late](glvn,intexpr[,{0|1}])
The subscripted or unsubscripted global or local variable name specifies the key to transform.
The integer expression specifies the ID of the alternative transform to use.
The optional third argument specifies whether the transform is to normalized form, by default or if zero (0), or, if one (1), the reverse transform from the normalized to the native form.
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:
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.