Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Can we compare pic 9(1) with pic x(1) in db2 query.
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    Post subject:
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    Post subject:
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: 6966
Location: porcelain throne

PostPosted: Mon May 09, 2011 4:50 pm    Post subject:
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    Post subject: Reply to: Can we compare pic 9(1) with pic x(1) in db2 que
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Join in SQL Query vickey_dw DB2 2 Tue Jan 17, 2017 12:15 am
No new posts Storing huge volume of data, compare ... Pradeep K M All Other Mainframe Topics 3 Mon Jan 16, 2017 5:08 pm
This topic is locked: you cannot edit posts or make replies. MQ setup query mohitsaini Java & MQSeries 4 Sun Jan 08, 2017 1:53 am
No new posts DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us