sequential file clarification

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
vamsi.4a6
Participant
Posts: 334
Joined: Sun Jan 22, 2012 7:06 am
Contact:

sequential file clarification

Post by vamsi.4a6 »

source is sequential file.
Requirement:
Input file's data should be distributed like 1st 3 row in file1, next 3 row in file2, next 3 rows in file3 again next 3 rows in file1 and continues.

Currently we have less records in source so i generated rownum in sequential filestage and put
constraint in transformer which is not good practise.Without hardcoding constraints in transformer is there any way to do it.
Thanks and Regards
Vamsi krishna.v
http://datastage-vamsi.blogspot.in/
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Me, I'd use Mod() to control the constraint.
-craig

"You can never have too many knives" -- Logan Nine Fingers
vamsi.4a6
Participant
Posts: 334
Joined: Sun Jan 22, 2012 7:06 am
Contact:

Post by vamsi.4a6 »

Not sure how to proceed using MOd fuction after thinking for long time
Thanks and Regards
Vamsi krishna.v
http://datastage-vamsi.blogspot.in/
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

Constraints are very useful. Why would someone suggest not to use constraints?
Choose a job you love, and you will never have to work a day in your life. - Confucius
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Off the top of my head, Mod() the record number by 9 and then use three sets of three values for the constraints: 1,2,3 to first file; 4,5,6 to the second and 7,8,0 to the third.
-craig

"You can never have too many knives" -- Logan Nine Fingers
vamsi.4a6
Participant
Posts: 334
Joined: Sun Jan 22, 2012 7:06 am
Contact:

Post by vamsi.4a6 »

It is perfectly working.Thanks

@Eric

I do not have any issue to use the constraint but what craig provided is generalized solution which will handle any volume of data
Thanks and Regards
Vamsi krishna.v
http://datastage-vamsi.blogspot.in/
ssnegi
Participant
Posts: 138
Joined: Thu Nov 15, 2007 4:17 am
Location: Sydney, Australia

Post by ssnegi »

You can also have stage variable in transformer in sequential mode :
svcnt Initial Value 0 : if svcnt < 9 and then svcnt+1 else 1
Then put contraints :
FILE1 : svcnt =1 or svcnt = 2 or svcnt = 3
FILE2 : svcnt =4 or svcnt = 5 or svcnt = 6
FILE3 : svcnt =7 or svcnt = 8 or svcnt = 9
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Slower (because of spurious requirement for sequential mode) and less efficient (because of additional CPU cycles for calculation) than the Mod() function already suggested.
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