Skip to main content

     
  TPF : Library : TPF Newsletters
  Products   >   Software   >   Transaction Systems   >   TPF   >   Library   >   TPF System Newsletters   >  
Buddy, Can You Spare a?

P.J. Darcy, Sarat Vemuri, and Chris Filachek, IBM TPF Development

With the conversion of many European economies to the Euro () standard on 1 January 2002, the TPF lab has received some inquiries as to whether the Euro symbol will be supported for TPF in the near future. As a matter of fact, it is possible to make use of the Euro symbol in TPF applications today. There are two separate issues involved in dealing with Euro support: The first is the creation of a locale that makes use of the Euro symbol, and the second is using the iconv() function to convert between two code pages that contain the Euro symbol .

To create a locale that uses the Euro symbol, some modifications must be made to the locale creation process. Not only must the locale itself make use of the Euro symbol, but the code page on which we build the locale must have a Euro code point.

The TPF lab has put together the following procedure for creating a locale (specifically in the JCL file that is used to run the localedef offline utility) that makes use of the Euro and is based on a code page that includes the Euro.

Within the localedef proc, the INFILE parameter must be a member of PDS SYS1.CEE.SCEELOCX. The members that concern us here will have an @ instead of a $ in their names because these are the members that will provide Euro support. See the OS/390 V2R10.0 C/C++ Programming Guide at http://publibz.ibm.com/epubs/pdf/cbcpg030.pdf for more information about the Compiled Locales table. For example, if you want to create Euro support in locale De_DE, there are several choices in the following excerpt from the Compiled Locales table:   pdf?

De_DE.IBM-273 German Germany IBM-273 <prefix>$DDEB
De_DE.IBM-1047 German Germany IBM-104 <prefix>$DDEY
De_DE.IBM-1141 German Germany IBM-114 <prefix>$DDHB
De_DE.IBM-1141@Euro German Germany IBM-114 <prefix>@DDHB

In TPF, we do not want to distinguish between the De_DE.IBM-1141 and the De_DE.IBM-1141@Euro locales. You will have the choice of building De_DE.IBM-1141 with or without Euro support just by using the preferred locale definition. So, although the entry in the 'Locale name as in setlocale() argument' (column 1 in the previous table) for Euro support would be De_DE.IBM-1141@Euro, just call the locale De_DE.IBM-1141 from applications. You are achieving Euro support by building the locale with Euro support and calling it by the generic locale name.

For example, in this case, the JCL INFILE line will be:

INFILE='SYS1.CEE.SCEELOCX(EDC@DDHB)'

(Code page 'HB' is IBM-1141, and '@' denotes support for the Euro symbol.)

Because Euro support requires a code page, you may not be using (IBM-1141 in this case) a new line must be added to the JCL to define the required character set for the localedef call.

The following is the necessary entry if we continued the previous example:

LOPT='CHARMAP(IBM-1141)'

Note: The LOPT line will be used by the same procedure as the INFILE line, so it should appear with the INFILE and OUTFILE 'parameter' lines in your JCL as follows:


//INFILE='SYS1.CEE .SCEELOCX(EDC@DDHB)',
//LOPT='CHARMAP(IBM-1141)',
//OUTFILE='SAMPLE.PDS.NAME(SAMPLE_OUTFILE_NAME)'

The remainder of the creation will follow standard procedure. You will need to complete the creation of the new dynamic load module (DLM) for this locale and then modify the CSNAM and CLMODN segments of CISO as necessary. See TPF Application Programming at http://www.ibm.com/softwar e/ts/tpf/pubs/tpfpubs.htm for more information..

(Note: APARs PJ27786 and PJ27954, which are on TPF PUT 15, remove these segments from CISO and place equivalents in the CSNM and CMLM DLMs.)

We built a locale that supports the Euro by following this procedure. We tested the locale by using the following code.


#include 
  #include 
  void QZZ9(void)
  {
  char * string;
  char * loc;
  struct lconv * mylocale;
  struct lconv * mylocale2;
  loc = setlocale(LC_ALL,"Fr_FR.IBM-1147");
  if (!loc) {
  printf("Setlocale call failed\n");
  }
  else {
  printf("Locale is %s (setlocale was successful)\n" ;,loc);
  mylocale = localeconv();
  printf( "The CURRENCY SYMBOL for this locale is: %s (hex %x)\n",
  mylocale->currency_symbol, *mylocale->currency_symbol);
  printf( "The INTERNATIONAL CURRENCY SYMBOL is: %s\n",
  mylocale->int_curr_symbol );
  }
  loc = setlocale(LC_ALL,"EN_US.IBM-1047");
  if (!loc) {
  printf("Second setlocale failed\n");
  }
  else {
  printf("Locale is now %s (2nd setlocale was successful)\n",loc);
  mylocale2 = localeconv();
  printf("Currency symbols are now :\n %s and %s\n",
  mylocale2->currency_symbol, mylocale2->int_curr_symbol );
  }
  exit(0);
  }

The following figure shows the output that is displayed. We used a terminal with display settings of "United States with Euro support" to display the Euro character () as well as the international Euro symbol (EUR). The locale that we built is a French locale (in particular, Fr_FR.IBM-1147), but the process will be the same for any desired locale.

Newsletter Figure

Now that we have Euro support, we need to consider converting between character sets that both support the Euro using the iconv() C function. In particular, we will demonstrate the condition in which a TPF user receives "ASCII" (for this example, we consider ASCII-based code page ISO-8859-1) data from an external source that incorporates the Euro symbol. The iconv() function is capable of converting ISO-8859-1 data to other code pages that support the Euro.

The following example is based on the existing TPF documentation for creating a new table for iconv(), which is found in the TPF PUT 15 version of TPF Application Programming.

(Note: PUT 12 and later versions of iconv() should be able to handle this support because there have been no significant changes that would affect this function since that PUT.)

PDS members SYS1.CEE.SCEEGXLT(EDCUxxI1) and SYS1.CEE.SCEEGXLT(EDCUI1xx) are the ones that we would find useful to convert back and forth between ISO-8859-1 and IBM code pages that support the Euro. In particular, to continue the example with De_DE.IBM-1141, the particular table pair that would be useful would be:

SYS1.CEE.SCEEGXLT(EDCUHBI1) and SYS1.CEE.SCEEGXLT(EDCUI1HB).

Once again, here is an example. In the JCL used to create a new iconv() table (again, found in TPF Application Programming), we use:

//SYSIN DD DSN=  SYS1.CEE.SCEEGXLT(EDCUHBI1),DISP=SHR
//SYSPUNCH DD DSN=SAMPLE.PDS.NAME(HBI1),DISP=OLD

We will need a second JCL file with the following to ensure that we can convert data in both directions.

//SYSIN DD DSN=  SYS1.CEE.SCEEGXLT(EDCUI1HB),DISP=SHR
//SYSPUNCH DD DSN=SAMPLE.PDS.NAME(I1HB),DISP=OLD

As for loading the necessary modules to the TPF system to create live support for this conversion, we will need to load the modules containing the actual translation tables as well as modify C segment CPGS40 (once again, see TPF Application Programming for complete details). In that segment, we add the new translation tables list, and we must increment the value of the table_len symbol (in this case by 2, because we are adding two new conversion tables).

When all of this is completed, we will see the results shown in the following figure when making an iconv() call between ISO-8859-1 and a character set that has Euro support.

Newsletter Figure

As the results were again displayed on a terminal with display settings that supported a United States EBCDIC character set with Euro support, the ISO-8859-1 string is not displayed optimally because the terminal interprets all output to be in an EBCDIC character set. However, viewing the hexadecimal representation for each character at the end of the test case shows that the conversion between character set IBM-1147 and ISO-8859-1 was completed correctly using the new conversion tables. (Note that the 9f hex value of the EBCDIC Euro was correctly converted to the a4 hex value of the ISO-8859-1 Euro.)

By following the procedures that have been outlined, we can be confident that the introduction of this new currency will not only go smoothly in the countries that have undergone the change, but in our TPF systems as well.

pdf? Note: To view and print the PDF files, you must have the Adobe Acrobat Reader software,
which is available for free from the Adobe Web site:
http://www.adobe.com/products/acrobat/readstep2.html .