IBM Support

IT22162: CONVERSION BETWEEN DIFFERENT CODE PAGES CAN LEAD TO UNEXPECTED TRUNCATION OF DATA

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • When converting from one codepage to another, it is possible for
    the resultant data to need more space than before. Db2 will
    calculate the maximum amount of space needed after the
    conversion and then truncate if the estimation exceeds the page
    size. This is the normal case.
    If the estimated size is larger than 64KB, export unexpectedly
    truncates too much due to an integer overflow.
    
    Here is a sample repro scenario:
    
    # test.del contains 30000 bytes string like "0123456..."
    export LANG=Ja_JP
    db2 terminate
    db2 drop db sample
    db2 create db sample using codeset IBM-943 territory JP
    db2 connect to sample
    db2 create bufferpool BUFF32K size 10 pagesize 32768
    db2 "create large tablespace tbs1 pagesize 32768 managed by
    database using (file 'cont1' 1024) bufferpool BUFF32K"
    db2 CREATE TABLE TEST (COl1 VARCHAR(30000)) long in tbs1
    db2 "import from test.del of del insert into TEST (COl1)"
    db2 terminate
    
    # IBM-943->IBM-943 no code conversion
    
    export LANG=Ja_JP
    db2 connect to sample
    db2 export to export1.del of del select COL1 from test
    db2 terminate
    
    # IBM-943->UTF-8 code conversion
    
    export LANG=JA_JP
    db2 connect to sample
    db2 export to export2.del of del select COL1 from test
    db2 terminate
    
    $ ls -l *.del
    -rw-rw-rw-   1 db2inst1  db2iadm  30003 Aug 13 21:46 export1.del
    -rw-rw-rw-   1 db2inst1  db2iadm  24467 Aug 13 21:46 export2.del
    <<<<
    -rw-rw-rw-   1 db2inst1  db2iadm  30000 Aug 13 21:46 test.del
    

Local fix

  • Use the same code page when exporting the data.
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED:                                              *
    * Export with code page conversion                             *
    ****************************************************************
    * PROBLEM DESCRIPTION:                                         *
    * See Error Description                                        *
    ****************************************************************
    * RECOMMENDATION:                                              *
    * Upgrade to v11.1m3fp3                                        *
    ****************************************************************
    

Problem conclusion

  • No data is truncated if converting from one code page to another
    as long as characters that are converted uses the same byte
    representation
    

Temporary fix

Comments

APAR Information

  • APAR number

    IT22162

  • Reported component name

    DB2 FOR LUW

  • Reported component ID

    DB2FORLUW

  • Reported release

    B10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2017-08-27

  • Closed date

    2018-03-15

  • Last modified date

    2018-03-15

  • APAR is sysrouted FROM one or more of the following:

    IT22091

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    DB2 FOR LUW

  • Fixed component ID

    DB2FORLUW

Applicable component levels

  • RB10 PSN

       UP

[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSEPGG","label":"Db2 for Linux, UNIX and Windows"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"11.1","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
15 March 2018