MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to perform a search operation on a LONGVARCHAR variable

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
prmohanty
Beginner


Joined: 14 Mar 2009
Posts: 1
Topics: 1

PostPosted: Mon Jun 15, 2009 1:09 pm    Post subject: How to perform a search operation on a LONGVARCHAR variable Reply with quote

Hi ,

Is there any way , I can write a Select statement in SPUFI to extract those records from a table where the column defined as LONGVARCHAR contains specific value.

Regards
PRM
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12380
Topics: 75
Location: San Jose

PostPosted: Mon Jun 15, 2009 1:32 pm    Post subject: Reply with quote

prmohanty,

Did you try LIKE predicate? Read upon it here and also the examples at the bottom of the link

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DSNSQJ12/2.22.7

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
NASCAR9
Intermediate


Joined: 08 Oct 2004
Posts: 274
Topics: 52
Location: California

PostPosted: Mon Jun 15, 2009 4:21 pm    Post subject: Reply with quote

Am I missing something? Would it not be as easy as:

Select
FIRST_NAME,
LAST_NAME,
FROM YOUR_TABLE
WHERE LAST_NAME = 'SMITH'

LAST_NAME is LONGVARCHAR
_________________
Thanks,
NASCAR9
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12380
Topics: 75
Location: San Jose

PostPosted: Mon Jun 15, 2009 7:04 pm    Post subject: Reply with quote

NASCAR9 wrote:
Am I missing something?


Nasacar,

I think OP wanted to search for a specific string any where in the long varchar colum

ex: if the column consists of the following

Code:

NASCAR
The official site of NASCAR is Nascar.com
NASCAR delivers exciting finish‎
The National Association for Stock Car Auto Racing (NASCAR) is a family-owned ...


Your SQL would only fetch the 1st row where as a LIKE predicate will fetch all the 4 rows

however if you change the where clause to

Code:

WHERE  LAST_NAME LIKE '%NASCAR%'


will fetch all the rows
Back to top
View user's profile Send private message Send e-mail Visit poster's website
NASCAR9
Intermediate


Joined: 08 Oct 2004
Posts: 274
Topics: 52
Location: California

PostPosted: Tue Jun 16, 2009 10:50 am    Post subject: Reply with quote

Thanks kolusu for clarification. When I read the request it sounded LIKE he was searching for a set string.

Your LIKE example makes perfect sense to me!
_________________
Thanks,
NASCAR9
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group