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

Need to compare part of the string with the another string..


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

New User


Joined: 19 Apr 2006
Posts: 63
Location: Chennai

PostPosted: Tue Aug 17, 2010 11:07 am
Reply with quote

Hi,

i need to compare part of the string with another string.

Select *
From <table name>
where a_b_c(12:6) = x_y_z;
,,,,

Length of the a_b_c is 17 bytes, I need to compare with last 6 byes. Please let me know how to represent a_b_c(12:6).

Thanks in Advance.

Regards
Vijay
Back to top
View user's profile Send private message
ssmukul

New User


Joined: 22 Jan 2008
Posts: 19
Location: India

PostPosted: Tue Aug 17, 2010 11:23 am
Reply with quote

Hi Vijay,

You can use SUBSTR for this.

Code:
SELECT *
FROM <TABLE>
WHERE
SUBSTR(A_B_C,12,6) = X_Y_Z;


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

New User


Joined: 19 Apr 2006
Posts: 63
Location: Chennai

PostPosted: Tue Aug 17, 2010 11:25 am
Reply with quote

Thanks for response..
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue Aug 17, 2010 7:35 pm
Reply with quote

Hello,

Just keep in mind that this kind of query has the potential to dim all of the lights in the computer room. . .

If this is some one-time requirement or something that only runs sedom in batch, the impact may not be much, but if the table is high-volume and this query is often needed in online processing - there be monsters. . .

Suggest this process be run against full-volume data to make sure it runs acceptably with minimum impact to the rest of the system.

If the table has only 100 rows, it may not be important if the table contains 100 million rows, this will be an entirely different matter.
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 JCL sort to compare dates in two file... DFSORT/ICETOOL 2
No new posts ICETOOL to SUM String DFSORT/ICETOOL 1
No new posts Mark Previous & next lines when a... DFSORT/ICETOOL 9
No new posts sort to find out the char which repea... Mainframe Interview Questions 10
No new posts Compare 2 alphabets in a REXX and fin... CLIST & REXX 2
Search our Forums:

Back to Top