Changing the ASCII code page when transferring files with XCOM
search cancel

Changing the ASCII code page when transferring files with XCOM

book

Article ID: 11172

calendar_today

Updated On:

Products

XCOM Data Transport XCOM Data Transport - Windows XCOM Data Transport - Linux PC XCOM Data Transport - z/OS

Issue/Introduction

Would it be possible to change the ASCII code page of data transferred by XCOM?

Environment

XCOM™ Data Transport® for z/OS
XCOM™ Data Transport® for Windows
XCOM™ Data Transport® for Linux PC

Resolution

***IMPORTANT NOTE *** In the latest XCOM releases, this result may be more easily achieved by using the Unicode support. However, this method could be useful when Unicode support is not available.

XCOM character conversion is intended to be used in transfer scenarios where data is transferred between a host (using EBCDIC encoding) and a PC or mid-range box (using ASCII encoding). Therefore only ASCII to EBCDIC (ATOE) and EBCDIC to ASCII (ETOA) are supported.

Issues may arise when transferring data between PC's or midranges that reside in different countries and that therefore use different ASCII codepages. When transferring between ASCII boxes, XCOM performs no character conversion at all but, due to the differences between their local codepages, data transferred between these boxes actually might require conversion.

Release 11.0 introduced a feature that was not initially intended for that, but can be used for this purpose. It is the ability to select the ATOE/ETOA tables to be used in a transfer by transfer basis by using the CODETABL parameter. This article explains how to configure and use XCOM so that it transfers text data between ASCII boxes while converting from one ASCII codepage to another.

This method is based on the way XCOM performs character conversion:

  • It is only done when the transfer request (either locally or remotely initiated) specifies CODE_FLAG=EBCDIC
  • It is carried by the ASCII box when it assumes it is talking to a mainframe (EBCDIC box) and therefore:
    • When sending data, the ASCII box converts it using the ATOE table and
    • When receiving data, the ASCII box converts it using the ETOA table
  • Even though a mainframe partner is assumed, any record separators (carriage returns and line feeds) found in the data are NOT removed in the process.

First thing to do is to setup the boxes that will perform the transfer.

Assume we have PC A in Spain using Spanish code page and PC B in the UK using English code page. Then we will setup in BOTH boxes the following files:

  • SUKAtoE.tab - Converts from Spanish to English code page. That is, returns all values unchanged except those that are different between both codepages (like for example, pound sign, Spanish 'letter n with tilde' and so on.
  • SUKEtoA.tab - Does NOT convert, ie, returns all values unchanged
  • UKSAtoE.tab - Converts from English to Spanish code page.
  • UKSEtoa.tab - Does NOT convert

Note that the length of the prefix for the xxxAtoE.tab and xxxEtoA.tab filenames can only be up to 3 characters (although XCOM for Windows manual states it can be up to 12 characters). If conversion needs to be implemented for many pairs of code pages, this will probably lead to non-descriptive filename prefixes which will require to be clearly documented to prevent issues due to the wrong conversion being used.

A conversion table that does not convert contains a sequence of 256 hexadecimal values from 0x00 to 0xff like this:

0x00
0x01
0x02
0x03
0x04

...and so on until the end...

0xf9
0xfa
0xfb
0xfc
0xfd
0xfe
0xff

A table that converts from a code page to the other is almost the same but, for any character in the source codepage that needs conversion, contains the value that corresponds to that character in the destination codepage.

For example, if we want to convert the Spanish 'small letter n with tilde' (represented as 0xA4, decimal 164) into a 'small letter n' (represented as 0x6E) when sending it to the UK, we need to edit file SUKAtoE.tab and, in line 165 (which corresponds to 0xA4 plus one), set the value 0x6E.

Once the tables are setup, in order to have XCOM use them during a particular transfer, we will need to specify the following parameters in the request:

  • CODE_FLAG=EBCDIC in any case. This will trigger the character conversion.
    • CODETABL=SUK when data travels from Spain to the UK (either in a SENDFILE initiated in Spain or in a RECEIVEFILE initiated from the UK).
    • CODETABL= UKS when data travels from the UK to Spain

What happens inside the XCOM boxes when we run such a transfer is as follows:

  • BOTH boxes assume that they are talking to a mainframe and therefore perform character conversion.
  • The sending box converts the data using the ATOE table and the receiving box converts the data using the ETOA table. That is, the data runs through 2 consecutive conversions, either SUKAtoE plus SUKEtoA or UKSAtoE plus UKSEtoA
  • Since each of the above 'conversion table pairs' is composed by a 'non-converting table' plus a table that just changes the codepage, the final result is that the data gets finally converted from one codepage to the other.