IBM Support

PH31502: TRUNCATION OF JSON DATA IN A BLOB WHEN SPECIAL NUL CHARACTERS ARE PRESENT

A fix is available

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • When storing JSON data in a BLOB , data is truncated when
    special characters are present such as (\u0000).
    The data after the special characters is truncated when using
    SYSTOOLS.BSON2JSON.
    This applies to special characters (\U000 through and
    including (\u0020).
    
    
    No truncation occurs when using SYSIBM.BSON2JSON.
    
    
    Additional keywords and symptoms:
    ********************************
    BSON2JSON JSON
    

Local fix

  • no local fix or workaround
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED:                                              *
    * All Db2 12 for z/OS users who work on JSON                   *
    * documents using Db2 provided UDF's (user-                    *
    * defined functions).                                          *
    ****************************************************************
    * PROBLEM DESCRIPTION:                                         *
    * This APAR addresses multiple problems                        *
    * that can occur while processing JSON                         *
    * documents when using the                                     *
    * SYSTOOLS.JSON2BSON,                                          *
    * SYSTOOLS.BSON2JSON, and                                      *
    * SYSTOOLS.JSON_TABLE function.                                *
    ****************************************************************
    * RECOMMENDATION:                                              *
    * Apply corrective PTF when available                          *
    ****************************************************************
    (1) An unexpected result can be returned from the
        SYSTOOLS.JSON2BSON function when it takes a JSON document
        that contains a string value from \u0000 to \u0020.
        Example 1(a)
        ------------
        SELECT JSON_VAL(C1,'field1','s:10')
        FROM (SELECT SYSTOOLS.JSON2BSON('{"field1":"ab\u0000cd"}')
              FROM SYSIBM.SYSDUMMY1) TX(C1);
        JSON_VAL(C1,'field1','s:10') was returning 'ab        '.
        The value from JSON_VAL function got truncated in the
        middle because JSON2BSON function did not store the string
        value correctly.  After the fix,
        JSON_VAL(C1,'field1','s:10') returns 'ab\u0000cd'.
        Example 1(b)
        ------------
        SELECT JSON_VAL(C1,'field1','s:10')
        FROM (SELECT SYSTOOLS.JSON2BSON('{"field1":"ab\u0001cd"}')
              FROM SYSIBM.SYSDUMMY1) TX(C1);
        JSON_VAL(C1,'field1','s:10') was returning 'ab.cd     '.
        The value from JSON_VAL function contained a corrupted
        character because JSON2BSON function did not store the
        string value correctly.  After the fix,
        JSON_VAL(C1,'field1','s:10') returns 'ab\u0001cd'.
    (2) SYSTOOLS.BSON2JSON or SYSTOOLS.JSON_TABLE may generate
        a JSON document that contains the DOUBLE value with missing
        scales.
        Example 2(a)
        ------------
        WITH CTE1 (C1) AS (
          SELECT SYSTOOLS.JSON2BSON(
                    '{"field1":[{"field2":12.12345678}]}')
          FROM SYSIBM.SYSDUMMY1)
        SELECT X.VALUE
        FROM CTE1,
           TABLE(SYSTOOLS.JSON_TABLE(C1, 'field1', 's:100')) X;
        X.VALUE is a column returned by JSON_TABLE function.
        Before the fix, X.VALUE contains {field2:12.123457}.
        After the fix, X.VALUE contains {field2:1.212345678E1}.
        Example 2(b)
        ------------
        SELECT SYSTOOLS.BSON2JSON(
                 SYSTOOLS.JSON2BSON('{"field1":12.12345678}'))
        FROM SYSIBM.SYSDUMMY1;
    
        Before the fix, BSON2JSON function returns
        {"field1":12.123457}.
        After the fix, BSON2JSON function returns
        {"field1":1.212345678E1}.
    Please note.
    This APAR delivers 11 DLLs for JSON Db2 provided user-defined
    functions and built-in function.  They are originally shipped
    via the Accessory Suite and are currently located in the
    SDSNLOAD library.  The reason for delivering all 11 DLLs is
    because the source file that gets updated is used to build all
    10 UDFs and 1 built-in function.  So, there could be other
    error symptoms that are not
    mentioned.
    

Problem conclusion

  • Db2 provided UDF's (user-defined functions) for JSON support
    have been updated to address the two problems listed.
    Additional Keywords:  SQLINCORR INCORROUT SQLINCORROUT
                          DB2INCORR/K JSON SQLUDF
    

Temporary fix

Comments

  • ×**** PE21/03/24 FIX IN ERROR. SEE APAR PH35668  FOR DESCRIPTION
    

APAR Information

  • APAR number

    PH31502

  • Reported component name

    JSON

  • Reported component ID

    JSON00001

  • Reported release

    410

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    YesHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2020-11-10

  • Closed date

    2021-01-21

  • Last modified date

    2021-04-12

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

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

Modules/Macros

  • DSN5JSTA DSN5JSTB DSN5JSGP DSN5JVL  DSN5JSUP DSN5JSTP DSN5JSBI
    DSN5JSBJ DSN5JSJB DSN5JSBT DSN5JSLN
    

Fix information

  • Fixed component name

    JSON

  • Fixed component ID

    JSON00001

Applicable component levels

  • R410 PSY UI73580

       UP21/02/03 P F102 ¢

Fix is available

  • Select the PTF appropriate for your component level. You will be required to sign in. Distribution on physical media is not available in all countries.

[{"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"SG19M","label":"APARs - z\/OS environment"},"Platform":[{"code":"PF054","label":"z\/OS"}],"Version":"410"}]

Document Information

Modified date:
13 April 2021