Repeated records using Sorttool



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

Repeated records using Sorttool

Postby Sanda » Sun Dec 20, 2009 2:22 am

Urgent Help Required!

I have a input file as below with 6 records (first four chars as the cust_id and the 7th char as the comm_ref <sorted on cust_id,Comm_ref>)

1221 1
1221 2
1222 1
1223 1
1223 2
1223 3

I need to create a test file with records for each of the cust_id to be repeated 3 times ( in above case there are 3 different cust_id) and the new records created to have the cust_id starting from 5001
The ouput file should have the below 18 records.

5001 1
5001 2
5002 1
5002 2
5003 1
5003 2
5004 1
5005 1
5006 1
5007 1
5007 2
5007 3
5008 1
5008 2
5008 3
5009 1
5009 2
5009 3


Is this possible using sort tool?
Thanks
Sanda
 
Posts: 2
Joined: Sun Dec 20, 2009 1:48 am
Has thanked: 0 time
Been thanked: 0 time

Re: Repeated records using Sorttool

Postby dick scherrer » Sun Dec 20, 2009 3:56 am

Hello and welcome to the forum,

Urgent Help Required!
Perceptions vary. . . If this was truly urgent, you would have already written the code rather than posting on some forum where the request might not be seen for hours or days. . .

Many things can be done with the sort products (and you did not mention which sort is used on your system). However, what you have posted will be more difficult (if even possible - via the sort or even a programming language). This is beacuse your sample data and your "rules" are inconsistent (at least to me).

The "rules" say each record is to be repeated 3 times. Why are there only 2 records with 5001? Why is there only 1 record with 5004?

Hopefully, you know what is really needed and can implement cobol or something else to generate the needed output. . .
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Repeated records using Sorttool

Postby Sanda » Sun Dec 20, 2009 11:09 am

Many thanks Dick for your reply!
I am using SyncSORT
And sorry for not being clear on my requirement

The rule is to repeat the records of each of the Cust_ID to 3 times with the Cust_id in the repeated records to start from 5001 and incremented by 1

Records for cust_id 1221
Input

1221 1
1221 2

Output

5001 1
5001 2
5002 1
5002 2
5003 1
5003 2


Records for cust_id 1222

Input
1222 1

Output
5004 1
5005 1
5006 1

Records for Cust_id 1223

Input
1223 1
1223 2
1223 3

Output
5007 1
5007 2
5007 3
5008 1
5008 2
5008 3
5009 1
5009 2
5009 3

Hope I am clear enough
Thanks
Sanda
 
Posts: 2
Joined: Sun Dec 20, 2009 1:48 am
Has thanked: 0 time
Been thanked: 0 time

Re: Repeated records using Sorttool

Postby dick scherrer » Sun Dec 20, 2009 11:35 am

Hello,

Much more clear :)

Possibly one of our Syncsort "heavies" will be online soon/later and have a suggestion.

If may help if you also post what version of Syncsort is being used. If you are not sure, this is printed at the top of the informational output generated by the sort.

If this is truly needed quickly, i'd suggest writing the procedural code to do this. . .
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post