Storing and extracting data

When writing data to a message, an application uses the name of the data type to specify the Java data type in the message; the ABL name is identical to the Java name. For example, Java uses the writeShort procedure to write a number to a StreamMessage as short. The ABL counterpart is the internal procedure writeShort(INTEGER).

In the context of extracting data from a message, there is an important difference between the ABL model and the Java model with respect to the names of the methods:

  • In Java, the name of the method determines the data type to which the extracted data is converted. For example, readLongString function extracts a value (for example, an INTEGER value from a StreamMessage) and converts it to a String value.
  • In ABL, the equivalent function is the readChar function to convert a value (such as an INTEGER value) to an ABL CHARACTER value.

The following table maps the ABL data types to the JMS data types for data storage.

Table 1. JMS and ABL data types for storing data
ABL data type JMS data type
LOGICAL boolean
INTEGER byte
INTEGER short
INTEGER int
INT64 long
DECIMAL long
DECIMAL float
DECIMAL double
CHARACTER String
LONGCHAR String
A single CHARACTER char
RAW byte array
MEMPTR byte array (only with BytesMessage)
DATE String
DATETIME String
DATETIME-TZ String

The following table maps the available conversions from JMS data types to ABL data types for data extraction.

Table 2. JMS and ABL data types for extracting data
JMS data type ABL data type
boolean LOGICAL or CHARACTER
byte INTEGER, DECIMAL, or CHARACTER
short INTEGER, DECIMAL, or CHARACTER
int INTEGER, DECIMAL, or CHARACTER
long INT64, DECIMAL or CHARACTER
float DECIMAL or CHARACTER
double DECIMAL or CHARACTER
String CHARACTER or LONGCHAR
char CHARACTER
byte array RAW or MEMPTR (MEMPTR is available only with BytesMessage)
Java date string DATE, DATETIME, or DATE-TZ