IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

SYNCSORT Card for Summing occurs fields


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Wed Oct 24, 2007 8:19 pm
Reply with quote

miosne
Check this code with sample example, it sums Horizontal as well as vertical.
Assumed LRECL is 80,modify as per your requirent.

Code:
//******************************************************************** 
//S1       EXEC  PGM=ICEMAN                                             
//SYSOUT   DD  SYSOUT=*                                                 
//SORTIN   DD *             
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
AAAAA    11.34   34.45   62.43                                         
AAAAA    14.34   44.45   62.43                                         
AAAAA    12.34   34.45   62.43                                         
AAAAA    12.34   34.55   62.43                                         
ABBBB    32.43   54.24   34.54                                         
ABBBB    32.43   64.23   34.54                                         
ABBBB    32.43   54.23   14.54                                         
/*                                                                     
//SORTOUT  DD DSN=&&TEMP1,DISP=(MOD,PASS),SPACE=(TRK,(5,5)),UNIT=SYSDA 
//SYSIN    DD    *                                                     
  SORT FIELDS=(1,5,CH,A)                                               
  OUTFIL REMOVECC,NODETAIL,                                             
    SECTIONS=(1,5,                                                     
      TRAILER3=(1,5,8:TOT=(8,7,UFF,TO=ZD,LENGTH=7),                     
                   16:TOT=(16,7,UFF,TO=ZD,LENGTH=7),                   
                   24:TOT=(24,7,UFF,TO=ZD,LENGTH=7),80:X))             
/*                                                                     
//******************************************************************** 
//S2       EXEC  PGM=ICEMAN                                             
//SYSOUT   DD  SYSOUT=*                                                 
//SORTIN   DD DSN=&&TEMP1,DISP=(MOD,PASS)                               
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD    *                                                     
  SORT FIELDS=COPY                                                     
  INREC OVERLAY=(50:(8,7,ZD,ADD,                                       
                    16,7,ZD,ADD,                                       
                    24,7,ZD),EDIT=(IIIIT.TT),                           
                 8:8,7,ZD,EDIT=(IIIIT.TT),                             
                16:16,7,ZD,EDIT=(IIIIT.TT),                             
                24:24,7,ZD,EDIT=(IIIIT.TT))                             
/*                                                                     


SORTOUT
Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
AAAAA     50.36  147.90  249.72                    447.98                       
ABBBB     97.29  172.70   83.62                    353.61                       


If still, this not what you wanted then i failed in understanding your requirement sterb050.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Oct 24, 2007 8:35 pm
Reply with quote

Hi Krisprems,

Me again icon_smile.gif Looks good. I believe you are quite close.

I suspect that a "final total" line at the bottom is also needed.
Back to top
View user's profile Send private message
miosne
Warnings : 1

New User


Joined: 13 Mar 2006
Posts: 63
Location: italy

PostPosted: Wed Oct 24, 2007 8:37 pm
Reply with quote

Thank you very much for your, the same for the others members, patience!!!!!!! icon_biggrin.gif icon_biggrin.gif icon_biggrin.gif icon_biggrin.gif
It works!!!!!!!
I've only one question more:
If the i/p file have occurs-100 field.
I've to write 100 of "8:8,7,ZD,EDIT=(IIIIT.TT)"
Is there any method to do this???
Back to top
View user's profile Send private message
miosne
Warnings : 1

New User


Joined: 13 Mar 2006
Posts: 63
Location: italy

PostPosted: Wed Oct 24, 2007 8:38 pm
Reply with quote

dick scherrer wrote:
Hi Krisprems,

Me again :) Looks good. I believe you are quite close.

I suspect that a "final total" line at the bottom is also needed.


yes, dick.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Wed Oct 24, 2007 10:11 pm
Reply with quote

Quote:
I suspect that a "final total" line at the bottom is also needed.
This is accomplished below
Code:
//******************************************************************** 
//S1       EXEC  PGM=ICEMAN                                             
//SYSOUT   DD  SYSOUT=*                                                 
//SORTIN   DD *                                                         
AAAAA    11.34   34.45   62.43                                         
AAAAA    14.34   44.45   62.43                                         
AAAAA    12.34   34.45   62.43                                         
AAAAA    12.34   34.55   62.43                                         
ABBBB    32.43   54.24   34.54                                         
ABBBB    32.43   64.23   34.54                                         
ABBBB    32.43   54.23   14.54                                         
/*                                                                     
//SORTOUT  DD DSN=&&TEMP1,DISP=(MOD,PASS),SPACE=(TRK,(5,5)),UNIT=SYSDA 
//SYSIN    DD    *                                                     
  SORT FIELDS=(1,5,CH,A)                                               
  OUTFIL REMOVECC,NODETAIL,                                             
    SECTIONS=(1,5,                                                     
      TRAILER3=(1,5,8:TOT=(8,7,UFF,TO=ZD,LENGTH=7),                     
                   16:TOT=(16,7,UFF,TO=ZD,LENGTH=7),                   
                   24:TOT=(24,7,UFF,TO=ZD,LENGTH=7),80:X))             
/*                                                                     
//******************************************************************** 
//S2       EXEC  PGM=ICEMAN                                             
//SYSOUT   DD  SYSOUT=*                                                 
//SORTIN   DD DSN=&&TEMP1,DISP=(MOD,PASS)                               
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD    *                                                     
  SORT FIELDS=COPY                                                     
  INREC OVERLAY=(50:(8,7,ZD,ADD,                                       
                    16,7,ZD,ADD,                                       
                    24,7,ZD),EDIT=(IIIIT.TT),                           
                 8:8,7,ZD,EDIT=(IIIIT.TT),                             
                16:16,7,ZD,EDIT=(IIIIT.TT),                             
                24:24,7,ZD,EDIT=(IIIIT.TT),81:C'1')                     
  OUTFIL REMOVECC,                                                     
    SECTIONS=(81,1,                                                     
    TRAILER3=(8:TOT=(8,7,UFF,EDIT=(IIIIT.TT)),                         
              16:TOT=(16,7,UFF,EDIT=(IIIIT.TT)),                       
              24:TOT=(24,7,UFF,EDIT=(IIIIT.TT)))),                     
    BUILD=(1,80)                                                       
/*                                                                     


Hope this is the final SORT JCL required.
SORTOUT contains:
Code:
AAAAA     50.36  147.90  249.72                    447.98
ABBBB     97.29  172.70   83.62                    353.61
          14.75   32.06   33.33                         


Quote:
Me again Looks good. I believe you are quite close.
Reading this, looks like the bricks have stopped falling on me. 36_8_15.gif


Quote:
I've only one question more:
If the i/p file have occurs-100 field.
I've to write 100 of "8:8,7,ZD,EDIT=(IIIIT.TT)"
Is there any method to do this???

You can do it another way, but if it is just 100, i guess you could repeat the line's and just specify the required offset.
If you really need to do it by another way then let me know the exact offset(positions) of the field to be summed.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Oct 24, 2007 10:25 pm
Reply with quote

One more time. . . .

I believe i'm now having a "brick attack". . . icon_smile.gif

Code:
AAAAA     50.36  147.90  249.72                    447.98
ABBBB     97.29  172.70   83.62                    353.61
          14.75   32.06   33.33                         
How were the values in the last line created? They don't appear to be the sum of the previous detail lines?

Also, does the total need to be "wider" than the individual columns?
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Wed Oct 24, 2007 11:14 pm
Reply with quote

Quote:
How were the values in the last line created? They don't appear to be the sum of the previous detail lines?

Step2 corrected
Code:
//******************************************************************** 
//S2       EXEC  PGM=ICEMAN                                             
//SYSOUT   DD  SYSOUT=*                                                 
//SORTIN   DD DSN=&&TEMP1,DISP=(MOD,PASS)                               
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD    *                                                     
  SORT FIELDS=COPY                                                     
  INREC OVERLAY=(50:(8,7,ZD,ADD,                                       
                    16,7,ZD,ADD,                                       
                    24,7,ZD),EDIT=(IIIIT.TT),                           
                 8:8,7,ZD,EDIT=(IIIIT.TT),                             
                16:16,7,ZD,EDIT=(IIIIT.TT),                             
                24:24,7,ZD,EDIT=(IIIIT.TT),81:C'1')                     
  OUTFIL REMOVECC,                                                     
    SECTIONS=(81,1,                                                     
    TRAILER3=(8:TOT=(8,8,UFF,EDIT=(IIIIT.TT)),                         
             16:TOT=(16,8,UFF,EDIT=(IIIIT.TT)),                         
             24:TOT=(24,8,UFF,EDIT=(IIIIT.TT)))),                       
    BUILD=(1,80)                                                       
/*                                                                     


SORTOUT
Code:
AAAAA     50.36  147.90  249.72                    447.98   
ABBBB     97.29  172.70   83.62                    353.61   
         147.65  320.60  333.34                             


Quote:
Also, does the total need to be "wider" than the individual columns?
Thought that would be better always...
Else the person will come back with Overflow abend icon_arrow.gif
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Thu Oct 25, 2007 1:25 am
Reply with quote

Since the requirement was understood in bits and pieces, couldn't provide efficient solution with a single try.

Single step/pass SORT solution is provided here
Code:
//******************************************************************** 
//S1       EXEC  PGM=ICEMAN                                             
//SYSOUT   DD  SYSOUT=*                                                 
//SORTIN   DD *                                                         
AAAAA    11.34   34.45   62.43                                         
AAAAA    14.34   44.45   62.43                                         
AAAAA    12.34   34.45   62.43                                         
AAAAA    12.34   34.55   62.43                                         
ABBBB    32.43   54.24   34.54                                         
ABBBB    32.43   64.23   34.54                                         
ABBBB    32.43   54.23   14.54                                         
/*                                                                     
//SORTOUT  DD  SYSOUT=*                                                 
//SYSIN    DD    *                                                     
  INREC OVERLAY=(8:8,7,UFF,TO=ZD,LENGTH=7,                             
                16:16,7,UFF,TO=ZD,LENGTH=7,                             
                24:24,7,UFF,TO=ZD,LENGTH=7)                             
  SORT FIELDS=(1,5,CH,A)                                               
  SUM  FIELDS=(8,7,ZD,16,7,ZD,24,7,ZD)                                 
  OUTFIL REMOVECC,                                                     
    SECTIONS=(80,1,                                                     
    TRAILER3=(8:TOT=(8,7,ZD,EDIT=(IIIIT.TT)),                           
             16:TOT=(16,7,ZD,EDIT=(IIIIT.TT)),                         
             24:TOT=(24,7,ZD,EDIT=(IIIIT.TT)))),                       
    OVERLAY=(50:(8,7,ZD,ADD,                                           
                16,7,ZD,ADD,                                           
                24,7,ZD),EDIT=(IIIIT.TT),                               
                08:8,7,ZD,EDIT=(IIIIT.TT),                             
                16:16,7,ZD,EDIT=(IIIIT.TT),                             
                24:24,7,ZD,EDIT=(IIIIT.TT))                             
/*                                                                     


SORTOUT
Code:
AAAAA     50.36  147.90  249.72                    447.98
ABBBB     97.29  172.70   83.62                    353.61
         147.65  320.60  333.34                         
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM Goto page Previous  1, 2

 


Similar Topics
Topic Forum Replies
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Generate output lines (SYSIN card for... DFSORT/ICETOOL 4
No new posts Need suggestion on a sort card DFSORT/ICETOOL 10
No new posts Want to mask Middle 8 Digits of Debit... COBOL Programming 3
Search our Forums:

Back to Top