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

sum the amounts based on duplicates


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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

Moderator Emeritus


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

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

Hello,

Can you not work with the solution you were given last week for a very similar requirement?
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
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

Moderator Emeritus


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

PostPosted: Tue Dec 30, 2008 2:05 am
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
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
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

Moderator Emeritus


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

PostPosted: Tue Dec 30, 2008 2:29 am
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 Developer


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

PostPosted: Tue Dec 30, 2008 2:32 am
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

Moderator Emeritus


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

PostPosted: Tue Dec 30, 2008 3:42 am
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
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 Developer


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

PostPosted: Tue Dec 30, 2008 11:02 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts To search DB2 table based on Conditio... DB2 1
This topic is locked: you cannot edit posts or make replies. Merge 2 input files based on the reco... JCL & VSAM 2
No new posts Split large FB file based on Key coun... DFSORT/ICETOOL 4
No new posts Mass JCL release via IDZ tool(eclipse... CA Products 1
No new posts Merge 2 lines based on Space from a S... DFSORT/ICETOOL 5
Search our Forums:

Back to Top