I have a special requirement. My file has the following columns.
A,B,C. with A being the main column. and file sorted by A.
I need to create an output file which has the following columns.
S,A,B,C. A, B and C are derived from the above I/P file columns and S is derived based on the following rule.
S = 01 for every unique value of A.
But if there are 2 records with the same value of A then S in incremented to 02,03 and so on, depending on how many records have the same value of A.
Here is an example of I/P file.
A B C
1 1b 1c
2 2b 2c
2 2d 2e
3 3b 3c
Here is an example of O/P file needed.
S A B C
01 1 1b 1c
01 2 2b 2c
02 2 2d 2e
01 3 3b 3c
Please do let me know how we could do this in DATASTAGE.
All help is greatly appreciated.
With Warm Regards,
Vidya Iyer
Creating the sequence nbrs in a file.
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 10
- Joined: Wed Apr 16, 2008 7:39 am
- Location: USA
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Sort with a Sort stage and have it generate a key change column. In a downstream Transformer stage reset the counter to 1 if the key change column is 1, otherwise increment the counter.
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.