× 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.



Hi everybody:
I'm writing a program that needs to convert a huge set of data (more than 64k) using RPGLE.

As you know, the maximun size allowed to declared a character field in this language is 65535 bytes (aka: 64k), but in this case, the data to send is more large (about 128k) Since the QDCXLATE can't be perform conversions above 32k's, I decided to use the iconv() API passing, as buffer, a pointer instead of a character field.

The problem is that, when I pass a character field (no matter size) the funcion works wonderfully but, if I use a pointer (or pointer to pointer as the prototype says) no conversion is performed and the error returned is EBADF ("Descriptor not valid")

Could anybody help me to solve this problem?
Thank you very much!

Diego

ps: I've attached the program example.







---------------------------------

¡Buscá desde tu celular!Yahoo! oneSEARCH ahora está en Claro
http://ar.mobile.yahoo.com/onesearch h DftActGrp(*NO) BndDir('QC2LE') ActGrp(*NEW)
h*=====================================================================
h* PROGRAMA...:
h* DESCRIPCION:
h* AUTOR......:
h* FECHA......:
h*=====================================================================
d* PROCEDURES
d*-----------------------------------------
d iconv_open Pr ExtProc('QtqIconvOpen') like(iconv_t)
d pToCode * Value
d pFromCode * Value
d*-----------------------------------------
d iconv Pr 10i 0 ExtProc('iconv')
d cd Value Like(iconv_t)
d pInBuf * Const
d inBytesLft 10u 0 Const
d pOutBuf * Const
d outBytesLft 10u 0 Const
d*-----------------------------------------
d iconv_close Pr 10i 0 ExtProc('iconv_close')
D cd Value Like(iconv_t)
d*-----------------------------------------
d* PROCEDURE: õ__ERRNO
d*-----------------------------------------
d õ__errno Pr * Extproc('__errno')
d*-----------------------------------------
d* PROCEDURE: STRERROR
d*-----------------------------------------
d strerror Pr * Extproc('strerror')
d errnum 10i 0 Value
d*-----------------------------------------
d* PROCEDURE: PERROR
d*-----------------------------------------
d perror Pr Extproc('perror')
d comment * Value Options(*string)
d*-----------------------------------------
d* PROCEDURE: ERRNO
d*-----------------------------------------
d errno Pr 10i 0
d*-----------------------------------------
d* Data Structures .
d*-----------------------------------------
d toCde Ds
d toCde_CCSID 10i 0 Inz(819)
d toCde_convA 10i 0 Inz(0)
d toCde_subA 10i 0 Inz(0)
d toCde_shftA 10i 0 Inz(1)
d toCde_lnOpt 10i 0 Inz(0)
d toCde_erOpt 10i 0 Inz(1)
d toCde_res 12a Inz(*ALLX'00')
d*--------------------------
d frmCde Ds
d frmCde_CCSID 10i 0 Inz(0)
d frmCde_convA 10i 0 Inz(0)
d frmCde_subA 10i 0 Inz(0)
d frmCde_shftA 10i 0 Inz(1)
d frmCde_lnOpt 10i 0 Inz(0)
d frmCde_erOpt 10i 0 Inz(1)
d frmCde_res 12a Inz(*ALLX'00')
d*-----------------------------------------
d iconv_t Ds based(pDummy)
d rtn_value 10i 0
d cd 10i 0 Dim(12)
d*-----------------------------------------
d* Stand alone fields .
d*-----------------------------------------
d MyData s 20a Inz('Diego Acevedo')
d pData s * Inz
d ppData s * Inz
d nInLen s 10i 0
d nOutLen s 10i 0
d err s 10i 0
d hIconv s Like(iconv_t) Inz
d*-----------------------------------------
d* Constants .
d*-------------------------------------------------
c*
c*=================================================
c*
c* M A I N P R O G R A M
c*
c*=================================================
/free
pData = %Alloc(32);
hIconv = iconv_open(%Addr(toCde):%Addr(frmCde));
%Str(pData:33) = %TrimR(MyData);
iconv(hIconv:%Addr(pData):%Size(MyData):%Addr(pData):
%Size(MyData));
err = errno;
iconv_close(hIconv);

*InLR = *On;
Return;
/end-free
c*---------------------------------------------------
c* PROCEDURE: ERRNO
c* PROPOSITO: Retreive error messages.
c*---------------------------------------------------
p errno b Export
d Pi 10i 0
d*------------------------------------
d p_errno s *
d wwreturn s 10i 0 Based(p_errno)
d*---------------------------------------------------
/free
p_errno = õ__errno;
Return wwreturn;
/end-free
p errno e

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.