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
 

 

DB2 call

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
ibmmainframe1

New User


Joined: 26 Jul 2005
Posts: 64
Location: India

PostPosted: Wed Nov 25, 2009 10:25 pm    Post subject: DB2 call
Reply with quote

Hi All

I have a querry which extracts space from the table

Code:
EXEC SQL                               
     SELECT " "                         
       INTO :WS-SG57-SPACE             
       FROM SOASG57_SVCPRT_WTY         
      WHERE VIN_C = :CS0014-INPUT-VIN   
END-EXEC                               


Pls let me know which coloum value is fetched?

Thanks.
Back to top
View user's profile Send private message

GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1278
Location: Belgium

PostPosted: Wed Nov 25, 2009 10:38 pm    Post subject:
Reply with quote

none

if 1 row is found, then a space will be put into WS-SG57-SPACE
If no row is found then +100 is returned
if >1 rows are found, you get some other sqlcode

Which is probably what the statement wants to test.
Back to top
View user's profile Send private message
ibmmainframe1

New User


Joined: 26 Jul 2005
Posts: 64
Location: India

PostPosted: Thu Nov 26, 2009 2:46 pm    Post subject:
Reply with quote

I got it. Basically it is testing whether that Input_VIN is present in the table.

The other way could be..
select Vin_C and test if it is not spaces.

GuyC,

pls correct me if my understanding is wrong.

Thanks a lot for your response.
Back to top
View user's profile Send private message
Bharath Bhat

Active User


Joined: 20 Mar 2008
Posts: 283
Location: chennai

PostPosted: Thu Nov 26, 2009 2:56 pm    Post subject:
Reply with quote

ibmmainframe1 wrote:
I got it. Basically it is testing whether that Input_VIN is present in the table.

The other way could be..
select Vin_C and test if it is not spaces.

GuyC,

pls correct me if my understanding is wrong.

Thanks a lot for your response.


select Vin_C and test if it is equal to CS0014-INPUT-VIN
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1278
Location: Belgium

PostPosted: Thu Nov 26, 2009 3:40 pm    Post subject:
Reply with quote

The idea is that select space is faster than selecting a column.
select 1 as an integer would even be a little bit better.

But really that is talking about nanoseconds or even picoseconds.


If you select with a where clause there is no need to test the field afterwards. The statement will always return +100 when not exists.
Back to top
View user's profile Send private message
ibmmainframe1

New User


Joined: 26 Jul 2005
Posts: 64
Location: India

PostPosted: Thu Nov 26, 2009 10:41 pm    Post subject:
Reply with quote

Quote:
The idea is that select space is faster than selecting a column.


I was not aware of this.

Thanks a lot for a clear explanation GuyC
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 Cobol EZASOKET call to SETSOCKOPT fails Andi1982 COBOL Programming 6 Thu Oct 06, 2016 7:12 pm
No new posts Strange EXEC function call in z/VM Willy Jensen CLIST & REXX 3 Wed Oct 05, 2016 2:07 pm
No new posts COBOL DB2 - CALL statement - high CPU... TS70363 DB2 15 Sun Sep 11, 2016 6:07 am
No new posts Is possible to call subprogram from c... cmsmoon COBOL Programming 3 Fri Aug 05, 2016 6:46 pm
No new posts PCOMM macro to call another PCOMM macro boyti ko All Other Mainframe Topics 4 Tue Jul 12, 2016 4:30 pm


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