IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Can we compare pic 9(1) with pic x(1) in db2 query.


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
mainframe_world

New User


Joined: 22 Jan 2010
Posts: 12
Location: delhi

PostPosted: Mon May 09, 2011 3:38 pm
Reply with quote

Can we compare pic 9(1) PRC_HHC_BIL_TYP with pic x(1) HCFA-TYPE-OF-BILL AND in DB2 query.

HCFA-TYPE-OF-BILL is a host variable.
PRC_HHC_BIL_TYP is a part of the table.

for e.g.
EXEC SQL
SELECT COUNT
INTO:BILL-TYPE-CNT
FROM PRC_HHC_DATA
WHERE PRC_HHC_SITE_ID = :HCFA-SITE-ID AND
PRC_HHC_BIL_TYP = :HCFA-TYPE-OF-BILL AND
PRC_HHC_EFF_CYMD_DT <= :WS-PRC-HHC-TODAY-CYMD

Please provide your inputs, that will be great help for me.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon May 09, 2011 4:18 pm
Reply with quote

Well... What have you tried? what is the error you are getting?
Back to top
View user's profile Send private message
mainframe_world

New User


Joined: 22 Jan 2010
Posts: 12
Location: delhi

PostPosted: Mon May 09, 2011 4:39 pm
Reply with quote

Got -805 for the same.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6965
Location: porcelain throne

PostPosted: Mon May 09, 2011 4:50 pm
Reply with quote

no, you did not receive a -805 because of your WHERE clause.

suggest you look-up -805 and then start again.


and

PRC_HHC_BIL_TYP, if it is a column of a DB2 table,
CAN NOT BE 9(1)
no such thing as a db2 column datatype of 9(1).
Back to top
View user's profile Send private message
haimzeevi

New User


Joined: 01 Mar 2010
Posts: 27
Location: Israel

PostPosted: Thu May 12, 2011 8:47 pm
Reply with quote

Hi,
1. For the -805 just try to compile & bind your program again. as Dick mentioned, -805 was not caused by the SELECT.

2. General answer to your question, prior to comparison, check the DCLGEN for column's type, then use for your comparison, an intermediate host-variable of the exact same type.
This saves you a lot of head-aches...
Haim Zeevi
Back to top
View user's profile Send private message
View previous topic : : View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts DB2 Query to get the count of Unique ... DB2 2
No new posts Compare the member of two pds on las... DFSORT/ICETOOL 13
No new posts Need help with ADABAS query (COBOL-AD... All Other Mainframe Topics 1
No new posts JCL sort to compare dates in two file... DFSORT/ICETOOL 2
No new posts Compare 2 alphabets in a REXX and fin... CLIST & REXX 2
Search our Forums:


Back to Top