File Comparison and RE-write



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

File Comparison and RE-write

Postby jaydeep1 » Thu Oct 27, 2011 2:46 am

I am working on a preparing a solution for the below requirement. Can you suggest some SORT ideas. We have SYNCSORT R132.

Input 1 (always negative values)
A  -2000
B  -2500   


INPUT 2 (always zero or positive values)
A         +100             280
A         +200             280
A         +300             281
A         +400             282
A         +500             283
A         +600             288
A         +700             290
B         +100             280
B         +200             280
B         +300             281
B         +400             284
B         +500             284
B         +600             290
B         +700             299
B         +800             300


Read (always negative) value against 'A' from INPUT1 and Start Reading 'A' records from INPUT2 from top to bottom till it covers (-ve from INPUT1 plus 'added up' +ve from INPUT2 is equal to or greater than zero). Once -ve value is fully covered, take value associated with the last read row, from the third column of INPUT2 and apply to all the rows previously read, leaving the remaining ('unread') rows intact.

Desired OUTPUT
A         +100             288
A         +200             288
A         +300             288
A         +400             288
A         +500             288
A         +600             288
A         +700             290
B         +100             299
B         +200             299
B         +300             299
B         +400             299
B         +500             299
B         +600             299
B         +700             299
B         +800             300


Any suggestions/help is greatly appreciated. If this can be achieved in a multi-step SORT, that would be great! Otherwise, the only option would be COBOL Program with Arrays! :x
jaydeep1
 
Posts: 3
Joined: Thu Oct 27, 2011 2:25 am
Has thanked: 0 time
Been thanked: 0 time

Re: File Comparison and RE-write

Postby dick scherrer » Fri Oct 28, 2011 6:11 am

Hello and welcome to the forum,

Your "output" does not appear to follow your posted "rules" :?
I may have misunderstood something.

Keep in mind that while your question is completely clear to you, it may not be to those who read it and would like to help.

Good job using the Code tag - it would be helpful if everyone did :)
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: File Comparison and RE-write

Postby jaydeep1 » Fri Oct 28, 2011 7:50 pm

Thanks Dick for your response.

I am attempting to re-word a little bit to make it clearer:

Read (always negative) value against 'A' from INPUT1 and Start Reading 'A' records from INPUT2 from top to bottom till it covers (-ve from INPUT1 plus 'added up' +ve from INPUT2 is equal to or greater than zero). Once -ve value is fully covered, take value associated with the last read row, from the third column of INPUT2 and apply to all the rows previously read, leaving the remaining ('unread') rows, for 'A' , intact. Repeat the same logic for 'B's.

With this added text in bold, I guess my posted 'rules' follow exactly what's shown in the example.
jaydeep1
 
Posts: 3
Joined: Thu Oct 27, 2011 2:25 am
Has thanked: 0 time
Been thanked: 0 time

Re: File Comparison and RE-write

Postby BillyBoyo » Fri Oct 28, 2011 8:08 pm

Once the accumulated value of each letter group "covers" the -ve value for that letter group on the first file, update the reference on all the records, on the second file, for that group up to this point to have the reference of the current record which has completed the "covering" of the -ve value on the first file.

Seems to be asking a lot from a sorting product.

If you can append a running total and a sequence number, then descending sort on the sequence number, you'd know the current record which covered the -ve before you've read the ones which make up that total. Maybe something from that?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: File Comparison and RE-write

Postby jaydeep1 » Fri Oct 28, 2011 8:26 pm

Yes, that's exactly what I was trying to get to - to append a running total in the INPUT2. Is that possible through SORT?
jaydeep1
 
Posts: 3
Joined: Thu Oct 27, 2011 2:25 am
Has thanked: 0 time
Been thanked: 0 time

Re: File Comparison and RE-write

Postby BillyBoyo » Fri Oct 28, 2011 8:37 pm

Have you got your sort manual? Maybe have a look at "grouping" the records, and "pushing" a value you can increment? I don't have Syncsort manuals. Have you googled for similar requirements? Might get you something.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: File Comparison and RE-write

Postby dick scherrer » Fri Oct 28, 2011 8:59 pm

Hello,

If the organization is licensed to use the product, all of the material is available free from Syncsort Support.
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