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

DB2 call


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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: 1281
Location: Belgium

PostPosted: Wed Nov 25, 2009 10:38 pm
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
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
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: 1281
Location: Belgium

PostPosted: Thu Nov 26, 2009 3:40 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Error while running web tool kit REXX... CLIST & REXX 5
No new posts Call program, directly from panel CLIST & REXX 9
No new posts Batch call online program, EXCI task ... CICS 3
No new posts CSQBGET - Call giving completion code... COBOL Programming 3
No new posts CICS DPL call CICS 6
Search our Forums:

Back to Top