z/OS TSO/E REXX Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


D2C (Decimal to Character)

z/OS TSO/E REXX Reference
SA32-0972-00

Read syntax diagramSkip visual syntax diagram
>>-D2C(wholenumber--+----+--)----------------------------------><
                    '-,n-'      

returns a string, in character format, that represents wholenumber, a decimal number, converted to binary. If you specify n, it is the length of the final result in characters; after conversion, the input string is sign-extended to the required length. If the number is too big to fit into n characters, then the result is truncated on the left. The n must be a positive whole number or zero.

If you omit n, wholenumber must be a positive whole number or zero, and the result length is as needed. Therefore, the returned result has no leading '00'x characters.

Here are some examples:
D2C(9)         ->   ' '    /* '09'x is unprintable in EBCDIC       */
D2C(129)       ->   'a'    /* '81'x is an EBCDIC 'a'               */
D2C(129,1)     ->   'a'    /* '81'x is an EBCDIC 'a'               */
D2C(129,2)     ->   ' a'   /* '0081'x is EBCDIC ' a'               */
D2C(257,1)     ->   ' '    /* '01'x is unprintable in EBCDIC       */
D2C(-127,1)    ->   'a'    /* '81'x is EBCDIC 'a'                  */
D2C(-127,2)    ->   ' a'   /* 'FF'x is unprintable EBCDIC;         */
                           /* '81'x is EBCDIC 'a'                  */
D2C(-1,4)      ->   '    ' /* 'FFFFFFFF'x is unprintable in EBCDIC */
D2C(12,0)      ->   ''     /* '' is a null string                  */

Implementation maximum: The output string may not have more than 250 significant characters, though a longer result is possible if it has additional leading sign characters ('00'x and 'FF'x).

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014