The data conversion system words are described in the next table.
System word/Usage | Description |
---|---|
sysLib.convert
sysLib.convert (target, direction, conversionTable) | Converts data between EBCDIC (host) and ASCII (workstation) formats or performs code-page conversion within a single format |
sysVar.callConversionTable
sysVar.callConversionTable | Name of the conversion table used to dynamically convert data for calling remote programs, for starting remote asynchronous transactions, or for accessing remote files |
sysVar.formConversionTable
sysVar.formConversionTable | Name of the conversion table used to dynamically convert data in text and print forms |
Related reference
Data conversion
EGL statements
Function invocations
System words
System words in alphabetical order
The system function sysLib.convert converts data between EBCDIC (host) and ASCII (workstation) formats or performs code-page conversion within a single format. You can use sysLib.convert as the function name in a function invocation statement.
Variable-length records are converted only for the length of the current record. The length of the current record is calculated using the record's numElementsItem or is set from the record's lengthItem. A conversion error occurs and the program ends if the variable-length record ends in the middle of a numeric field or a DBCHAR character.
You can use the linkage options part to request that automatic data conversion be generated for remote calls, to start remote asynchronous transactions, or for remote file access. Automatic conversion is always performed using the data structure defined for the argument being converted. If an argument has multiple formats, do not request automatic conversion. Instead, code the program to explicitly call sysLib.convert with redefined record declarations that correctly map the current values of the argument.
Record RecordA record_type char(3); item1 char(20); end Record RecordB record_type char(3); item2 bigint; item3 decimal(7); item4 char(8); end Program ProgramX type basicProgram myRecordA RecordA; myRecordB RecordB {redefines = myRecordA}; myConvTable char(8); function main(); myConvTable = "ELACNENU"; // conversion table for US English if (myRecordA.record_type = "00A") sysLib.convert(myRecordA, "L", myConvTable); else; sysLib.convert(myRecordB, "L", myConvTable); end call ProgramY myRecordA; end end
Related reference
Data conversion
Data conversion (system words)
sysVar.callConversionTable
The system variable sysVar.callConversionTable contains the name of the conversion table that is used to convert data when your program does the following at run time:
The conversion occurs when the data is being moved between EBCDIC-based and ASCII-based systems or between systems that use different code pages. Conversion is possible only if the linkage options part used at generation time specifies PROGRAMCONTROLLED as the value of property conversionTable in the callLink or asynchLink element. Conversion does not occur, however, if PROGRAMCONTROLLED is specified but sysVar.callConversionTable is blank.
The characteristics of sysVar.callConversionTable are as follows:
You should use sysVar.callConversionTable to switch conversion tables in a program or to turn data conversion on or off in a program.
sysVar.callConversionTable is initialized to blanks. To cause conversion to occur, make sure that the linkage options part includes the value PROGRAMCONTROLLED, as described earlier, and move the name of a conversion table to the system variable. You can set sysVar.callConversionTable to an asterisk (*) to use the default conversion table for the default national language code. For Java, this setting references the default locale on the target system provided the locale is mapped to one of the languages that can be specified for the targetNLS build descriptor option. For COBOL, this setting references the default national language code you specified when you installed EGL Server for iSeries.
Conversion is performed on the system that originates the call, invocation, or file access. When you define multiple levels of a record structure, conversion is performed on the lowest level items (the items with no substructure).
You can use sysVar.callConversionTable in these ways:
A comparison of sysVar.callConversionTable with another value tests true only if the match is exact. If you initialize sysVar.callConversionTable with a lowercase value, for example, the lowercase value matches only a lowercase value.
The value that you place in sysVar.callConversionTable remains unchanged for purposes of comparison.
sysVar.callConversionTable = "ELACNENU"; // conversion table for US English COBOL generation
Related reference
Data conversion
Data conversion (system words)
sysLib.startTransaction
targetNLS
The system variable sysVar.formConversionTable contains the name of the conversion table that is used for bidirectional text conversion when an EGL-generated Java program acts as follows:
The characteristics of sysVar.formConversionTable are as follows:
Related reference
Bidirectional language text
Data conversion
Data conversion (system words)
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.