Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

sum the amounts based on duplicates

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

New User


Joined: 23 Aug 2005
Posts: 24

PostPosted: Tue Dec 30, 2008 1:43 am    Post subject: sum the amounts based on duplicates
Reply with quote

Hi,

I have below situation.

the input vsam file is as below.

Code:

         1         2         3         4         5
....5....0....5....0....5....0....5....0....5....0
0000000001 000581004 2000 1000 2000 3000
0000000001 000581004 4482 2000 3000 4000
0000000002 000456835 4000 3000 4000 5000
0000000002 000456835 5000 4000 5000 4000
0000000003 000235424 3482 5000 6000 7000

in the above layout first 10 bytes are sequence number (0000000001,0000000002 and 0000000003) and next nine bytes are identification number(000581004,000456835,000235424) and next 4 bytes are amount1(20.00,44.82,40.00,50.00,34.82) and next 4 bytes are amount2(10.00,20.00,30.00,40.00,50.00) and next 4 bytes are amount3(20.00,30.00,40.00,50.00,60.00) and next 4 bytes are amount4(30.00,40.00,50.00,40.00,70.00)

I want to add the amounts if we have same sequence number and identification number.

the o/p file should be like this.

0000000001 000581004 6482 3000 5000 7000
0000000002 000456835 9000 7000 9000 9000
0000000003 000235424 3482 5000 6000 7000

Regards,
Sudhakar.
Back to top
View user's profile Send private message

dick scherrer

Site Director


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

PostPosted: Tue Dec 30, 2008 1:57 am    Post subject:
Reply with quote

Hello,

Can you not work with the solution you were given last week for a very similar requirement?
http://ibmmainframes.com/viewtopic.php?p=169335&highlight=#169335
Back to top
View user's profile Send private message
sudhakar1979

New User


Joined: 23 Aug 2005
Posts: 24

PostPosted: Tue Dec 30, 2008 2:01 am    Post subject: Reply to: sum the amounts based on duplicates
Reply with quote

in the last week post I was asked to add only one column. in this requirement i suppose to add 4 columns. am not sure how to do this. I tried with putting the new columns with the earlier post. it is not working. just want to find out to do this. thanks for the reply.
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Tue Dec 30, 2008 2:05 am    Post subject:
Reply with quote

Hello,

Quote:
I tried with putting the new columns with the earlier post. it is not working.
What did you try? What happened?

IMHO, you will learn much more if you work thru the requirement rather than simply have someone else "sling code" for you. . .

If you post what you tried and the problem(s) encountered, the IBMer's will surely be able to clarify icon_smile.gif
Back to top
View user's profile Send private message
sudhakar1979

New User


Joined: 23 Aug 2005
Posts: 24

PostPosted: Tue Dec 30, 2008 2:12 am    Post subject: Reply to: sum the amounts based on duplicates
Reply with quote

//SYSIN DD *
SORT FIELDS=(1,10,A,11,9,A),FORMAT=CH
SUM FIELDS=(20,4,ZD,25,4,ZD)
OUTREC OVERLAY=(20:20,4,25:25,4,ZD,EDIT=(TTTT))
/*

i modified the sysin card like this. am getting SYSTEM COMPLETION CODE=0C7.
Back to top
View user's profile Send private message
sudhakar1979

New User


Joined: 23 Aug 2005
Posts: 24

PostPosted: Tue Dec 30, 2008 2:17 am    Post subject: Reply to: sum the amounts based on duplicates
Reply with quote

i got the o/p. thanks for the postings.

Dick: I am also working on this. meanwhile if i get the reply for this postings that would be good right? for that i have posted my questions.

thank you.
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Tue Dec 30, 2008 2:29 am    Post subject:
Reply with quote

Hello,

I "Coded" your data and added "Cols" and the data does not appear to match the sort control specification for the field. . .
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Dec 30, 2008 2:32 am    Post subject:
Reply with quote

sudhakar1979,

Given that your input data looks like this:

Code:

00000000010005810042000100020003000
00000000010005810044482200030004000
00000000020004568354000300040005000
00000000020004568355000400050004000
00000000030002354243482500060007000


The following DFSORT job would give you what you asked for:

Code:

//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...   VSAM input file
//SORTOUT DD DSN=...   output file
//SYSIN DD *
  RECORD TYPE=F
  OPTION ZDPRINT                                     
  SORT FIELDS=(1,19,CH,A)                             
  SUM FIELDS=(20,4,ZD,24,4,ZD,28,4,ZD,32,4,ZD)       
/*
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Tue Dec 30, 2008 3:42 am    Post subject: Reply to: sum the amounts based on duplicates
Reply with quote

Hello,

Quote:
meanwhile if i get the reply for this postings that would be good right?
Yup, good luck icon_smile.gif

Hopefully, we will hear of success icon_wink.gif

d
Back to top
View user's profile Send private message
sudhakar1979

New User


Joined: 23 Aug 2005
Posts: 24

PostPosted: Tue Dec 30, 2008 9:53 pm    Post subject: Reply to: sum the amounts based on duplicates
Reply with quote

thank you Frank for the reply. Could you please explain what is the OPTION ZDPRINT. If i dont mention this option also i am getting the accurate results.

Thanks in Advance.

Sudhakar.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Dec 30, 2008 11:02 pm    Post subject:
Reply with quote

The ZDPRINT option ensures that an F sign is used for positive summed ZD values which makes them displayable (e.g. X'F1F2F3' = C'123' vs X'F1F2C3' = C'12C'). If you get the same results without ZDPRINT, then your site has ZDPRINT=YES as the installation default.
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 JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts Inserting records based on conditions vickey_dw DFSORT/ICETOOL 9 Wed Feb 22, 2017 1:33 pm
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Updating the counters after eliminati... PANDU1 DFSORT/ICETOOL 12 Mon Nov 21, 2016 9:47 am
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us