Hi,
It seems as if TEN.[tncy-sys-ref] is numeric or int?
If you want the result as a char, you probably have to adjust Gilas code by adding another CAST:
CAST(TEN.[tncy-sys-ref] AS CHAR(7 /* or whatever you want */)
On the other hand, if you want to have a numeric response, you need to multiply by 10 (and then you could skip all the cast:ing to char):
(TEN.[tncy-sys-ref] * 10)
/Markus