ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

SQL0332. Character conversion between CCSID 13488 and CCSID 65535 not valid.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • SQL0332. Character conversion between CCSID 13488 and CCSID 65535 not valid.

    When I run the below program I get the SQL0332 message -- Character conversion between CCSID 13488 and CCSID 65535 not valid.-- on the FETCH stm.

    I try to read a table with an unicode field which I want to display on a web page from my RPG. Actually I will not know in advance the select statement when in production phase. I wrote this Q&D program for testing purpose to check how I can display unicode fields on a web page.

    My QRPGLESRC source file has CCSID 1147 (France + Euro symbol).
    My job has CCSID 1147.
    My table is defined as below :

    PHP Code:
               Data        Field  Buffer    Buffer        Field 
    Field      Type       Length  Length  Position        Usage 
    F1         CHAR            5       5         1        Both  
      
    Default value . . . . . . . . . . . . . . :  None         
      Coded Character Set Identifier  
    . . . . . :   1147        
    TITRELI    GRAPHIC        40      80         6        Both  
      
    Default value . . . . . . . . . . . . . . :               
          
    'THIS IS A TITLE'                                               
      
    Coded Character Set Identifier  . . . . . :  13488        
      UCS2 
    or Unicode conversion  . . . . . . . :  *CONVERT 
    The SQLRPGLE program
    PHP Code:
         h DftActGrp( *No )
         
    H Option( *SrcStmt )

          * -------------------------------------------------------------------------------------
          * 
    sql Descriptor Area
          
    * -------------------------------------------------------------------------------------
         
    d sqlDA           DS                  qualified
         d  sqlDAId                       8a
         d  sqlDABC                      10i 0
         d  sqlN                          5i 0
         d  sqld                          5i 0
         d  sql_var                      80a

         d  sqlvar         DS                  dim
    (2qualified based(psqlvar)
         
    d    sqlType                     5i 0
         d    sqllendec                   5i 0
         d    sqlRsv                     12a
         d    sqlData                      
    *
         
    d    sqlInd                       *
         
    d    sqlNameLen                  5i 0
         d    sqlName                    30a

          
    Variables de travail

         d pa_Request      s            512a   inz
    ('select * from MyTable')
         
    d                                     varying
         d i               s              5i 0

         d TableFetch      ds                  qualified
         d  F1                            5a
         d  F2                         1000a

          
    /free

           exec sql set option commit 
    = *none;

           *
    inlr = *on;

           
    clear sqlDA;

           
    // Preparation instruction
           
    exec sql PREPARE Sqlstm FROM :pa_Request;

           
    // Erreur sur Prepare
           
    if sqlcod <> 0;
              
    dsply sqlcod;
              return;
           endif;

           
    exec sql DECLARE C1 cursor FOR Sqlstm;

           
    exec sql Open C1;

           if 
    sqlcod <> 0;
              
    dsply sqlcod;
              return;
           endif;

           
    sqlDA.sqlN 0;

           
    psqlvar = %addr(sqlda.sql_var);
           
    clear sqlvar;

           
    // Acces initial a sqlDA pour determiner le nb de zones a extraire
           
    exec sql DESCRIBE Sqlstm INTO :sqlDA;

           
    doW sqlDA.sqlN sqlDA.sqld;
               
    sqlDA.sqlN += 1;
               
    exec sql DESCRIBE Sqlstm INTO :sqlDA;
           
    enddo;

           For 
    1 to sqlDA.sqlN;

              
    // Adressage zones de travail de reception
              
    sqlvar(1).sqlData = %addr(TableFetch.F1);
              
    sqlvar(2).sqlData = %addr(TableFetch.F2);

              
    exec sql FETCH C1
                       USING DESCRIPTOR 
    :SQLDA//SQL0332 happens here

              
    if sqlcod <> 0;
                 
    dsply sqlcod;
                 return;
              endif;

              
    clear TableFetch;

           endfor;

           
    exec sql close C1;

           ... 
    Then I CHGJOB CCSID(37) and ran again the program. This time the program worked but I get ÚÚÚÚÚÚÚÚÚÚÚÚÚÚÚÚÚÚÚÚÚÚÚÚ.. . in TABLEFETCH.F2 field when I debug past the FETCH stm.

    Why does the program seem to work when CCSID 37 and why do I get SQL0332 when CCSID 1147?
    What am I doing wrong? Can you please shed a light on this?
    Thanks in advance.
    Philippe

  • #2
    Re: SQL0332. Character conversion between CCSID 13488 and CCSID 65535 not valid.

    No one to help me here?
    Philippe

    Comment


    • #3
      Re: SQL0332. Character conversion between CCSID 13488 and CCSID 65535 not valid.

      I don't have an answer, since I haven't made sense of the mention of "65535" in the error message.

      What happens if you make this line:
      Code:
           d  F2                         1000a
      ...match the definition of the actual TITRELI column?
      Tom

      There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

      Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

      Comment


      • #4
        Re: SQL0332. Character conversion between CCSID 13488 and CCSID 65535 not valid.

        Originally posted by tomliotta
        I don't have an answer, since I haven't made sense of the mention of "65535" in the error message.
        This is my question as well as I don't see where the 65535 can come from...

        Originally posted by tomliotta
        What happens if you make this line:
        Code:
             d  F2                         1000a
        ...match the definition of the actual TITRELI column?
        It doesn't make any difference.
        PHP Code:
             d  F2                           80G 
        Thanks for your concern.
        Philippe

        Comment

        Working...
        X