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

Query for just presence of the row in the table


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

New User


Joined: 04 May 2007
Posts: 21
Location: kuala lumpur

PostPosted: Tue Aug 09, 2011 1:24 pm
Reply with quote

Hi,

I am looking for a query which just returns the presence of a particular data in the table.

For eg:- i want to search a string 'DB2' in a table. The qury should return a value as YES or NO. Means whether a string is present in the table or not, just this info.
I don't want to fetch any data but just the presence of data in the table.

Thanks in advance.

Mayank
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Tue Aug 09, 2011 1:50 pm
Reply with quote

Mayan,

1 - Success
SQLCODE=-100 meaning, naaaa

Code:
select 1 from creator.tablename
where column like '%DB2%'
fetch first 1 row only


Buzzing Out,
Sushanth
Back to top
View user's profile Send private message
nightbuzzz

New User


Joined: 04 May 2007
Posts: 21
Location: kuala lumpur

PostPosted: Tue Aug 09, 2011 2:02 pm
Reply with quote

Thnx sushant...

Cheers
Mayank
Back to top
View user's profile Send private message
nightbuzzz

New User


Joined: 04 May 2007
Posts: 21
Location: kuala lumpur

PostPosted: Tue Aug 09, 2011 5:43 pm
Reply with quote

Is there any idea how to handle this query in Cobol program.

This works fine in Spufi.

Thanks
Mayank
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Aug 09, 2011 6:05 pm
Reply with quote

nightbuzzz wrote:
Is there any idea how to handle this query in Cobol program.

This works fine in Spufi.

Thanks
Mayank


For a Senior Software Engineer that should be very simple, it would take less time then posting the question here!
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: Tue Aug 09, 2011 10:20 pm
Reply with quote

Hello,

Quote:
Is there any idea how to handle this query in Cobol program.

Yes, imbed the query in a cobol program. . .

As mentioned, this should be trivial. . . Where/why are you stuck? Have you or no one else ever written a cobol/db2 program. I suspect there are many on your system you might use as an example. . .
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 Load new table with Old unload - DB2 DB2 6
No new posts Pulling a fixed number of records fro... DB2 2
No new posts RC query -Time column CA Products 3
No new posts Multiple table unload using INZUTILB DB2 2
No new posts Check data with Exception Table DB2 0
Search our Forums:

Back to Top