Need help on merging two records from same file



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

Re: Need help on merging two records from same file

Postby NicC » Thu Sep 20, 2012 3:31 am

Where is this flag2? I see Code# and Flag1 and 4 amount columns. I do not see anything with a value of 4.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Need help on merging two records from same file

Postby BillyBoyo » Thu Sep 20, 2012 3:55 am

On the input, up in the first post.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Need help on merging two records from same file

Postby BillyBoyo » Thu Sep 20, 2012 5:48 am

Here would be one possible way. This is with DFSORT, so let us know if you have "syntax" problems by pasting your full sysout in the Code tags.

You can "rationalise" the column numbers to minimise space used.

//SUMRECS  EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
                                                   
  INREC  IFTHEN=(WHEN=INIT,
                   OVERLAY=(25:13C'0',40:13C'0',
                            55:13C'0',70:13C'0')),
  IFTHEN=(WHEN=(6,1,CH,EQ,C'1'),
            OVERLAY=(25:7,13,SFF,TO=ZD,LENGTH=13)),
  IFTHEN=(WHEN=(6,1,CH,EQ,C'2'),
            OVERLAY=(40:7,13,SFF,TO=ZD,LENGTH=13)),
  IFTHEN=(WHEN=(6,1,CH,EQ,C'3'),
            OVERLAY=(55:7,13,SFF,TO=ZD,LENGTH=13)),
  IFTHEN=(WHEN=(6,1,CH,EQ,C'4'),
            OVERLAY=(70:7,13,SFF,TO=ZD,LENGTH=13))
  SORT FIELDS=(1,5,CH,A)
  SUM FIELDS=(25,13,ZD,40,13,ZD,55,13,ZD,70,13,ZD)
  OUTREC BUILD=(1,5,
                25,13,ZD,M18,LENGTH=13,
                40,13,ZD,M18,LENGTH=13,
                55,13,ZD,M18,LENGTH=13,
                70,13,ZD,M18,LENGTH=13)
//SORTIN   DD *
121021 000079751.79
121014 000440494.52
121024-000241189.45
121321 000154520.73
121322 000002643.39
121323-000000000.06
121324-000227258.71
121424 000094288.24


Output is:

12101         0.00         0.00         0.00   440,494.52
12102    79,751.79         0.00         0.00  -241,189.45
12132   154,520.73     2,643.39        -0.06  -227,258.71
12142         0.00         0.00         0.00    94,288.24
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Need help on merging two records from same file

Postby Dhiren » Thu Sep 20, 2012 7:38 pm

Hi Billy,

Thank you for helping me out. The output is in reverse order.
Output after running the job :
12101         0.00    79,751.79         0.00         0.00
12104   440,494.52  -241,189.45         0.00         0.00
12134         0.00  -227,258.71         0.00         0.00


Expected output:
12101   0.00               79,751.79        0.00         000440494.52
12102   000079751.79       0.00             0.00        -000241189.45
12132   000154520.73       0.00            -0.00        -000227258.71
Dhiren
 
Posts: 12
Joined: Wed Sep 19, 2012 8:54 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Need help on merging two records from same file

Postby BillyBoyo » Thu Sep 20, 2012 7:55 pm

My sort cards (DFSort, by the way) with my test data (based on yours, but augmented) seems to do OK.

Can you show the sysout from your step and the input data that you used?

Also please explain what you mean by "reverse order".
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Need help on merging two records from same file

Postby Dhiren » Thu Sep 20, 2012 8:16 pm

Hi Billy,
Based on your sort card you should get two rows for Code 1210 (One for flag1 value of 1 and one for flag1 value of 2).
For the first row (Flag1 of 1) , the associated Flag2 value is 4 therefore Amt4 should have a value and rest (Amt 1/2/3 should be zeroes).
Similarly for Code 1213, you should only get one row based on Flag1 value of 2 and all Amt column will have values based on value of flag2 (which in your case are 1,2,3,4).
when I ran the job, the Amount column is getting value based on Flag1 instead of flag2. ( Eg : for code 1210 flag1 2 and flag2 1 & 4) the rows wriiten was
12104 Amt1
12104 Amt2
Dhiren
 
Posts: 12
Joined: Wed Sep 19, 2012 8:54 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Need help on merging two records from same file

Postby Dhiren » Thu Sep 20, 2012 8:35 pm

Thanks Billy,
Input file used in the run had some bad data and it was causing few accounts to display in-correct data. I regenerated the input file and the results are as expected.
Thank you all for your help and it was very much appreciated.

Thank you.
Dhiren
 
Posts: 12
Joined: Wed Sep 19, 2012 8:54 pm
Has thanked: 0 time
Been thanked: 0 time

Previous

Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post