IBM Support

Example of Using QDCXLATE API within an ILE C/400 Program

Troubleshooting


Problem

This document describes how to use QDCXLATE within an ILE C/400 program

Resolving The Problem

NOTE:  This API is available for compatibility purposes or user defined mappings only, It's use should be discontinued in new development. IBM recommends the use of the Code Conversion iconv api or the Convert a Graphic Character String (CDRCVRT) API instead.

#include <stdio.h>
#include <stdlib.h>
#include <decimal.h>
/**/
#pragma linkage(QDCXLATE,OS)
void QDCXLATE (decimal(5,0) Length_of_data,
              char *data,
              char *conversion_table,
              char conversion_table_lib??(10??));
/**/
int main()
{
    decimal(5,0) length;
    char *info  = "Text to be converted using the QDCXLATE API";
    char *table = "Q037337437";
    char table_lib??(10??) = "QUSRSYS   ";
/**/
/* Translate string data contain in info from EBCDIC to ASCII using */
/* the Q037337437 converstion table.                                */
/**/
    printf("input data for translation %s\n",info);
    length = strlen(info);
    QDCXLATE(length,info,table,table_lib);
    printf("input data for translation %s\n",info);
/**/
/* Translate string data contain in info from EBCDIC to ASCII using */
/* the Q437337037 converstion table.                                */
/**/
    table = "Q437337037";
    printf("input data for translation %s\n",info);
    length = strlen(info);
    QDCXLATE(length,info,table,table_lib);
    printf("input data for translation %s\n",info);
}

[{"Type":"MASTER","Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG60","label":"IBM i"},"Platform":[{"code":"PF012","label":"IBM i"}],"Version":"6.1.0"}]

Historical Number

172371597

Document Information

Modified date:
18 December 2019

UID

nas8N1017966