This section describes the runtime CCSID considerations for:
Once you have assigned a CCSID to an iSeries system object (for example, a file or a locale), the ILE COBOL runtime checks the specified CCSID parameter of your CRTCBLMOD (Create ILE COBOL Module) command to decide whether conversion is necessary. The values you can specify for the CCSID parameter are:
In the case that any of these CCSIDs is equal to 65535, no conversion is done.
When you create a locale object, you can assign a CCSID to it. For example, the locale object created in Assigning a CCSID to a Locale is created with a CCSID of 273. When you compile a program, you can also assign a CCSID. If the CCSID you specify at compile time is different than the CCSID you specified at the time the locale object was created, then at runtime, a conversion is made to the CCSID specified at compile time.
For locale objects, locales in ILE COBOL are associated with numeric-edited items and date-time items of category date and time. The following is an example of how to associate a locale with a date-time item and a numeric-edited item:
SPECIAL-NAMES. LOCALE "EN_US" IN LIBRARY "QSYSLOCALE" IS usa. (1)
·
·
·
DATA DIVISION. WORKING-STORAGE SECTION. 01 DATE-WITH-LOCALE FORMAT DATE SIZE 10 LOCALE USA. (2) 01 DATE-NO-LOCALE FORMAT DATE "@Y-%m-%d" VALUE "1997-08-09". (3) 01 NUMERIC-EDITED-WITH-LOCALE PIC +$9(6).99 SIZE 15 LOCALE USA. (4) 01 NUMERIC-EDITED-NO-LOCALE PIC +9(6).99 VALUE "+123456.78".
·
·
·
PROCEDURE DIVISION. MOVE DATE-NO-LOCALE TO DATE-WITH-LOCALE. MOVE NUMERIC-EDITED-NO-LOCALE TO NUMERIC-EDITED-WITH-LOCALE. DISPLAY "date-with-locale = " date-with-locale. DISPLAY "numeric-edited-with-locale = " numeric-edited-with-locale. STOP RUN.
The output of the program is:
date-with-locale = 08/09/97 numeric-edited-with-locale = $123,456.78
In the above example, line (1) defines the locale mnemonic-name usa, and associates that locale mnemonic-name usa with EN_US in library QSYSLOCALE. Although this line defines a locale object, it doesn't have to exist at compile time. However, the locale object does have to exist at runtime. For more information about creating locale objects, refer to Creating Locales on the iSeries or Assigning a CCSID to a Locale.
Line (2) associates the locale mnemonic-name defined in line (1) with the date data item DATE-WITH-LOCALE. Line (4) associates the locale mnemonic-name defined in line (1) with the numeric-edited data item NUMERIC-EDITED-WITH-LOCALE.
At runtime, when the data in DATE-NO-LOCALE is moved to DATE-WITH-LOCALE, the CCSID of the locale object defined in line (1) (EN_US) is compared to the CCSID specified at compile time. If the CCSIDs are different, then the data defined in DATE-NO-LOCALE (line (3)) is converted to the compile-time CCSID, and the formatted data resulting from the MOVE statements is based on the new CCSID.
Most statements in ILE COBOL assume the data is in CCSID 37 (in other words, single-byte EBCDIC). However some statements do support data in one or multiple CCSIDs:
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.