Page 1 of 1

How to continue DB2 Query to next line in SPUFI and COBOL?

PostPosted: Tue Apr 10, 2012 9:17 pm
by Ramanan-R
Hello All,

My requirement is to get the count of rows for distinct combination of 5 columns given in below query...

SELECT COUNT(DISTINCT COLUMN_1||COLUMN_2||COLUMN_3||
                      COLUMN_4||COLUMN_5)
  FROM DBT.TABLE1


When i tried above query using SPUFI (I had to bring COLUMN_4 and COLUMN_5 to next line as i don't have enough space in first line), i'm getting below error message...

DSNT408I SQLCODE = -171, ERROR:  THE DATA TYPE, LENGTH, OR VALUE OF ARGUMENT 2
         OF || IS INVALID                                                     
DSNT418I SQLSTATE   = 42815 SQLSTATE RETURN CODE                             


Please advise how to code above query in SPUFI as well as in COBOL-DB2 Program...

Thanks in advance!
Ramanan

Re: How to continue DB2 Query to next line in SPUFI and COBO

PostPosted: Tue Apr 10, 2012 9:55 pm
by Akatsukami
Check the type of COLUMN_2; it cannot be automatically cast to CHAR.

Re: How to continue DB2 Query to next line in SPUFI and COBO

PostPosted: Tue Apr 10, 2012 10:32 pm
by Ramanan-R
Thank you, Akatsukami... It worked...