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
 

 

I have doubt in LIKE statement in DB2 program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
raveepisini

New User


Joined: 23 Nov 2010
Posts: 1
Location: chennai

PostPosted: Mon Aug 13, 2012 2:51 am    Post subject: I have doubt in LIKE statement in DB2 program
Reply with quote

Hi

Please find below statement
SELECT A.ACCOUNT, A.SECURITYID
FROM TABLE1 A, TABLE2 B
WHERE A.TABLE1_ACCOUNT SUBSTR(1,3) = B.TABLE2_IBD
WITH UR;

In the table1 it contains almost 54millons records
Int the table 2 it contains only 1000 records..
Because of above select statement my job running almost 10mins as elapse time and 4min cpu time.. I know in the like statment we can concatenate 2table_field to get value. Please provide me how to do..

Table1_account field size is 15
Table2_ibd file size is 3
I want to write it as
SELECT A.ACCOUNT, A.SECURITYID
FROM TABLE1 A, TABLE2 B
WHERE A.TABLE1_ACCOUNT LIKE (B.TABLE2_IBD)
WITH UR;

Please let me know how to do that
[/code]
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Aug 13, 2012 5:17 am    Post subject:
Reply with quote

Code:
WHERE A.TABLE1_ACCOUNT SUBSTR(1,3) = B.TABLE2_IBD


until you can be accurate and honest with us,
(the above sql in not proper syntax)
we are wasting our time even looking at this.
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: Mon Aug 13, 2012 8:07 am    Post subject:
Reply with quote

Hello and welcome to the forum,

Suggest you post the execution of the query you posted.

As DBZ posted, the syntax is not proper. . .
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1278
Location: Belgium

PostPosted: Mon Aug 13, 2012 2:58 pm    Post subject:
Reply with quote

You can't use like, but you might want to try something like this :
Code:
WHERE A.TABLE1_ACCOUNT between B.TABLE2_IBD || x'00' and B.TABLE2_IBD || x'FF'
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1224
Location: Israel

PostPosted: Mon Aug 13, 2012 7:43 pm    Post subject: Re: I have doubt in LIKE statement in DB2 program
Reply with quote

Using the same strange syntax, I would try:
Code:
WHERE A.TABLE1_ACCOUNT SUBSTR(1,3) IN (SELECT DISTINCT TABLE2_IBD FROM TABLE2)
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 Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts Need Suggestion on COBOL program vickey_dw COBOL Programming 5 Thu Jan 05, 2017 10:55 pm
No new posts I can not compile my program PL1 V3.R... Miguel Fernandez PL/I & Assembler 13 Tue Dec 06, 2016 8:30 pm
No new posts IMS BMP program causes 878 system abend Artemk IMS DB/DC 7 Tue Nov 22, 2016 8:26 pm
No new posts -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am


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