Hi All,
I want to populate a table with single column which should contain values from 1 to 100. I can use dummy source file as follows...
Dummy
---------
X
Thanks in advance
Generates unique values
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 28
- Joined: Wed Jan 11, 2006 8:29 pm
- Location: Singapore
- Contact:
Generates unique values
Thnaks and Regards,
AnjiReddy.
AnjiReddy.
-
- Participant
- Posts: 28
- Joined: Wed Jan 11, 2006 8:29 pm
- Location: Singapore
- Contact:
Since your source file has nothing at all to do with the output file why not approach the matter differently. Take a dummy source file with more rows than you want to generate and read it in a simple job. Ignore any columns from that source file, in your transform stage just set the output column value to "@INROWNUM" and put a constraint on the transform that limits the number of rows output; e.g. "@INROWNUM <= 100".
-
- Participant
- Posts: 28
- Joined: Wed Jan 11, 2006 8:29 pm
- Location: Singapore
- Contact:
Stage variables are computed for each row; so there is no additional looping possible with them use in the normal way. Since a sequential file is in reality just a long string with one or two special characters that denote new lines (either <cr> or <cr><lf>) you could always put together your own string that contains these line markers and, with one write statement, end up creating more than one line in the output file. You could do this string buildup in a user-written routine, but it is simpler and more understandable to solve it in the way already mentioned in this thread.
You do realize the 'dummy source file' is completely unnecessary here, yes?ArndW wrote:Since your source file has nothing at all to do with the output file why not approach the matter differently. Take a dummy source file with more rows than you want to generate and read it in a simple job. Ignore any columns from that source file, in your transform stage just set the output column value to "@INROWNUM" and put a constraint on the transform that limits the number of rows output; e.g. "@INROWNUM <= 100".
![Razz :P](./images/smilies/icon_razz.gif)
All you need is a Transformer and the output, whatever that may be. Declare a dummy stage variable so the job will compile but you don't even need to use it. The same constraint and output derivation will be fine.
Basically, a setup that like can be used to generate all kinds of data. I've used it to generate test data in the past, for example. Make sure you have a constraint to limit the output rows and it will keep going and going and going...
![Wink :wink:](./images/smilies/icon_wink.gif)
Seem to remember this technique being call 'Markov Chaining' or some such.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers