• Subject: Re: Help for iconv_open(), iconv() and iconv_close()
  • From: "Carsten Flensburg" <flensburg@xxxxxxxxxx>
  • Date: Tue, 14 Nov 2000 09:27:19 +0100
  • Organization: Novasol Data AS

Hi,

Here's an example:

     **-- API Error Data Structure:  -----------------------------------------**
     D ApiError        Ds
     D  AeBytPro                     10i 0 Inz(%Size(ApiError))
     D  AeBytAvl                     10i 0
     D                                1a
     D  AeExcpId                      7a
     D  AeExcpDta                   126a
     **-- Global variables:  -------------------------------------------------**
     D RtnCod          s             10i 0
     D CdStrLen        s             10i 0 Inz( %Size( CdString ))
     D CdString        s           5000a
     D pCdCmdXml       s               *   Inz( %Addr( CdCmdXml ))
     D pCdString       s               *   Inz( %Addr( CdString ))
     **-- Format CMDD0100:  --------------------------------------------------**
     D CdCmdd0100      Ds
     D  CdBytRtn                     10i 0
     D  CdBytAvl                     10i 0
     D  CdCmdXml                  10240a
     **-- Retrieve Command Text:  --------------------------------------------**
     D RtvCmdTxt       Pr                  ExtPgm( 'QCDRCMDD' )
     D  RcCmdNamQ                    20a   Const
     D  RcDst                        10i 0 Const
     D  RcDstFmt                      8a   Const
     D  RcRcvVar                  32767a         Options( *VarSize )
     D  RcRcvFmt                      8a   Const
     D  RcError                   32767a         Options( *VarSize )
     **-- Convert String: ----------------------------------------------------**
     D IConvOpen       Pr            52a   ExtProc( 'QtqIconvOpen' )
     D  fromcode                       *   Value
     D  tocode                         *   Value
     **
     D iconv           Pr            10i 0 ExtProc( 'iconv' )
     D  cd                           52a   Value
     D  inbuf                          *
     D  inbytesleft                  10i 0
     D  outbuf                         *
     D  outbytesleft                 10i 0
     **
     D iconv_close     Pr            10i 0 ExtProc( 'iconv_close' )
     D  cd                           52a   Value
     **
     D iconv_t         Ds
     D  t_rtnval                     10i 0
     D  t_cd
     D  t_cdi                        10i 0 Dim( 12 )  Overlay( t_cd )
     **
     D QtqCode_T       Ds
     D  Qtq_CcsId                    10i 0
     D  Qtq_CnvAlt                   10i 0 Inz( 0 )
     D  Qtq_ShfSttAlt                10i 0 Inz( 0 )
     D  Qtq_InpLenOpt                10i 0 Inz( 0 )
     D  Qtq_ErrOptMxd                10i 0 Inz( 0 )
     D  Qtq_Rsv                       8a   Inz( *Allx'00' )
     **
     D fromcode        s                   Like( QtqCode_T )
     D tocode          s                   Like( QtqCode_T )
     **
     **-- Mainline:  ---------------------------------------------------------**
     **
     C                   CallP     RtvCmdTxt( 'WRKJOB    QSYS      '
     C                                      : %Size( CdCmdd0100 )
     C                                      : 'DEST0100'
     C                                      : CdCmdd0100
     C                                      : 'CMDD0100'
     C                                      : ApiError
     C                                      )
     **
     C                   Eval      Qtq_CcsId  =  1208
     C                   Eval      fromcode   =  QtqCode_T
     C                   Eval      Qtq_CcsId  =  37
     C                   Eval      tocode     =  QtqCode_T
     **
     C                   Eval      iconv_t    =  IconvOpen( %Addr( tocode )
     C                                                    : %Addr( fromcode )
     C                                                    )
     **
     C                   Eval      RtnCod     =  iconv( iconv_t
     C                                                : pCdCmdXml
     C                                                : CdBytRtn
     C                                                : pCdString
     C                                                : CdStrLen
     C                                                )
     **
     C                   Eval      RtnCod     =  iconv_close( iconv_t )
     **
     C                   Return
     **

Best regards,
Carsten Flensburg

----- Original Message ----- 
From: <owner-midrange-l@midrange.com>
To: <MIDRANGE-L@midrange.com>
Sent: 13. november 2000 21:19
Subject: Help for iconv_open(), iconv() and iconv_close()


> 
> 
> 
> I have to convert from one Ccsid to another Ccsid in rpg pgm.
> Did somebody has already used iconv_open(), iconv() and iconv_close() in
> rpg pgm cause its not an easy tasks i am not an C programmer ?
> I am trying to work with this one
> http://www.as400.ibm.com/developer/porting/example10.html
>  but i don't know how to define iconv_t descriptor.
> 
> Thanks for help.
> 
> --
> Stephane+--- | This is the Midrange System Mailing List! | To submit a new
> message, send your mail to MIDRANGE-L@midrange.com. | To subscribe to this
> list send email to MIDRANGE-L-SUB@midrange.com. | To unsubscribe from this
> list send email to MIDRANGE-L-UNSUB@midrange.com. | Questions should be
> directed to the list owner/operator: david@midrange.com +---
> 
> 

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

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2019 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].