ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Import chinese char from .csv file (in IFS) to iServer

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

  • Import chinese char from .csv file (in IFS) to iServer

    Hello to all,

    I need to copy from IFS to AS/400 (with 7.1 O.S.) a file (csv) that contains chinese chars.

    I tried with CPYFROMSTMF and CPYFROMIMPF but in any case, the files in AS/400 contains strange chars (not chinese char); I've changed all CCSID values and DBCS is YES (in AS/400 file) but I don't find the solution.

    Someone can help me?

    Thanks a lot in advance.

    CoCa

  • #2
    How are the fields in the IBM i table defined?

    What is the CCSID of the IFS file?

    Have you confirmed that the hex values of the data in the IFS file are correct?

    Comment


    • #3
      I've defined the received file in much types... and I've tried all CCSID possible; the file is created with CRTPF and without DS.

      I don't know ths CCSID of IFS file; do it have a CCSID? I don't see this CCSID's object; if I made WRKLNK for this object I hav not a CCSID value; and same point is fot the exadecimal values in IFS file (I don't understand, sorry); this is a CSV file; how can I see the hexadecimal value?

      Thanks guy

      Comment


      • #4
        From the WRKLNK screen take option 8 (Display Attributes) for the file. You'll see something like this:
        Code:
        Object . . . . . . :   /home/cityrpg30/ToolsData.json
        
        Type . . . . . . . . . . . . . . . . . :   STMF      
        
        Owner  . . . . . . . . . . . . . . . . :   CITYRPG30 
        System object is on  . . . . . . . . . :   Local     
        Auxiliary storage pool . . . . . . . . :   1         
          Object overflowed  . . . . . . . . . :   No        
        
        [B]Coded character set ID . . . . . . . . :   1208 [/B]   <<<< This value  
        ...
        Then use Option 5 (Display) and press F10 to see the hex values. It should look a bit like this:
        Code:
        5B0A                                           [                    
        20202020 7B0A                                      {                
        20202020 20202020 22636174 65676F72 79436F64           "categoryCod 
        20202020 20202020 22636174 65676F72 794E616D           "categoryNam 
        20202020 20202020 2270726F 64756374 223A205B           "product": [ 
        20202020 20202020 20202020 7B0A                            {        
        ...
        Check what the Chinese character hex values are and see if they are correct for the CCSID shown. If not, check on the web to see what CCSID should be used for those characters and change the CCSID of the file to the correct value.

        That is the first part of your problem. The second is that any file created without DDS (or DDL) will have a CCSID of 65535 - which to the system means "Do not translate" so you will only ever get a direct hex copy of the IFS data in the PF.

        You need to define the file fully with DDS or DDL so that the field (and file) can have the correct capabilities. Without that it doesn't matter what you do with the IFS file.

        Do you really need the data in a PF anyway? Why not just process the IFS file directly?

        Comment

        Working...
        X