To customize character set translation

Note: When creating a customized character set translation, the resulting program will not be thread safe unless it contains a Local-Storage Section declaration immediately after the Working-Storage Section.

The code set module must be compiled using DIALECT"MF", and the NOCANCEL directive; otherwise, you may experience RTS114 abends when the module is first called when running through an enterprise server region.

The sample program CSnnnn.cbl, which is supplied in the src\codeset sub-directory of your installation directory, contains the necessary sections, declarations and directives.

  1. Start a shell prompt and ensure the COBOL environment is configured correctly (for example, ensure COBDIR points to your installation directory, and COBMODE is set correctly).
  2. Create a new directory to hold temporary files and make it the current directory. For example:
    mkdir mylang
    cd mylang
  3. At the prompt, enter:
    export MFCODESET=nnnn

    where nnnn refers to an MFCODESET value (listed in the Supported country codes topic) whose character set translation tables are most similar to the customized versions you want to create.

  4. Enter:
    codecomp /p mapfile.a2e mapfile.e2a

    The files mapfile.a2e and mapfile.e2a are created in the current directory.

  5. Edit the translation tables in the mapfiles to suit your requirements. mapfile.a2e contains the ASCII to EBCDIC translation table; mapfile.e2a contains the corresponding EBCDIC to ASCII translation table.
  6. Enter:
    codecomp mapfile.a2e mapfile.e2a

    A codeset.cpy file is created in the current directory.

  7. Enter:
    cp $COBDIR/src/codeset/csnnnn.cbl csnnnn.cbl

    where $COBDIR is your installation directory and nnnn is a number between 2000 through 9999 (excluding 9122) that you use to refer to your customized code set module.

  8. Enter:
    cob -z csnnnn.cbl
  9. Copy the resulting executable module CSnnnn.so to a directory that is specified on the $LD_LIBRARY_PATH.