pattern matching job

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

pattern matching job

Post by prasson_ibm »

Hi,

I have requirement to search the sub string in the reference data.I have to check the existence of substring in the lookup master table.If it is present then process the record otherwise reject.

For this i have created the "Sparse Lookup" job in which i have source and reference has ODBC Connector stage.

I made reference as "sparse" and written user defined sql as

Code: Select all

SELECT COL1 FROM DB2ADMIN.TEST WHERE ORCHESTRATE.COL1 = COL1
For this query job is working fine but its matching the exact string in the reference table.

But when i changed this query to

Code: Select all

SELECT COL1 FROM DB2ADMIN.TEST WHERE ORCHESTRATE.COL1 like '%COL1%'


Then all rows are rejected.

Can anyone help me to resolve this issue.

Thanks
Prasoon
ankursaxena.2003
Participant
Posts: 96
Joined: Mon May 14, 2012 1:30 pm

Post by ankursaxena.2003 »

Try to use the following function:

Index(%string%,%substring%,%occurrence%)

%String% ---> Original String.
%substring% ---> patern you are searching for.
%occurrence% ---> you can hard code it as 1.

Use the above function in SV1. And later put a constraint that SV1>0 then process the records, else reject.

You will get SV1=0, if it is not able to find substring in the String, else it will have some value greater than 0.
jwiles
Premium Member
Premium Member
Posts: 1274
Joined: Sun Nov 14, 2004 8:50 pm
Contact:

Post by jwiles »

The records were rejected because your sql was searching for the string 'COL1' within the orchestrate column. Try the following sql logic instead:

Code: Select all

SELECT COL1 FROM DB2ADMIN.TEST WHERE LOCATE_IN_STRING(ORCHESTRATE.COL1,COL1,1) > 0
Regards,
- james wiles


All generalizations are false, including this one - Mark Twain.
prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

Post by prasson_ibm »

I am getting error as
Unexpected procedure reference found.
ankursaxena.2003
Participant
Posts: 96
Joined: Mon May 14, 2012 1:30 pm

Post by ankursaxena.2003 »

Did you try my approach?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Your approach doesn't look applicable to me. It's not about pattern matching between two known values, they need to do a lookup using a substring match.
-craig

"You can never have too many knives" -- Logan Nine Fingers
jwiles
Premium Member
Premium Member
Posts: 1274
Joined: Sun Nov 14, 2004 8:50 pm
Contact:

Post by jwiles »

Is there more to the error message? I suspect there is (SQLCODE, SQLSTATE, etc.)...just copy and paste the entire message.

What was the select statement you used? Copy and paste it as well, don't retype it.

Regards,
- james wiles


All generalizations are false, including this one - Mark Twain.
Post Reply