Impact Analysis - Like & Equal in command

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
nkln@you
Premium Member
Premium Member
Posts: 271
Joined: Wed Nov 17, 2004 5:15 am
Location: US

Impact Analysis - Like & Equal in command

Post by nkln@you »

I am not able to get desired results using the following the command:


SELECT NAME FMT '50L', CATEGORY FMT '60L' FROM DS_JOBS WHERE JOBNO IN (SELECT OBJIDNO FROM DS_JOBOBJECTS WHERE EVAL 'UPCASE(@RECORD)' = '$Table')

$Table is parameter passed in shell script

But when I use LIKE instead of '=', I am getting results.
i.e EVAL 'UPCASE(@RECORD)' = '$Table' is not working but EVAL 'UPCASE(@RECORD)' LIKE '%$Table%' IS WORKING
I want to search for exact name but not for strings. Is there a way using above command?
Aim high
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You are already searching for an exact match because '$Table' does not include any wildcard character. LIKE is necessary because you are comparing against the entire DS_JOBOBJECTS record which will never have the value '$Table' alone.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
nkln@you
Premium Member
Premium Member
Posts: 271
Joined: Wed Nov 17, 2004 5:15 am
Location: US

Post by nkln@you »

But when I use EVAL 'UPCASE(@RECORD)' LIKE '%$Table%'. I get results which I do not require. Suppose I am seraching for Word FACT_CLAIMS.

LIKE would give me jobs where FACT_CLAIMS_BACKLOG, FACT_CLAIMS _DEFRRED is used along with FACT_CLAIMS.

I want only jobs which has the exact word FACT_CLAIMS.
Aim high
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Then you need to add more filtering, as suggested below, or to construct complete metadata for the DS_JOBOBJECTS table so that you can query individual columns therein separately. The vendor has elected not to provide that metadata, so you need to construct the same based on your own researches. Here is one way to handle your specific example.

Code: Select all

EVAL "@RECORD" LIKE '%FACT\_CLAIMS%' AND EVAL "@RECORD" NOT LIKE '%FACT\_CLAIMS\_%' ESCAPE '\'
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply