Hello!
I have created a Server Routine that has this single line:
Ans=Rnd(1000)
I tested this routine several times and it always generates a random number as expected.
BUT when I execute this routine inside a Transformer stage, for each job execution I always get the same number (513), it's not generating a random number...
I tested a simple job that loads 3 rows into a file with 1 column which Derivation is just the calling of the above routine. Everytime I run, it I always get the following:
513
175
308
Did anyone experienced something like this?
Any explanation why this routine has a differente behaviour when inside a Transformer stage?
Thank you!
Rnd function always returns the same value
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 35
- Joined: Wed Jun 15, 2005 9:27 am
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Read the DataStage BASIC manual about this function, and how the generator is seeded. You may need to create a before-stage subroutine to seed it off something variable like
Code: Select all
Date() * Time()
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
I was thinking the same thing but it seems the seed is more applicable to the Randomize() function. Rnd(n) is supposed to generate a random number between 0 and n-1 rather than a series of 'pseudo-random' numbers.
Mind you, I haven't read the BASIC manual entry for this, only the online help.
Mind you, I haven't read the BASIC manual entry for this, only the online help.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers