IBM Support

PH61958: SQLCODE -137 MIGHT BE ISSUED FOR SQL STMT WHICH CONTAINS SUBSTR ON STRING EXPRESSION WHICH DATA TYPE IS OTHER THAN VARCHAR

A fix is available

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • SQLCODE -137 might be issued for SQL stmt which contains SUBSTR
    on string expression which data type is other than VARCHAR
    

Local fix

Problem summary

  • ****************************************************************
    * USERS AFFECTED: All Db2 13 for z/OS users of LISTAGG using   *
    *                 the SUBSTR function.                         *
    ****************************************************************
    * PROBLEM DESCRIPTION: A possible SQLCODE -137 may be issued   *
    *                      for an SQL statement which contains     *
    *                      a SUBSTR(LISTAGG(xxx)...) where the     *
    *                      LISTAGG results input data type is      *
    *                      something other than a varchar.         *
    ****************************************************************
    * RECOMMENDATION: Apply corrective PTF when available          *
    ****************************************************************
    A possible SQLCODE -137 may be issued for an SQL statement
    which contains a SUBSTR(LISTAGG(xxx)...) where the LISTAGG
    results input data type is something other than a varchar.
    Below is an example that could create the error.
    
    1. Create table and insert 2 rows with blank spaces
    CREATE TABLE TBL1
       (C1       INT,
        C2       VARCHAR(2));
    COMMIT;
    INSERT INTO TBL1 VALUES (1, '  ');
    INSERT INTO TBL1 VALUES (1, '  ');
    COMMIT;
    
    2. Run query.  This will result in -137 error.
    SELECT SUBSTR(LISTAGG(MY.C2,',')
    WITHIN GROUP (ORDER BY C2),1,4000)
    FROM TBL1 MY GROUP BY C1;
    
    If the inserted rows contained characters such as A1, then
    this -137 error may not have occurred.
    
    The reason for the error was the code incorrectly thought the
    actual data was length information and may have created the
    wrong number to check when issuing the -137 error message.
    

Problem conclusion

  • Db2 has been modified to get the correct length for checking if
    -137 error message is valid or not depending on the type of
    data.
    
    Additonal keywords: LISTAGG SUBSTR
    

Temporary fix

Comments

APAR Information

  • APAR number

    PH61958

  • Reported component name

    DB2 OS/390 & Z/

  • Reported component ID

    5740XYR00

  • Reported release

    D10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2024-06-20

  • Closed date

    2024-07-24

  • Last modified date

    2024-08-01

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

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

    UI97760

Modules/Macros

  • DSNXSIFG DSNXSIGS DSNXSILA DSNXSIND DSNXSING DSNXSMGS DSNXSMIG
    DSNXSMRD DSNXSMRG DSNXSOLA DSNXSOPC DSNXSORM DSNXSRME DSNXSTGS
    DSNXSTSD DSNXSTSG
    

Fix information

  • Fixed component name

    DB2 OS/390 & Z/

  • Fixed component ID

    5740XYR00

Applicable component levels

  • RD10 PSY UI97760

       UP24/08/01 P F407

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":"BU048","label":"IBM Software"},"Product":{"code":"SSEPEK","label":"DB2 for z\/OS"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"D10","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
01 August 2024