View previous topic :: View next topic
|
Author |
Message |
Ramya A
Active User
Joined: 26 Jul 2004 Posts: 104
|
|
|
|
Hi,
Again a doubt in SORT. My requirement is this:
There is seq file with the following data:
File1:
345
10
100
Now I want my output file (Say File2) to have the value arrived from 345-(10+100). i.e First record - (Second +Third record). If needed some unique characters can be added to the file (like the first character as 1 for first record,2 for third and 3 for fourth. I know there are ADD and MULTIPLY commands in SORT, but is it possible to apply them for different records..
Hope my requirement is clear. Please let me know if it is possible through SORT (Even ICETOOL is fine) ASAP. |
|
Back to top |
|
|
sandip_datta
Active User
Joined: 02 Dec 2003 Posts: 150 Location: Tokyo, Japan
|
|
|
|
What will be the case in last and last but one records?
regards,
Sandip. |
|
Back to top |
|
|
Ramya A
Active User
Joined: 26 Jul 2004 Posts: 104
|
|
|
|
Sorry Sandip... I didn't get you.
If you are asking about the unique characters that I've mentioned, it should be like this:
1 345
2 10
3 100
And there are only 3 records in this file. |
|
Back to top |
|
|
sandip_datta
Active User
Joined: 02 Dec 2003 Posts: 150 Location: Tokyo, Japan
|
|
|
|
I think ADD and MULTIPLY do not apply to multiple records.
Your input looks like -
345
10
100
Your expected output -
235 [345 - (10+100)]
?? [10 - (100+?)]
?? [100 - (?+?)]
What will be there in place of "?" ?
Regards,
Sandip. |
|
Back to top |
|
|
Ramya A
Active User
Joined: 26 Jul 2004 Posts: 104
|
|
|
|
My output needs only one record:
235 [345 - (10+100)]
Even I tried in all the help topics and forums, and I think it is not possible with SORT. Let me know if there is any way.
Thanks for the response. |
|
Back to top |
|
|
sandip_datta
Active User
Joined: 02 Dec 2003 Posts: 150 Location: Tokyo, Japan
|
|
|
|
You can definitely write program using COBOL. But that will not be worthy for just this work.
You can try EASYTRIEVE if you have this installed in your shop. Let me know, then I can give you the code.
Regards,
Sandip. |
|
Back to top |
|
|
Ramya A
Active User
Joined: 26 Jul 2004 Posts: 104
|
|
|
|
We do have EASYTRIEVE. But I do not know to code in it. It would be nice if you could give me the code with simple comments on them. Thanks. |
|
Back to top |
|
|
|