Previous Topic: Data TypesNext Topic: Arithmetic Expressions


Conversion Between Data Types

CA ADS automatically performs data type conversion in the following cases:

Data Type Conversions

The following table shows the permissible data type conversions in arithmetic and assignment commands and in arithmetic expressions. Source data types are presented down the left-hand side. Target data types are presented across the top. Permissible conversions are indicated by a YES in the box formed by the intersection of the applicable source and target data types.

SOURCE

TARGET

Group

EBCDIC

Binary*

Decimal**

Multibit binary

Internal float pt.

Display float pt.

Group

YES1

YES1

YES2

YES2

YES3

YES2

NO

EBCDIC

YES1

YES1

YES2

YES2

YES3

YES2

NO

Binary*

YES1

YES4

YES

YES

YES5

YES

NO

Decimal**

YES1

YES4

YES

YES

YES5

YES

YES

Multibit binary

YES6

YES6

YES7

YES7

YES10

YES7

NO

Internal float pt.***

YES1

YES9

YES

YES

YES5

YES

YES8

Display float pt.***

YES1

YES1

YES

YES

NO

YES

YES

Notes:

* Binary includes halfword, fullword, and doubleword binary.

** Decimal includes zoned and packed decimal.

*** Internal floating point includes internal short and long floating point.

1 Source moved to target without conversion. Target is blank-filled or truncated on right, if necessary.

2 Number begins at leftmost numeric digit and includes all numeric digits up to the first nonnumeric character (or end of data field). A negative sign can immediately precede the number. A decimal point can immediately precede or be embedded in the number. Embedded commas are ignored.

3 Bits in source moved to bits in target without conversion. Target is binary zero filled or truncated on right, if necessary.

4 If CA ADS moves are in effect, decimal portion and leading zeros are dropped, a negative sign, if any, is placed in front of the number, and the result is left justified in the target field, with leading blanks.

5 If COBOL moves are in effect, the decimal portion (without the decimal point) and leading zeros are maintained, the negative sign if any, is dropped, and the result is left justified in the target, with blank filling or truncation on right, if necessary.

6 Decimal component of the number is dropped, forced positive, and converted to a binary fullword. Bits are moved left to right. Target is binary, zero filled, or truncated on right, if necessary.

7 Each bit value 0 or 1 is converted to the character 0 or 1, as appropriate. Target is blank filled or truncated on right, if necessary.

8 Source bits are right justified in a fullword. The resulting fullword value is forced positive by moving 0 to the leftmost bit, and is moved to the target with any required data conversion.

9 The maximum output length is 23 bytes (mantissa sign, 17-digit mantissa, decimal point, character E, characteristic sign, and 2-digit characteristic). The minimum output length is 6 bytes (mantissa sign, 1-digit mantissa, character E, characteristic sign, and 2-digit characteristic).

10 The mantissa is converted to zoned decimal format and moved to the target. The negative sign and decimal point, if any, are dropped. The characteristic is not moved. Target is blank filled or truncated on right, if necessary.

11 Target is binary zero filled or truncated on right, if necessary.

More information:

Options and Directives Screen