Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
SUM and keep current sequence

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
abby.qiong.zhang

New User


Joined: 07 Jun 2012
Posts: 26
Location: China

PostPosted: Wed Jan 30, 2013 2:17 pm    Post subject: SUM and keep current sequence
Reply with quote

Please help with the SUM function, my input like this:
Code:

0400022M0000142000693         000300
0400022M1000142000693         000300
0400022M1000142000693         000030
0400022M2000142000693         
0004088M0000142000691         000100
0004088M1000142000691         000100
0004088M2000142000691
0004088M0000142000694         000400
0004088M1000142000694         000400
0004088M2000142000694

For 'M1' records, i need to summarize the amount 000300 and 000030 together, for other records, keep the same.
The output should like this:
Code:

0400022M0000142000693        000300
0400022M1000142000693        000330
0400022M2000142000693
0004088M0000142000691        000100
0004088M1000142000691        000100
0004088M2000142000691
0004088M0000142000694        000400
0004088M1000142000694        000400
0004088M2000142000694


I tried with the statements like this:
Code:

  SORT FIELDS=(1,3,CH,D,15,8,CH,A,8,2,CH,A,10,4,CH,A,4,4,CH,A)   
  SUM FIELDS=(134,6,PD)                                           
  OPTION EQUALS                                                   

But the output is not what I want, the M2 record will before the M1 record like this:
Code:

0400022M0000142000693        000300       
0400022M2000142000693
0400022M1000142000693        000330
0004088M0000142000691        000100
0004088M2000142000691
0004088M1000142000691        000100
0004088M0000142000694        000400
0004088M2000142000694
0004088M1000142000694        000400


Can anyone help? Thanks!
Back to top
View user's profile Send private message

Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1543
Location: Andromeda Galaxy

PostPosted: Wed Jan 30, 2013 2:22 pm    Post subject:
Reply with quote

Try adding a sequence number before sum and after sum sort it based on sequence number
Back to top
View user's profile Send private message
abby.qiong.zhang

New User


Joined: 07 Jun 2012
Posts: 26
Location: China

PostPosted: Wed Jan 30, 2013 2:32 pm    Post subject:
Reply with quote

Pandora-Box wrote:
Try adding a sequence number before sum and after sum sort it based on sequence number


Thanks Pandora-Box for your quick response! Can you give me a sample about how to use SEQNUM?
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10365
Location: italy

PostPosted: Wed Jan 30, 2013 2:34 pm    Post subject: Reply to: SUM and keep current sequence
Reply with quote

Your sort card does not <visually> match the input ...

15,8,ch,a sorts one <extra> char after the visible ones

Code:
position  ==>123456789012345678901
sort keys ==>1115555334444 22222222
data      ==>0400022M0000142000693         000300
                                  *
Back to top
View user's profile Send private message
abby.qiong.zhang

New User


Joined: 07 Jun 2012
Posts: 26
Location: China

PostPosted: Wed Jan 30, 2013 2:47 pm    Post subject: Re: Reply to: SUM and keep current sequence
Reply with quote

enrico-sorichetti wrote:
Your sort card does not <visually> match the input ...

15,8,ch,a sorts one <extra> char after the visible ones

Code:
position  ==>123456789012345678901
sort keys ==>1115555334444 22222222
data      ==>0400022M0000142000693         000300
                                  *

Thanks Enrico, yeah, i made a mistake, it should be
Code:
14,8,CH,A


I tried again, and get the output I want.
Code:

0400022M0000142000693        000330
0400022M1000142000693        000330
0400022M2000142000693
0004088M0000142000691        000100
0004088M1000142000691        000100
0004088M2000142000691
0004088M0000142000694        000400
0004088M1000142000694        000400
0004088M2000142000694
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10365
Location: italy

PostPosted: Wed Jan 30, 2013 2:54 pm    Post subject: Reply to: SUM and keep current sequence
Reply with quote

that confirm my ( and many other's opinion )
more than 90% of errors can be found by simple(*) VISUAL inspection icon_cool.gif

(*) just rereading, no complicate walk thru!
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7314

PostPosted: Wed Jan 30, 2013 3:23 pm    Post subject: Reply to: SUM and keep current sequence
Reply with quote

Now how did the M0 get "summed" to become 330?
Back to top
View user's profile Send private message
abby.qiong.zhang

New User


Joined: 07 Jun 2012
Posts: 26
Location: China

PostPosted: Wed Jan 30, 2013 3:32 pm    Post subject: Re: Reply to: SUM and keep current sequence
Reply with quote

Bill Woodger wrote:
Now how did the M0 get "summed" to become 330?


It's a typo.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Fetching data from JHS as per the cur... arunsoods All Other Mainframe Topics 4 Wed Nov 22, 2017 1:54 pm
No new posts Comparision with current time arunsoods DFSORT/ICETOOL 5 Thu Nov 09, 2017 10:37 am
This topic is locked: you cannot edit posts or make replies. Comparing current time with the time ... arunsoods SYNCSORT 1 Mon Oct 30, 2017 4:07 pm
This topic is locked: you cannot edit posts or make replies. Incrementing current time field by 30... arunsoods DFSORT/ICETOOL 11 Thu Oct 26, 2017 3:22 pm
No new posts Comparing 2 Files using Current time arunsoods SYNCSORT 9 Fri Sep 22, 2017 6:00 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us