FLICONV-API
FLAM Character Conversion Interface
FLUC ICONV Interface

This module provides a libiconv-compatible interface for memory to memory character conversion. All special feature of FLUC character conversion module are provided through the TO and FROM string specification in fliconv_open() function.

Example for C:

iconvlist(NULL,NULL);
h=iconv_open("UTF16LE//BOM","1141//ELF2NL//IGNORE//TRANSLIT//REPORT(report.txt)");
r=iconv(h,&inDat,&inLen,&outDat,&outLen);
iconv_close(h);

Example in Cobol: (Compile with the dll-option on mainframes)

CALL 'fliconv_list'  USING OMITTED, OMITTED.
CALL 'fliconv_open'  USING FLICV-TO, FLICV-FROM
                     RETURNING FLICV-HDL.
CALL  'fliconv'      USING BY VALUE  FLICV-HDL,
                           BY REFERENCE INDAT-PTR,
                           BY REFERENCE INLEN,
                           BY REFERENCE OUTDAT-PTR,
                           BY REFERENCE OUTLEN
                     RETURNING FLICV-RET.
CALL 'fliconv_close' USING BY VALUE  FLICV-HDL.

Please have a look at the FLICONV.c sample file which implements the linux like ICONV utility (fliconv) based on this library or the COBOL sample SOFLCICV for mainframe systems.

CCSID's, encoding strings and defines

The open function supports encoding strings and CCSIDS. The fliconv_list() function provides all supported CCSIDs, CHARSETs and the corresponding encoding strings.

Compatibility mode

If the compiler switch FICONV is defined, then all * fliconv* entries are also available as iconv* functions. I.e. to port your existing code you must simply replace:

#include<iconv.h>

by

#define  FICONV
#include"FLCICV.h"

With this replacement you can re-build your source. To use the special features you must append one or more of the encoding string specifications (see fliconv_open()).

Improvements compared to standard iconv implementations:

  • Support of encoding strings and CCSIDs, list supported CCSIDs and encoding strings
  • EBCDIC New Line (0x15) to Line Feed (0x0A) management
  • Subset support (String.Latin, SEPA, ...) and custom user tables
  • Recursive mapping and transliteration ('U:'->'UE')
  • Case mapping, comprehensive reporting, byte order change handling
  • Reads 5 and 6 byte UTF-8 encoded characters (values with preceding zeros)
  • Slightly faster and less memory and CPU consumption

Differences to the standard iconv library:

  • Supports more errno values (mainly for user table parsing, not for conversion itself)
  • E2BIG is set if the output buffer is smaller than the input data multiplied by the provided expansion factor –> No data is converted if the output buffer is too small (increases performance significantly)
  • Functions to provide about, version, license, statistic, error and other information
  • Add a few errno-functions to manage errno in other programming languages (COBOL/PLI)
  • Byte order mark is only printed to the output file if the BOM keyword is specified in the TO string
  • The list function gets available encoding strings, the CCSID and the corresponding CHARSET (UTF/ASCII/EBCDIC) information

Sample programs

A sample program in C with name FLICONV can be found as part of the installation package for mainframe systems in the library SRCLIBC(FLICONV), with the corresponding compile and link step in JOBLIB(SBUILD). For other platforms (Windows, UNIX) the sample program source of FLICONV is located in the 'sample' directory and the compile and link procedures can be found in the Makefile of the same directory.

This sample program implements the Linux like 'iconv' utility with all features of FLAM character conversion module.

Hints for z/OS

On z/OS you must define the language level with EXTC99, as _POSIX_SOURCE and use of long names to compile this sample.

DEFINE(_POSIX_SOURCE),LANGLVL(EXTC99),LO