Select case



IBM's flagship relational database management system

Select case

Postby itamar rocha » Mon Mar 10, 2014 11:48 pm

Hello everyone,

I use the command: Table XXXX YYYY WS-IND-TP-PREMIO pic x(01);


EXEC SQL
SELECT CASE
WHEN COUNT(XXXX.NUM_CPF_CNPJ) = 0
THEN '1'
ELSE '4'
END AS : WS-IND-TP-PREMIO
FROM YYYY
WHERE YYYY.COD_PARAM_EXC_COBER = :YYYY-COD-PARAM-EXC-COBER
AND YYYY.NUM_COBERTURA = :YYYY.NUM-COBERTURA
END-EXEC

When I execute the program :

DSNHPARS LINE 911 COL 28 "<IDENTIFIER>" REQUIRED
DSNHPARS LINE 911 COL 28 ILLEGAL SYMBOL ":". SOME SYMBOLS THAT MIGHT BE LEGAL A

Anybody knows whats is this?

Thanks
itamar rocha
 
Posts: 41
Joined: Mon Nov 11, 2013 8:46 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Select case

Postby Terry Heinze » Tue Mar 11, 2014 12:16 am

"DSNHPARS LINE 911 COL 28 "<IDENTIFIER>" REQUIRED
DSNHPARS LINE 911 COL 28 ILLEGAL SYMBOL ":". SOME SYMBOLS THAT MIGHT BE LEGAL A"

Where is line 911? Where is the rest of the error message?
.... Terry
Terry Heinze
 
Posts: 239
Joined: Wed Dec 04, 2013 11:08 pm
Location: Richfield, MN, USA
Has thanked: 12 times
Been thanked: 11 times

Re: Select case

Postby itamar rocha » Tue Mar 11, 2014 12:20 am

Line 911

END AS :WS-IND-TP-PREMIO
itamar rocha
 
Posts: 41
Joined: Mon Nov 11, 2013 8:46 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Select case

Postby Terry Heinze » Tue Mar 11, 2014 12:21 am

...and the rest of the error message?
.... Terry
Terry Heinze
 
Posts: 239
Joined: Wed Dec 04, 2013 11:08 pm
Location: Richfield, MN, USA
Has thanked: 12 times
Been thanked: 11 times

Re: Select case

Postby itamar rocha » Tue Mar 11, 2014 12:23 am

DSNHPARS LINE 908 COL 28 ILLEGAL SYMBOL ":". SOME SYMBOLS THAT MIGHT BE LEGAL ARE: <IDENTIFIER>
itamar rocha
 
Posts: 41
Joined: Mon Nov 11, 2013 8:46 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Select case

Postby Terry Heinze » Tue Mar 11, 2014 2:31 am

Your error message was on line 911 -- now it's on 908. Please post ALL relevant information (including field definitions) instead of piecemealing it and please use Code tags to preserve character spacing.
.... Terry
Terry Heinze
 
Posts: 239
Joined: Wed Dec 04, 2013 11:08 pm
Location: Richfield, MN, USA
Has thanked: 12 times
Been thanked: 11 times

Re: Select case

Postby itamar rocha » Tue Mar 11, 2014 6:01 pm

Hello,
My query is:

SELECT CASE
WHEN COUNT(SX008.NUM_CPF_CNPJ) = 0
THEN 1
ELSE 4
END AS :WS-IND-TP-PREMIO
FROM SX_EXC_COBER SX112
WHERE SX112.COD_PARAM_EXC_COBER = :SX112-COD-PARAM-EXC-COBER
AND SX112.NUM_COBERTURA = :SX112.NUM-COBERTURA
END-EXEC

My error is:

Error: DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=:;<IDENTIFIER>, DRIVER=3.57.82
SQLState: 42601
ErrorCode: -104
Error: DB2 SQL Error: SQLCODE=-514, SQLSTATE=26501, SQLERRMC=SQL_CURLH200C1, DRIVER=3.57.82
SQLState: 26501
ErrorCode: -514

Thanks for the help
itamar rocha
 
Posts: 41
Joined: Mon Nov 11, 2013 8:46 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Select case

Postby itamar rocha » Tue Mar 11, 2014 6:13 pm

Anybody know whats is this error?
itamar rocha
 
Posts: 41
Joined: Mon Nov 11, 2013 8:46 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Select case

Postby Akatsukami » Tue Mar 11, 2014 6:47 pm

Check the DB2 for z/OS Codes manual for your version of DB2, look up the SQLCODEs, and apply the recommended remedies.
"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: Select case

Postby Terry Heinze » Tue Mar 11, 2014 6:52 pm

... and please use Code tags:
This line has been coded. You need the full editor to have access to the Code tags.
.... Terry
Terry Heinze
 
Posts: 239
Joined: Wed Dec 04, 2013 11:08 pm
Location: Richfield, MN, USA
Has thanked: 12 times
Been thanked: 11 times

Next

Return to DB2

 


  • Related topics
    Replies
    Views
    Last post