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



IBM's flagship relational database management system

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

Postby Ramanan-R » Tue Apr 10, 2012 9:17 pm

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
Ramanan-R
 
Posts: 4
Joined: Tue Jul 12, 2011 2:42 pm
Has thanked: 0 time
Been thanked: 0 time

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

Postby Akatsukami » Tue Apr 10, 2012 9:55 pm

Check the type of COLUMN_2; it cannot be automatically cast to CHAR.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

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

Postby Ramanan-R » Tue Apr 10, 2012 10:32 pm

Thank you, Akatsukami... It worked...
Ramanan-R
 
Posts: 4
Joined: Tue Jul 12, 2011 2:42 pm
Has thanked: 0 time
Been thanked: 0 time


Return to DB2

 


  • Related topics
    Replies
    Views
    Last post