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

SQL - WHERE clause with reference modification and "_&q


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

New User


Joined: 04 May 2007
Posts: 20
Location: INDIA

PostPosted: Tue Nov 09, 2010 6:12 am
Reply with quote

Hi,
I have a column of size 8 bytes. I want to extract all the records with the 4th byte having specific values. For eg.

Table-1

Col-1
------
ABC1ABC1
AAA2AAA2
BEF1BCD1
ABED1YMK2

from the above sample table, i want to extract all the records having the value "2" in the 4th position of that column-1.
I can think of "_" but not sure how to use against a specific position, like 4th byte only.
Can some one please help me with the WHERE clause for this getting the above desired result?
Thanks in advance
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 Nov 09, 2010 6:16 am
Reply with quote

Suggest you read about substr in the SQL reference.
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 Nov 09, 2010 9:28 am
Reply with quote

Hello,

And expect poor performance. . .
Back to top
View user's profile Send private message
mlp

New User


Joined: 23 Sep 2005
Posts: 91

PostPosted: Tue Nov 09, 2010 9:34 am
Reply with quote

If performance is your concern then take unload extract of table and simply sequentially read the file and look for the desired byte location to filter the records.
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 PuTTY - "User is not a surrogate... IBM Tools 5
No new posts Newbie Stuck on "Duplicate Datas... TSO/ISPF 5
No new posts To search DB2 table based on Conditio... DB2 1
No new posts RABBIT HOLE NEEDED - "Live"... All Other Mainframe Topics 0
No new posts Reference for COND parameter. JCL & VSAM 1
Search our Forums:

Back to Top