× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: RE: ASCII/EBCDIC Conversion
  • From: Chris Bipes <ChrisB@xxxxxxxxxxxxxxx>
  • Date: Mon, 30 Aug 1999 13:59:05 -0700

WOW,

Can't beat MI in any program.  How do you execute MI from RPGLE?

-----Original Message-----
From: bvining@vnet.ibm.com [mailto:bvining@vnet.ibm.com]
Sent: Monday, August 30, 1999 11:30 AM
To: RPG400-L@midrange.com
Subject: ASCII/EBCDIC Conversion


Chris,

I would typically refer you to APIs such as Convert a Graphic
Character String (QTQCVRT/CDRCVRT) or the iconv() family of conversion
APIs (all found in the System API Reference under National Language
Support APIs), but as you are asking for the "most efficient" I'll
suggest another approach which should be rather hard to beat if you
can live within a single byte (SBCS) environment.

There is an ILE MI instruction Translate Bytes (XLATEB) which you
could use directly from ILE RPG.  What you could do is create a field
containing the 256 bit patterns ranging from x'00' to x'ff' and then
call QDCXLATE, QTQCVRT, or CDRCVRT asking to have this field converted
from an appropriate EBCDIC CCSID such as 37 (or whatever EBCDIC CCSID
is appropriate as there are many) to an ASCII CCSID such as 819 (or
whatever ASCII code page/CCSID is appropriate as there are many).  The
returned buffer would then represent your EBCDIC to ASCII mapping table.
Then, using the same input field, call again QDCXLATE, QTQCVRT, etc.
specifying a from CCSID such as 819 and a to CCSID of 37.  This returned
buffer would then represent your ASCII to EBCDIC mapping table.  Then
just fall into direct calls to XLATEB using the appropriate EtoA or
AtoE table.  This approach does mean two calls to set up the mapping
tables; but no calls once you get into the actual string translations.

Bruce Vining
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.