User Tools

Site Tools


simple_assignment_data_type_conversion.htm
Navigation:  Language Reference > 11 - Assignments > Data Type Conversion Rules >====== Simple Assignment Data Type Conversion ====== Previous pageReturn to chapter overviewNext page

The rules of simple assignment data type conversion from source into destination are as follows:

BYTE =

(SHORT, USHORT, LONG, or ULONG)

The destination receives the low-order 8 bits of the source.

(DECIMAL, PDECIMAL, REAL, SREAL, BFLOAT8, or BFLOAT4)

The source is first converted to a LONG, which truncates any decimal portion, then the destination receives the low-order 8 bits of the LONG.

(STRING, CSTRING, or PSTRING)

The source must be a numeric value with no formatting characters. The source is converted to a LONG, which truncates any decimal portion, then the destination receives the low-order 8 bits of the LONG.

SHORT =

BYTE

The destination receives the value of the source.

(USHORT, LONG, or ULONG)

The destination receives the low-order 16 bits of the source.

(DECIMAL, PDECIMAL, REAL, SREAL, BFLOAT8, or BFLOAT4)

The source is first converted to a LONG, which truncates any decimal portion, then the destination receives the low-order 16 bits of the LONG.

(STRING, CSTRING, or PSTRING)

The source must be a numeric value with no formatting characters. The source is first converted to a LONG, which truncates any decimal portion, then the destination receives the low-order 16 bits of the LONG.

USHORT =

BYTE

The destination receives the value of the source.

(SHORT, LONG, or ULONG)

The destination receives the low-order 16 bits of the source.

(DECIMAL, PDECIMAL, REAL, SREAL, BFLOAT8, or BFLOAT4)

The source is first converted to a LONG, which truncates any decimal portion, then the destination receives the low-order 16 bits of the LONG.

(STRING, CSTRING, or PSTRING)

The source must be a numeric value with no embedded formatting characters. The source is first converted to a LONG, which truncates any decimal portion, then the destination receives the low-order 16 bits of the LONG.

LONG =

(BYTE, SHORT, USHORT, or ULONG)

The destination receives the value and the sign of the source.

(DECIMAL, PDECIMAL, REAL, SREAL, BFLOAT8, or BFLOAT4)

The destination receives the value of the source, including the sign, up to 2 ³¹. If the number is greater than 2³¹, the destination receives the result of modulo 2³¹. Any decimal portion is truncated.

(STRING, CSTRING, or PSTRING)

The source must be a numeric value with no embedded formatting characters. The source is first converted to a REAL, which is then converted to the LONG.

DATE =

(BYTE, SHORT, USHORT, or ULONG)

The destination receives the Btrieve format for the Clarion Standard Date for the value of the source.

(DECIMAL, PDECIMAL, REAL, SREAL, BFLOAT8, or BFLOAT4)

The source is first converted to a LONG as a Clarion Standard Date, which truncates any decimal portion, then the destination receives the Btrieve format for the Clarion Standard Date.

(STRING, CSTRING, or PSTRING)

The source must be a numeric value with no embedded formatting characters. The source is first converted to a LONG as a Clarion Standard Date, which truncates any decimal portion, then the destination receives the Btrieve format for the Clarion Standard Date.

TIME =

(BYTE, SHORT, USHORT, or ULONG)

The destination receives the Btrieve format for the Clarion Standard Time for the value of the source.

(DECIMAL, PDECIMAL, REAL, SREAL, BFLOAT8, or BFLOAT4)

The source is first converted to a LONG as a Clarion Standard Time, which truncates any decimal portion, then the destination receives the Btrieve format for the Clarion Standard Time.

(STRING, CSTRING, PSTRING)

The source must be a numeric value with no embedded formatting characters. The source is first converted to a LONG as a Clarion Standard Time, which truncates any decimal portion, then the destination receives the Btrieve format for the Clarion Standard Time.

ULONG =

(BYTE, SHORT, or USHORT)

The source is first converted to a LONG, then the destination receives the entire 32 bits of the LONG.

LONG

The destination receives the entire 32 bits of the source.

(DECIMAL, PDECIMAL, REAL, SREAL, BFLOAT8, or BFLOAT4)

The source is first converted to a LONG, which truncates any decimal portion, then the destination receives the entire 32 bits of the LONG.

