Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 6968
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: 1243
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 How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts Accessing CICS tran with map from JCL... navdeepaggarwal CICS 5 Tue Oct 03, 2017 6:15 pm
No new posts WER268A OUTREC STATEMENT : SYNTAX E... frozenblood87 SYNCSORT 12 Sat Aug 26, 2017 9:45 pm
No new posts Suppress value reported by BREAK in D... Learncoholic DFSORT/ICETOOL 3 Wed Aug 16, 2017 6:03 pm
No new posts ON 2 AND EVERY 1 - Statement ??? UmeySan COBOL Programming 2 Tue Jul 25, 2017 1:20 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us