Skip to main content

This is documentation for Caché & Ensemble.

For information on converting to InterSystems IRIS, see the InterSystems IRIS Adoption Guide and the InterSystems IRIS In-Place Conversion Guide, both available on the WRC Distributions page (login required).

Previous sectionNext section


Converts a number to a four-byte string.




Argument Description
n A positive integer in the range 0 through 4294967295. It can be specified as a value, a variable, or an expression.


$ZLCHAR returns a four-byte (long) character string for n. The bytes of the character string are presented in little-endian byte order, with the least significant byte first.

If n is out of range or a negative number, $ZLCHAR returns the null string.



The $ZLASCII function is the logical inverse of $ZLCHAR. For example:

   SET x=$ZLASCII("abcd")
   WRITE !,x
   SET y=$ZLCHAR(x)
   WRITE !,y
Copy code to clipboard

Given “abcd” $ZLASCII returns 1684234849. Given 1684234849 $ZLCHAR returns “abcd”.


$ZLCHAR is similar to $CHAR, except that it operates on four byte (32-bit) words instead of single 8-bit bytes. For two byte (16-bit) words use $ZWASCII; for eight byte (64-bit) words, use $ZQASCII.

$ZLCHAR is the functional equivalent of the following form of $CHAR:

   SET n=$ZLASCII("abcd")
   WRITE !,n
   WRITE !,$CHAR(n#256,n\256#256,n\(256**2)#256,n\(256**3))
Copy code to clipboard

Given “abcd” $ZLASCII returns 1684234849. Given 1684234849, this $CHAR statement returns “abcd”.

See Also

FeedbackOpens in a new window