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

Concern related to SQL Result and access path


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

New User


Joined: 22 May 2005
Posts: 8

PostPosted: Wed May 02, 2007 12:41 pm
Reply with quote

Hello all,
Please see the scenario below. If i write a query like

SELECT * FROM POPR.VHIS WHERE COMPANY_NO = 4
AND TERMINAL = 1 ;
The result of this query doesn't fetch any rows.

But if i write a SQL like this
SELECT * FROM POPR.VHIS WHERE COMPANY_NO = 4;
will fetch quite a number of records of which some is having a value
TERMINAL = 1.

TERMINAL is a S9(2)V COMP-3 field. Inother words DECIMAL 2.

Does this have anything to do with the access path. If yes, how do i know what went wrong ?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed May 02, 2007 9:24 pm
Reply with quote

Hello,

How are you displaying the "one" after the select for "COMPANY_NO = 4"?

Might it be that the "one" is stored differently than it displays? What is the definition of the TERMINAL field in various places?

Have you tried to change yor query to "TERMINAL < 2"? This would be for testing and not necessarily for long-term use.
Back to top
View user's profile Send private message
mithun123

New User


Joined: 13 Apr 2006
Posts: 11

PostPosted: Thu May 03, 2007 8:51 am
Reply with quote

Hi tetrion,
Can u define a working storage variable as
01 HOST-TERMINAL PIC S9(2)V COMP-3.
pass the value 1 to this variable and use this in the SQL. I believe this would work. Can you please try this and let me know whether this works or not. U can also use the DCLGEN variable for the same . I believe when you are checking with fileaid for the rows that retrieved by the second query the terminal value is shown as '1.' not '1'.


Thanks and Regards,
Mithun
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts How to access web services/website? Mainframe Interview Questions 4
No new posts SET PATH in View DDL DB2 2
No new posts first column truncated in search result IBM Tools 13
No new posts access the last host command CLIST & REXX 2
Search our Forums:

Back to Top