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
 

 

Query for just presence of the row in the table

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Query for just presence of the row in the table
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: 1013
Location: India

PostPosted: Tue Aug 09, 2011 1:50 pm    Post subject:
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    Post subject: Reply to: Query for just presence of the row in the table
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    Post subject: Query for just presence of the row in the table
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    Post subject: Re: Query for just presence of the row in the table
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

Site Director


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

PostPosted: Tue Aug 09, 2011 10:20 pm    Post subject:
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    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 JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts how to send just 10 rows in a CICS sc... Megha Gupta CICS 5 Thu Feb 23, 2017 6:57 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Omegamon for DB2 query ashek15 DB2 0 Wed Feb 15, 2017 11:25 am
No new posts Join of more than one table dibyendumandal11111 DB2 6 Mon Feb 13, 2017 11:36 pm


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