DTOB

Convert decimal data to binary values

WTSupported in traditional Synergy on Windows

 

USupported on UNIX
VSupported on OpenVMS
Note

The DTOB routine is deprecated; we recommend you use the Integer data type or the %INTEGER function instead.

xcall DTOB(decimal, binary)

Arguments

decimal

A field that contains the decimal value to be converted. (n)

binary

The variable that will be loaded with the converted decimal value in binary form. (a or n)

Discussion

The DTOB subroutine, like its counterpart the deprecated BTOD subroutine, simplifies manipulation of binary bytes (8 bits), words (16 bits), longwords (32 bits), and quadwords (64 bits). DTOB converts Synergy DBL decimal data to binary values, while BTOD does the converse.

Upon entry, many non-Synergy DBL subroutines and library routines require binary bytes, words, or longwords to be passed by reference. Because all data in Synergy DBL is in ASCII format and is manipulated by descriptor, you can either use integer data fields or the DTOB and BTOD routines to convert to and from binary and decimal data.

Note

Quadwords (64 bits) are supported only on 64-bit machines.

The DTOB routine converts a signed Synergy DBL decimal field to a binary value. The decimal value is obtained from a Synergy DBL expression (variable, literal, computation, and so forth), and the binary value is placed in an alpha or decimal, Synergy DBL-named field. Note how the following conditions affect DTOB:

Examples

If you enter the following data:

fld1            ,a1
fld2            ,a2
fld4            ,a4
fld5            ,a5
fld6            ,d6

the statements below perform these results:

xcall dtob(-1, fld5)       ;Yields %XFFFFFFFFFF in fld5 (equiv. to ^i(fld5)=-1)
xcall dtob(255, fld4)      ;Yields %X000000FF in fld4 (equiv. to ^i(fld4)=255)
xcall btod(fld5, fld6)     ;Yields fld6 = -1 (equiv. to ^d(fld6)=^i(fld5))
xcall btod(fld4, fld2)     ;Yields fld2 = "255" (equiv. to ^d(fld2)=^i(fld4))