Data conversion
Because of differences in how data is interpreted in different run-time environments, your program may need to convert the data that passes from one environment to another. Data conversion occurs at Java run time.
Your code also uses a conversion table in the following run-time situations:
- Your EGL-generated Java code calls a program on CICS for z/OS.
In this case, you can specify the conversion table in a callLink element that refers to the called program. Alternatively, you can indicate (in that callLink element) that the system variable sysVar.callConversionTable identifies the conversion table at run time.
- An EGL-generated program (on a platform that supports the EBCDIC character set) transfers asynchronously to a program on a platform that supports the ASCII character set, as might occur when the transferring program invokes the system function sysLib.startTransaction.
In this case, you can specify the conversion table in a asynchLink element that refers to the program to which control is transferred. Alternatively, you can indicate (in that asynchLink element) that the system variable sysVar.callConversionTable identifies the conversion table at run time.
- An EGL-generated Java program shows a text or print form that includes series of Arabic or Hebrew characters; or presents a text form that accepts a series of such characters from the user.
In these cases, you specify the bidirectional conversion table in the system variable sysVar.formConversionTable.
You would use run-time conversion, for example, if your code places values into one of two redefined records, each of which refers to the same area of memory as a record that is passed to another program. Assume that the characteristics of the data that you pass would be different, depending on the redefined record to which you assign values. In this case, the requirements of data conversion cannot be known at generation time.
The next sections provide the following details:
Data conversion when the invoker is Java code
The following rules pertain to Java code:
- When a generated Java program or wrapper invokes a generated Java program, conversion occurs in the caller, in accordance with a set of EGL classes invoked at run-time. It is sufficient to request no conversion at all in most cases, even if the caller is accessing a remote platform that uses a code page that is different from the code page used by the invoker. You must specify a conversion table, however, in the following situation:
- The caller is Java code and is on a machine that supports one code page
- The called program is non-Java and is on a machine that supports another code page
The table name in this case is a symbol that indicates the kind of conversion that is required at run time.
- When a generated Java program accesses a remote MQSeries message queue, conversion occurs in the invoker, in accordance with a set of EGL classes invoked at run time. If the caller is accessing a remote platform that uses a code page that is different from the code page used by the invoker, specify a conversion table in the association element that refers to the MQSeries message queue.
The next table lists the conversion tables that can be accessed by generated Java code at run time. Each name has the format CSOJx:
- x
- Represents the code page number on the invoked platform. Each number is specified in the Character Data Representation Architecture Reference and Registry, SC09-2190. The registry identifies the coded character sets supported by the conversion tables.
Language Platform of Invoked Program UNIX Windows 2000/NT/XP z/OS UNIX System Services or iSeries Java Arabic CSOJ1046 CSOJ1256 CSOJ420 Chinese, simplified CSOJ1381 CSOJ1386 CSOJ1388 Chinese, traditional CSOJ950 CSOJ950 CSOJ1371 Cyrillic CSOJ866 CSOJ1251 CSOJ1025 Danish CSOJ850 CSOJ850 CSOJ277 Eastern European CSOJ852 CSOJ1250 CSOJ870 English (UK) CSOJ850 CSOJ1252 CSOJ285 English (US) CSOJ850 CSOJ1252 CSOJ037 French CSOJ850 CSOJ1252 CSOJ297 German CSOJ850 CSOJ1252 CSOJ273 Greek CSOJ813 CSOJ1253 CSOJ875 Hebrew CSOJ856 CSOJ1255 CSOJ424 Japanese CSOJ943 CSOJ943 CSOJ1390 (Katakana SBCS), CSOJ1399 (Latin SBCS) Korean CSOJ949 CSOJ949 CSOJ1364 Portuguese CSOJ850 CSOJ1252 CSOJ037 Spanish CSOJ850 CSOJ1252 CSOJ284 Swedish CSOJ850 CSOJ1252 CSOJ278 Swiss German CSOJ850 CSOJ1252 CSOJ500 Turkish CSOJ920 CSOJ1254 CSOJ1026 If you do not specify a value for the conversion table in the linkage options part when you are calling a program from Java, the default conversion tables are those for English (US).
Conversion algorithm
Data conversion of records and structures is based on the declarations of the structure items that lack a substructure.
Data of type CHAR, DBCHAR, or MBCHAR is converted in accordance with the Java conversion tables (for conversion that occurs in an EGL-generated invoker).
No conversion is performed for filler data items (data items that have no name) or for data items of type DECIMAL, PACF, HEX, or UNICODE.
On EBCDIC-to-ASCII conversion for MBCHAR data, the conversion routine deletes shift-out/shift-in (SO/SI) characters and inserts an equivalent number of blanks at the end of the data item. On ASCII-to-EBCDIC conversion, the conversion routine inserts SO/SI characters around double-byte strings and truncates the value at the last valid character that can fit in the field. If the MBCHAR field is in a variable length record and the current record end is in the MBCHAR field, the record length is adjusted to reflect the insertion or deletion of SO/SI characters. The record length indicates where the current record ends.
For data items of type BIN, the conversion routine reverses the byte order of the item if the caller or called platform uses Intel binary format and the other platform does not.
For data items of type NUM or NUMC items, the conversion routine converts all but the last byte using the CHAR algorithm. The sign half-byte (the first half byte of the last byte in the field) is converted according to the hexadecimal values shown in the next table.
EBCDIC for type NUM EBCDIC for type NUMC ASCII F (positive sign) C 3 D (negative sign) D 7
Related reference
Association elements
Bidirectional language text
callLink element
sysLib.convert
sysVar.callConversionTable