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
 

 

sort job to calculate amounts

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

New User


Joined: 27 Sep 2007
Posts: 14
Location: hyderabad

PostPosted: Tue Dec 18, 2007 4:36 pm    Post subject: sort job to calculate amounts
Reply with quote

My requirement is I need to read one file and in that file
for the variable say lockbox-number I need to sort all the lockbox-numbers and I need to calculate the
same lockbox-number record amounts and write total to output file

for example in the input file lockbox-number are like this
----------------------------------------------------------

Code:

lockbox-number           amount

6064                        10
6064                        20
6064                        30
6065                        60
6065                        70
6065                        80
6064                        40
6064                        50


output file

Code:

lockbox-number     total

6064                 150
6065                 210


how can we write sort job to perform above output
Back to top
View user's profile Send private message

raak

Active User


Joined: 23 May 2006
Posts: 166
Location: chennai

PostPosted: Tue Dec 18, 2007 6:26 pm    Post subject:
Reply with quote

Use the SUM FIELDS option of SORT...

Try searching the forum b4 posting
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 680
Location: NJ

PostPosted: Tue Dec 18, 2007 8:16 pm    Post subject: sort
Reply with quote

Hi,

Try this sort card

Code:
SUM FIELDS=(5,2,ZD)


Let me know if you need any more help
Back to top
View user's profile Send private message
nmr

New User


Joined: 27 Sep 2007
Posts: 14
Location: hyderabad

PostPosted: Tue Dec 18, 2007 8:37 pm    Post subject: Reply to: sort job to calculate amounts
Reply with quote

Thanks khamarutheen

its working for me
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Dec 18, 2007 10:02 pm    Post subject: Re: Reply to: sort job to calculate amounts
Reply with quote

nmr wrote:
Thanks khamarutheen

its working for me


nmr,

Are you sure you got the right results? Your summing on 2 bytes will results in a overflow and you will NOT get the right results. Use the following DFSORT JCL which will you the desired results.

Code:

//STEP0100 EXEC PGM=ICEMAN       
//SYSOUT   DD SYSOUT=*         
//SORTIN   DD *               
6064 10                       
6064 20                       
6064 30                       
6065 60                       
6065 70                       
6065 80                       
6064 40                       
6064 50                       
//SORTOUT  DD SYSOUT=*         
//SYSIN    DD *     
  OPTION EQUALS         
  SORT FIELDS=(1,4,CH,A)       
  OUTFIL REMOVECC,NODETAIL,   
    SECTIONS=(1,4,               
       TRAILER3=(1,5,TOT=(6,2,ZD)))
//* 


Hope this helps...
Back to top
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 356
Location: New York

PostPosted: Wed Dec 19, 2007 9:12 am    Post subject:
Reply with quote

Quote:

Thanks khamarutheen

its working for me


nmr,

Above code doesnot give proper results.

Kolusu's solution is working fine.

Regards,
KSK
Back to top
View user's profile Send private message
nmr

New User


Joined: 27 Sep 2007
Posts: 14
Location: hyderabad

PostPosted: Wed Dec 19, 2007 10:31 am    Post subject: Reply to: sort job to calculate amounts
Reply with quote

ksk or kolusu

if you do not mind can u tell me the meaning of below code what it does,
because i am not aware of sort

OPTION EQUALS
SORT FIELDS=(1,4,CH,A)
OUTFIL REMOVECC,NODETAIL,
SECTIONS=(1,4,
TRAILER3=(1,5,TOT=(6,2,ZD)))
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: Wed Dec 19, 2007 10:21 pm    Post subject:
Reply with quote

Quote:
i am not aware of sort


I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
Back to top
View user's profile Send private message
sreenivasreddyg

New User


Joined: 23 Apr 2005
Posts: 39
Location: delhi

PostPosted: Sat Dec 22, 2007 1:43 am    Post subject:
Reply with quote

What happens if that field is comp-3. SORT will add the amoutns in this case also?
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: Sat Dec 22, 2007 2:00 am    Post subject:
Reply with quote

Hello,

Quote:
What happens if that field is comp-3. SORT will add the amoutns in this case also?
Sort will add the amounts if you define the positions as packed-decimal (for COMP-3 fields) rather than zoned-decimal.
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: Sat Dec 22, 2007 2:38 am    Post subject:
Reply with quote

Quote:
What happens if that field is comp-3. SORT will add the amoutns in this case also?


DFSORT has many numeric formats (ZD, PD, BI, FI, FS, UFF, SFF) - you just have to specify the correct format for the input data you're processing. COMP-3 is equivalent to PD format.

For information on COBOL vs DFSORT formats, see:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA20/C.3?DT=20060615185603

You can use DFSORT's output formats and edit masks to change the input data to different forms. For more information see:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CG20/2.4.7?DT=20060615173822

and

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CG20/2.4.8?DT=20060615173822
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 Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


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