(STRING, CSTRING, or PSTRING)

The source must be a numeric value with no embedded formatting characters. The source is first converted to a LONG, which truncates any decimal portion, then the destination receives the entire 32 bits of the LONG.

REAL =

(BYTE, SHORT, USHORT, LONG, or ULONG)

The destination receives the full integer portion and the sign of the source.

(DECIMAL, PDECIMAL, SREAL, BFLOAT8, or BFLOAT4)

The destination receives the sign, integer portion, and the decimal portion of the source.

(STRING, CSTRING, PSTRING)

The source must be a numeric string value with no embedded formatting characters. The destination receives the sign, integer, and decimal portion of the number. Trailing spaces are ignored.

SREAL =

(BYTE, SHORT, USHORT, LONG, or ULONG)

The destination receives the sign and value of the source.

(DECIMAL, PDECIMAL, or REAL)

The destination receives the sign, integer, and fractional portion of the source.

(STRING, CSTRING, or PSTRING)

The source must be a numeric string value with no embedded formatting characters. The destination receives the sign, integer, and decimal portion of the number. Trailing spaces are ignored.

BFLOAT8 =

(BYTE, SHORT, USHORT, LONG, or ULONG)

The destination receives the sign and value of the source.

(DECIMAL, PDECIMAL, or REAL)

The destination receives the sign, integer, and fractional portion of the source.

(STRING, CSTRING, or PSTRING)

The source must be a numeric string value with no embedded formatting characters. The destination receives the sign, integer, and decimal portion of the number. Trailing spaces are ignored.

BFLOAT4 =

(BYTE, SHORT, USHORT, LONG, or ULONG)

The destination receives the sign and value of the source.

(DECIMAL, PDECIMAL, or REAL)

The destination receives the sign, integer, and fractional portion of the source.

(STRING, CSTRING, or PSTRING)

The source must be a numeric string value with no embedded formatting characters. The destination receives the sign, integer, and decimal portion of the number. Trailing spaces are ignored.

DECIMAL =

(BYTE, SHORT, USHORT, LONG, ULONG, or PDECIMAL)

The destination receives the sign and the value of the source, wrapping or rounding as appropriate.

(REAL, or SREAL)

The destination receives the sign, integer, and the high order part of the fraction from the source. The high order fractional portion is rounded in the destination.

(STRING, CSTRING, PSTRING)

The source must be a numeric string value with no embedded formatting characters. The destination receives the sign, integer, and decimal portion of the number. Trailing spaces are ignored.

PDECIMAL =

(BYTE, SHORT, USHORT, LONG, ULONG, or DECIMAL)

The destination receives the sign and the value of the source, wrapping or rounding as appropriate.

(REAL, SREAL, BFLOAT8, or BFLOAT4)

The destination receives the sign, integer, and the high order part of the fraction from the source. The high order fractional portion is rounded in the destination.

(STRING, CSTRING, or PSTRING)

The source must be a numeric string value with no embedded formatting characters. The destination receives the sign, integer, and decimal portion of the number. Trailing spaces are ignored.

STRING =

(BYTE, SHORT, USHORT, LONG, or ULONG)

The destination receives the sign and the unformatted number. The value is left justified in the destination.

(DECIMAL, PDECIMAL, REAL, SREAL, BFLOAT8, or BFLOAT4)

The destination receives the sign, integer, and fractional portion of the source (rounded into the string's picture format). The value is left justified in the destination.

CSTRING =

(BYTE, SHORT, USHORT, LONG, or ULONG)

The destination receives the sign and the unformatted number. The value is left justified in the destination.

(DECIMAL, PDECIMAL, REAL, SREAL, BFLOAT8, or BFLOAT4)

The destination receives the sign, integer, and fractional portion of the source (rounded into the string's picture format). The value is left justified in the destination.

PSTRING =

(BYTE, SHORT, USHORT, LONG, or ULONG)

The destination receives the sign and the unformatted number. The value is left justified in the destination.

(DECIMAL, PDECIMAL, REAL, SREAL, BFLOAT8, or BFLOAT4)

The destination receives the sign, integer, and fractional portion of the source (rounded into the string's picture format). The value is left justified in the destination.

simple_assignment_data_type_conversion.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1