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
 

 

Concern related to SQL Result and access path

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Concern related to SQL Result and access path
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

Site Director


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

PostPosted: Wed May 02, 2007 9:24 pm    Post subject:
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    Post subject: Re: Concern related to SQL Result and access path
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    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 find RACF group for access to spooled... jzhardy JCL & VSAM 1 Mon May 08, 2017 11:46 am
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts scheduling between OPC and TWS give u... nsbl IBM Tools 4 Sun Mar 12, 2017 5:35 pm
No new posts IMS DC screen Access sivasaras IMS DB/DC 3 Fri Nov 18, 2016 6:38 pm
No new posts Access SQLCA fields inside a stored p... gangapd DB2 6 Thu Oct 27, 2016 10:20 am


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