IBM Support

JR32642: IN COMMAND LINE PROCESSOR (CLP) WITH OPTION N ON, SPACES AT THE START OF A THE LAST LINE OF A STRING LITERAL ARE STRIPPED OUT

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • In the Command Line Processor (CLP),
    if the Remove New Line Character Option (-n) is ON, then
    whenever a literal string in a statement spans more than one
    line, and the last line begins with spaces and ends with the
    statement termination character,
    then the spaces at the beginning of the last line are stripped
    out.
    
    
    For example, suppose that you have a file named repro.db2
    which contains the following sequence of statements
    (with spaces at the beginning of the last line of the
    INSERT statement and of the UPDATE statement):
    
    drop table tab1;
    
    CREATE TABLE tab1
    (
       col1 char(100)
    );
    
    UPDATE COMMAND OPTIONS USING N ON;
    
    INSERT INTO tab1 (col1) VALUES ('a
      b
      c
      d');
    
    UPDATE tab1 SET col1 = 'e
      f
      g
      h';
    
    
    Suppose that you run the above script in CLP like this:
     db2 -tvf repro.db2
    so that the statement termination character defaults to being
    the semi-colon (";");
    
    It outputs the following lines, which show that the spaces at
    the beginning of the last line of the string literals have been
    stripped out:
    
    
    drop table tab1
    DB20000I  The SQL command completed successfully.
    
    CREATE TABLE tab1 ( col1 char(100) )
    DB20000I  The SQL command completed successfully.
    
    UPDATE COMMAND OPTIONS USING N ON
    DB20000I  The UPDATE COMMAND OPTIONS command completed
    successfully.
    
    INSERT INTO tab1 (col1) VALUES ('a  b  cd')
    DB20000I  The SQL command completed successfully.
    
    UPDATE tab1 SET col1 = 'e  f  gh'
    DB20000I  The SQL command completed successfully.
    
    
    The spaces before the "d" in the INSERT statement have been
    stripped out.
    The spaces before the "h" in the UPDATE statement have been
    stripped out.
    

Local fix

  • To work around the problem, you can put the
    statement termination character on a new line. For example:
    
    INSERT INTO tab1 (col1) VALUES ('a
      b
      c
      d')
    ;
    
    UPDATE tab1 SET col1 = 'e
      f
      g
      h'
    ;
    
    When you run the above statements in a script, it outputs the
    following, which shows that the literal strings were processed
    correctly:
    
    INSERT INTO tab1 (col1) VALUES ('a  b  c  d')
    DB20000I  The SQL command completed successfully.
    
    UPDATE tab1 SET col1 = 'e  f  g  h'
    DB20000I  The SQL command completed successfully.
    
    
    Alternatively, you can do either of the following:
    
    - Leave the value of the Remove New Line Character Option for
      Command Line Processor as OFF.
    
    - In Command Line Processor, do not have literal strings
      spanning more than one line.
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED:                                              *
    * Users of DB2 for Linux, UNIX and Windows                     *
    ****************************************************************
    * PROBLEM DESCRIPTION:                                         *
    * In the Command Line Processor (CLP),if the Remove New Line   *
    * Character Option (-n) is ON, thenwhenever a literal string   *
    * in a statement spans more than oneline, and the last line    *
    * begins with spaces and ends with thestatement termination    *
    * character,then the spaces at the beginning of the last line  *
    * arestrippedout.For example, suppose that you have a file     *
    * named repro.db2which contains the following sequence of      *
    * statements(with spaces at the beginning of the last line of  *
    * theINSERT statement and of the UPDATE statement):drop table  *
    * tab1;CREATE TABLE tab1(col1 char(100));UPDATE COMMAND        *
    * OPTIONS USING N ON;INSERT INTO tab1 (col1) VALUES            *
    * ('abcd');UPDATE tab1 SET col1 = 'efgh';Suppose that you run  *
    * the above script in CLP like this:db2 -tvf repro.db2so that  *
    * the statement termination character defaults tobeingthe      *
    * semi-colon (";");It outputs the following lines, which show  *
    * that the spacesatthe beginning of the last line of the       *
    * string literals havebeenstripped out:drop table tab1DB20000I *
    *  The SQL command completed successfully.CREATE TABLE tab1 (  *
    * col1 char(100) )DB20000I  The SQL command completed          *
    * successfully.UPDATE COMMAND OPTIONS USING N ONDB20000I  The  *
    * UPDATE COMMAND OPTIONS command completedsuccessfully.INSERT  *
    * INTO tab1 (col1) VALUES ('a  b  cd')DB20000I  The SQL        *
    * command completed successfully.UPDATE tab1 SET col1 = 'e  f  *
    * gh'DB20000I  The SQL command completed successfully.The      *
    * spaces before the "d" in the INSERT statement have           *
    * beenstripped out.The spaces before the "h" in the UPDATE     *
    * statement have beenstripped out.                             *
    ****************************************************************
    * RECOMMENDATION:                                              *
    * Upgrade to v95fp5                                            *
    ****************************************************************
    

Problem conclusion

  • Problem was first fixed in Version 9.5 Fix Pack 5.
    

Temporary fix

  • To work around the problem, you can put the
    
    
    statement termination character on a new line. For example:
    
    
    
    INSERT INTO tab1 (col1) VALUES ('a
    
      b
    
      c
    
      d')
    
    ;
    
    
    
    UPDATE tab1 SET col1 = 'e
    
      f
    
      g
    
      h'
    
    ;
    
    
    
    When you run the above statements in a script, it outputs the
    
    
    following, which shows that the literal strings were processed
    
    
    correctly:
    
    
    
    INSERT INTO tab1 (col1) VALUES ('a  b  c  d')
    
    DB20000I  The SQL command completed successfully.
    
    
    
    UPDATE tab1 SET col1 = 'e  f  g  h'
    
    DB20000I  The SQL command completed successfully.
    
    
    
    
    
    Alternatively, you can do either of the following:
    
    
    
    
    - Leave the value of the Remove New Line Character Option for
    
      Command Line Processor as OFF.
    
    
    
    - In Command Line Processor, do not have literal strings
    
    
      spanning more than one line.
    

Comments

APAR Information

  • APAR number

    JR32642

  • Reported component name

    DB2 EDE WIN

  • Reported component ID

    5724N7601

  • Reported release

    950

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2009-04-08

  • Closed date

    2010-03-10

  • Last modified date

    2010-03-10

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

    JR32633

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

Fix information

  • Fixed component name

    DB2 EDE WIN

  • Fixed component ID

    5724N7601

Applicable component levels

  • R950 PSN

       UP

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSEPGG","label":"DB2 for Linux- UNIX and Windows"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"950","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
12 October 2021