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: 6967
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: 1281
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: 1228
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 IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts Need help in REXX CALL program Raje1002 CLIST & REXX 5 Wed Apr 19, 2017 11:18 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 ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm
No new posts VALIDATE NULL VALUE IN DB2 CASE STATE... useit DB2 5 Thu Feb 09, 2017 4:34 pm


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