To Customize Character Set Conversion

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

The codeset 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. (Windows only) Start an Enterprise Developer command prompt. If you need instructions, see To start an Enterprise Developer command prompt.
  2. (UNIX only) 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).
  3. Create a new directory to hold temporary files and make it the current directory. For example:

    Windows:

    md mylang
    cd mylang

    UNIX:

    mkdir mylang
    cd mylang
  4. At the prompt, enter:

    Windows:

    set mfcodeset=nnnn

    UNIX:

    export MFCODESET=nnnn

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

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

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

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

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

  8. Enter:

    Windows:

    copy "%ProgramFiles(x86)%\Micro Focus\Enterprise Developer\src\codeset\csnnnn.cbl" csnnnn.cbl

    UNIX:

    cp $COBDIR/src/codeset/csnnnn.cbl csnnnn.cbl
    Note: For 32-bit Windows, %ProgramFiles(x86)% becomes %ProgramFiles%.

    where %ProgramFiles(x86)%\Micro Focus\Enterprise Developer is your installation directory and nnnn is a number between 2000 through 9999 (excluding 9122) that you use to refer to your customized codeset module.

  9. Enter:

    Windows:

    cbllink -d csnnnn.cbl

    UNIX:

    cob -z csnnnn.cbl
  10. Copy the resulting executable module CSnnnn.dll (Windows) or CSnnnn.so (UNIX) to a directory that is specified on the PATH (Windows) or the $LD_LIBRARY_PATH (UNIX).