|
There are several ways. The ICONV api is extremely fast and easy to use.
You can convert from any code page to any code page. EBCDIC code page I
used was 37 and the ASCII code page was 813. The procedure interfaces are
posted below.
*------------------------------------------------------------------
* Prototype for Code Conversion - Open
*------------------------------------------------------------------
d IConvOpen PR 52A ExtProc('QtqIconvOpen')
d * Value options(*string)
To Code
d * Value options(*string)
Fr Code
*------------------------------------------------------------------
* Prototype for Code Conversion
*------------------------------------------------------------------
d IConv PR 10i 0 ExtProc('iconv')
d 52a Value
Code Descriptor
d * Value
ptr to InBuffer Ptr
d * Value
ptr to InSize ptr
d * Value
ptr to OutBuffer Ptr
d * Value
ptr to OutSize ptr
****************************************************************
* Code Page Conversions (iconv_t)
*****************************************************************
d ToAscii DS
d ICORV_A 1 4b 0
* return value to indicate if error occurred
d ICOC_A 5 52b 0 DIM(00012)
* cd
*
d ToEbcdic DS
d ICORV_E 1 4b 0
* return value to indicate if error occurred
d ICOC_E 5 52b 0 DIM(00012)
* cd
*
*
d p_Qascii S * inz(%addr(Qascii))
d Qascii DS 32
d asciiCP 1 4b 0 inz(00813)
d asciiCA 5 8b 0 inz(0)
d asciiSA 9 12b 0 inz(0)
d asciiSS 13 16b 0 inz(1)
d asciiIL 17 20b 0 inz(0)
d asciiEO 21 24b 0 inz(1)
d asciiR 25 32a inz(*allx'00')
*
d p_Qebcdic S * inz(%addr(Qebcdic))
d Qebcdic DS 32
d ebcdicCP 1 4b 0 inz(00037)
d ebcdicCA 5 8b 0 inz(0)
d ebcdicSA 9 12b 0 inz(0)
d ebcdicSS 13 16b 0 inz(1)
d ebcdicIL 17 20b 0 inz(0)
d ebcdicEO 21 24b 0 inz(1)
d ebcdicR 25 32a inz(*allx'00')
* translate response to ASCII
c eval p_InBuff = %addr(VRESP)
c eval p_OutBuff = %addr(VRESP)
c eval InBytesLeft = %len(%trim(VRESP))
c eval OutBytesLeft = %len(VRESP)
c eval rc = IConv(ToAscii:
c %addr(p_InBuff):
c p_InBytes:
c %addr(p_OutBuff):
c p_OutBytes)
** this is done at program initialization (*INZSR)
* setup code page conversion ebcdic - ascii
c eval ToAscii = IConvOpen(p_Qascii:
c p_Qebcdic)
* setup code page conversion ascii - ebcdic
c eval ToEbcdic = IConvOpen(p_Qebcdic:
c p_Qascii)
Hope this helps
Christopher K. Bipes mailto:ChrisB@Cross-Check.com
Sr. Programmer/Analyst mailto:Chris_Bipes@Yahoo.com
CrossCheck, Inc. http://www.cross-check.com
6119 State Farm Drive Phone: 707 586-0551 x 1102
Rohnert Park CA 94928 Fax: 707 586-1884
*Note to Recruiters
Neither I, nor anyone that I know of, is interested in any new and/or
exciting positions. Please do not contact me.
-----Original Message-----
From: Vishal Gupta [mailto:vishgupta@hotmail.com]
Sent: Sunday, November 21, 1999 11:29 PM
To: rpg400-l@midrange.com
Subject: EBCIDIC to ASCII
Hi,
I have to convert a file from EBCIDIC to ASCII format on AS/400 without
using ILE C becouse I don't have C complier with me.
Is there any utility to do this or any other method/way. Please suggest.
Thanks,
Vishal
+---
| 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 mailing list archive is Copyright 1997-2025 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.