Creating the sequence nbrs in a file.
Posted: Tue Apr 22, 2008 2:48 pm
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
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