Skip to content

Problem while working with CCSID 1208 / UTF-8 #17

@F1r3BlaZe

Description

@F1r3BlaZe

Hi,

our company is currently looking for options to implement UTF-8 in our system.
I wrote a test program to check how it is possible to work with UTF-8.

     H DFTACTGRP(*NO)
     H OPTION(*NODEBUGIO:*SRCSTMT:*SHOWCPY)
     H CCSIDCVT(*LIST: *EXCP)
     H OPENOPT(*NOCVTDATA)
     H CCSID(*EXACT)
     H CCSID(*CHAR: *UTF8)
      //ctl-opt charcounttypes(*utf8) charcount(*natural);

      *----------------------------------------------------------------*
      *  PROGRAMMNAME: HOWTO_UTF8                                      *
      *  AUTOR       :                                                 *
      *  SCHREIBDATUM: 16.04.2024                                      *
      *  VERSION     : STANDARD                                        *
      *                                                                *
      *  DIESES FORMAT HAT FOLGENDE FUNKTIONEN:                        *
      *  Test UTF-8 Verarbeitung                                       *
      *----------------------------------------------------------------*
     FKFZ01PF   UF A E           K DISK
     D
     D DSKFZ1        E DS                  EXTNAME('KFZ01PF': *all)
     D                                     QUALIFIED
     D                                     CCSID(*EXACT)
      
     D KEYKFC          DS                  LIKEREC(RKFZ01PF: *key)    
     D                                     CCSID(*EXACT)

     C                   EVAL      KEYKFC.FA4 = 'KONZ'                  
     C                   EVAL      KEYKFC.KFFA = 1                  
     C                   EVAL      KEYKFC.KFSM01 = 1                  
        chain(e) %kds(KEYKFC) KFZ01PF DSKFZ1;
        if %found(KFZ01PF); 
          DSKFZ1.KFBEZ2 = %trim(DSKFZ1.KFBEZ2) + %char('$U':*utf8);
          update(e) RKFZ01PF DSKFZ1;                                
        endif;
        
     C                   MOVE      *ON           *INLR

grafik

The code above was a working solution i came up with.
The field "KFBEZ2" ist defined with ccsid(1208). The other fields are usually in ccsid(1141).

I am now wondering why the values in the debugger don't show readable values in my data structure "DSKFZ1".
It actually works if i remove the "QUALIFIED" tag from my data structure but it needs to qualified to work in our system.

grafik

This is the result of the databank after the programm call.
grafik

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions