Hi all,
I have to pick up data from a column randomly.My column datatype is varchar.I am using datastage 8.1.How can I do this????
column sampling
Moderators: chulett, rschirm, roy
Hi chulett
I have two input Sequential file each have two columns and their datatypes are varchar.My requirement is the output file have four columns.First two columns are direct mapping from first input file and other two columns have to be loaded with data randomly picked from the two columns in the second file.There is no business rule for picking up the data from the second input file.How can i do this.???
I have two input Sequential file each have two columns and their datatypes are varchar.My requirement is the output file have four columns.First two columns are direct mapping from first input file and other two columns have to be loaded with data randomly picked from the two columns in the second file.There is no business rule for picking up the data from the second input file.How can i do this.???
One potential method:
On your second file (which you will randomly select from), assign a sequential sequence number (NOT random) to each row. You could use row number generation in Sequential File stage, for example...this would probably be the best place to do it. The results should be 1, 2, 3, 4, ... number_of_rows
Knowing exactly how many rows are present in your second file, assign a random sequence number to each row of your first file, with a maximum value of the number of rows in the second file. You can use one of the random number functions in a transformer or use a column generator stage.
Then, using a lookup/join/merge, join the two files on the sequence number columns.
Regards,
On your second file (which you will randomly select from), assign a sequential sequence number (NOT random) to each row. You could use row number generation in Sequential File stage, for example...this would probably be the best place to do it. The results should be 1, 2, 3, 4, ... number_of_rows
Knowing exactly how many rows are present in your second file, assign a random sequence number to each row of your first file, with a maximum value of the number of rows in the second file. You can use one of the random number functions in a transformer or use a column generator stage.
Then, using a lookup/join/merge, join the two files on the sequence number columns.
Regards,
- james wiles
All generalizations are false, including this one - Mark Twain.
All generalizations are false, including this one - Mark Twain.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
It's not marked as resolved, nor is there any indication that U (one of our posters) had any involvement at all.
The second person personal pronoun in English is spelled "you".
The second person personal pronoun in English is spelled "you".
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.