7 85 4 SELECT SQL Coercions

LANSA Technical

7.85.4 SELECT-SQL Coercions

Following are some examples of the results that may be expected when using SELECT_SQL when the column field type and the LANSA field type are not the same - thus coercion needs to occur.

Test Values were all numeric. If an Alpha/String contains non-numeric data, the coercion to numerics is undefined. It may result in 0, it may ignore non-numeric characters and convert the rest, and it may ABEND.

Note that overflow of a value is undefined. For example, if a number is too large to fit in to a field, it may truncate left or right or indeed be an indeterminate value. On IBM i, it is usually a fatal error.

Where NO is stated, a coercion is performed, but valid coercions are not common due to formatting requirements.

 Target Field Type

Windows Packed (63,0)

RDMLX IBM i Packed (63,0)

Windows Alpha

RDMLX IBM i Alpha

Windows Signed (63,0)

RDMLX IBM i Signed (63,0)

Windows Char (300)

RDMLX IBM i Char(300)

Windows Date

RDMLX IBM i Date

Windows Int 4

RDMLX IBM i Int 4

Char (65535)

Yes

Yes

Yes

Yes

Yes

Yes

Yes

Yes

Yes

Yes

ABEND

ABEND

Signed (63,0)

Yes

No

Yes

Yes

Yes

Yes

Yes

Yes

Yes

Yes

Yes

Yes

Time

No

ABEND

No

ABEND

No

ABEND

No

ABEND

No

No

ABEND

ABEND

Date

No

ABEND

No

ABEND

No

ABEND

No

ABEND

Yes

Yes

ABEND

ABEND

Binary

Yes

Yes

Yes

ABEND

Yes

Yes

Yes

ABEND

No

No

ABEND

ABEND

Alpha

Yes

Yes

Yes

Yes

Yes

Yes

Yes

Yes

Yes

Yes

ABEND

ABEND

Signed (63,63)

Yes

No

Yes

Yes

Yes

Yes

Yes

Yes

No

No

Yes

Yes

Date Time

No

ABEND

No

ABEND

No

ABEND

No

ABEND

No

No

ABEND

ABEND

Packed (63,0)

Yes

Yes

Yes

Yes

Yes

No

Yes

Yes

Yes

Yes

Yes

Yes

Char (300)

Yes

Yes

Yes

Yes

Yes

Yes

Yes

Yes

Yes

Yes

ABEND

ABEND

Packed (63,63)

Yes

Yes

Yes

Yes

Yes

No

Yes

Yes

No

No

Yes

Yes

Integer (4)

Yes

Yes

Yes

Yes

Yes

Yes

Yes

Yes

Yes

Yes

Yes

Yes

Float(8)

Yes

Yes

Yes

Yes

Yes

Yes

Yes

Yes

Yes

Yes

Yes

Yes

 

Coercion: Best attempt to take a value of one type and make some sense of it in another type. For example, packed 1234 becomes Alpha "1234" when viewed on a Form. In this case the underlying packed data has been converted to a string and then assigned to the Alpha field. This is in contrast to a LANSA OVERLAY, where no conversion is performed and the alpha would contain the same binary data as the Packed field,  that is, the Alpha would NOT display the number when viewed on a Form. Any reliance on coercions must be thoroughly tested for the entire range of expected source values on all databases that the application will run on.

RDML Field types in an RDML Function are all interchangeably coercible. The only platform difference is that an overflow or underflow on Visual LANSA platforms sets the field value to 0. On IBM i, an ABEND occurs. For example, Assigning 123 to a Packed(7,7).