Logic Needed

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
DS2016
Participant
Posts: 2
Joined: Fri Jun 03, 2016 7:56 am
Location: NY

Logic Needed

Post by DS2016 »

Hi All,

I have an incoming file with 4 fields. I need to check each value in field1 has 10 specific values in field3. If atleast one is missing from field3, file should not be processed.

Can someone please help me to achieve this.

Appreciate your help.

Thanks
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Could you give a short example of the data in fields 1 and 3?
DS2016
Participant
Posts: 2
Joined: Fri Jun 03, 2016 7:56 am
Location: NY

Post by DS2016 »

Below is an example of data. I have made up some data. Field2, even if it has 10 or 20 distinct values, it should definitely have the 10 distinct values that I am looking for.

Field1 Field2

1CP001 ABC
1CP001 BCD
1CP001 CDE
1CP001 DEF
1CP001 EFG
1CP001 FGH
1CP001 GHI
1CP001 HIJ
1CP001 IJK
1CP001 JKL
1CP002 ABC
continues like this
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Your original post mentions that you have "four fields" and the logic needs to check field1 against field3... and now your example has two fields. So, is field2 in your example the same as field3 in your first post? :? And are you looking for 10 distinct values regardless of actual value or does your "distinct values that I am looking for" comment mean you have a list of 10 specific values that need to be there or the file "should not be processed"? We'll probably need to talk about what exactly that means but let's start with this.

Not a big fan of made up example data, btw.
-craig

"You can never have too many knives" -- Logan Nine Fingers
UCDI
Premium Member
Premium Member
Posts: 383
Joined: Mon Mar 21, 2016 2:00 pm

Post by UCDI »

this sounds like something you would do easier in SQL, counting the values in one column to see if you have exactly 10 distinct values in the second column.

So if they are in a file, poke them into a temporary staging table, run a sql statement that validates it, and proceed could be a simple design?

If it passes that test you can check that each value is in a specific list with a lookup stage to finish up the checking, if I understood the requirement.
Teej
Participant
Posts: 677
Joined: Fri Aug 08, 2003 9:26 am
Location: USA

Post by Teej »

Or just use a lookup against a row generator with list of reference data.

Nice thing about Row Generator, you can use parameters in some cases to achieve what you want.

Also could use a sequential file, if you can manage that (some customers do not like the idea of a random text file in the production environment).

-T.J.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I'd still like to see the requirements clarified.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I'd be thinking to use a Data Rules stage implementing in_reference_column rules.
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