Z_TO_DISPLAY function

Functions

Z_TO_DISPLAY{[DISPLAY],[SIGN],[POSITION],LENGTH,[DECIMAL]}

Converts a numeric character string to a signed numeric value (in COBOL DISPLAY format).

If the input value is -0, it is treated as 0, and ASCII 0 or EBCDIC { is output.

The zone sign of the data to be output is determined based on the encoding specified in DISPLAY. If the character set is ASCII, 3 is output. If the character set is EBCDIC, F is output.

Parameters

DISPLAY

Specify the character encoding of the character set. (This parameter can be omitted.)

A

: Treats the character set as ASCII.

E

: Treats the character set as EBCDIC.

If you omit this parameter, ASCII is applied.

SIGN

Specify the character encoding of the sign position. (This parameter can be omitted.)

A

: Treats the sign position as ASCII.

E

: Treats the sign position as EBCDIC.

If you omit this parameter, EBCDIC is applied.

POSITION

This parameter enables the rightmost or leftmost numeric value to be treated as a signed numeric value and replaces it with encoding that matches a value in Table App. 1.2. (This parameter can be omitted.)

L

: Treats the leftmost numeric value as a signed numeric value.

T

: Treats the rightmost numeric value as a signed numeric value.

If you omit this parameter, T is applied.

LENGTH

Specify the output size. (This parameter cannot be omitted.)

You can use a number from 1 to 31.

If the specified size is larger than the size of the input data, the input data is padded with zeros first and converted to DISPLAY format according to the value specified in the argument.

DECIMAL

Specify the significant digits after decimal point for the input.

Use a number from 0 to 9.

0 indicates no decimal places. If you omit this parameter, 0 is applied.

Example

1. Character set: ASCII; Sign position: EBCDIC; Signed numeric value: rightmost; Output size: 3; No decimal places

Figure A.53 Example of using the Z_TO_DISPLAY function (1)

2. Character set: ASCII; Sign position: EBCDIC; Signed numeric value: rightmost; Output size: 3; 2 digits after decimal point

Figure A.54 Example of using the Z_TO_DISPLAY function (2)