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
 

 

summation of duplicate records considering Signs also(-/+)

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

New User


Joined: 22 Nov 2006
Posts: 12
Location: Delhi

PostPosted: Thu Apr 12, 2007 5:26 pm    Post subject: summation of duplicate records considering Signs also(-/+)
Reply with quote

I have an input ps which i want to sort and find the sum of records having
duplicate sort keys in the following format.
input ps
---------
ab 5
ab-5
ab 5
ab 5
ac 2
ac 2

output ps should be in this format
--------------------------------------
ab10
ac04

My jcl is
//STEP010 EXEC PGM=SORT
//SORTIN DD DSN=INPUT.TEST.SUMFILDI,DISP=SHR
//SORTOUT DD DSN=OUTPUT.TEST.SUMFILDO,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,SPACE=(CYL,(1,1),RLSE)
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,2,CH,A)
SUM FIELDS=(3,2,ZD)
//*

after i submitted the jcl i got maxcc=0. but when i opened the output ps;it was in the following state:
output ps showing
------------------
ab20 <---------it should be ab10
ac04
Pls tell me the correct control card or correct data type(ZD/PD) with which numbers can be added with signs(+5-5+5+5=10 not 20).
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: Thu Apr 12, 2007 8:48 pm    Post subject:
Reply with quote

You can use a DFSORT job like this to do what you want:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
ab  5
ab -5
ab  5
ab  5
ac  2
ac  2
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  SORT FIELDS=(1,2,CH,A)
  OUTFIL REMOVECC,NODETAIL,
    SECTIONS=(1,2,
      TRAILER3=(1,2,TOT=(3,3,FS,EDIT=(STT),SIGNS=(,-))))
/*
Back to top
View user's profile Send private message
abhilashapandey

New User


Joined: 22 Nov 2006
Posts: 12
Location: Delhi

PostPosted: Fri Apr 13, 2007 9:11 am    Post subject: summation of duplicate records considering Signs also(-/+)
Reply with quote

Thank you so much for the quick reply. icon_smile.gif
1.Please tell me what are sections, removecc, nodetail.
2.why are we using TRAILER3, i dont need to put any trailer record.
3. what is FS.
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: Fri Apr 13, 2007 8:51 pm    Post subject:
Reply with quote

What I'm doing with SECTIONS, NODETAIL, REMOVECC and TRAILER3 is similar to what you were trying to do with SUM FIELDS=NONE in that it keeps only one record of duplicates (which it treats as a section trailer record). The FS format (floating sign) can handle your sddd values. You can't use FS format with SUM, but you can use it with TRAILER3 TOT.

You can look up all of the parameters I used under "OUTFIL Control Statements" in "z/OS DFSORT Application Programming Guide". Here's a link:

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

If you're not familiar with DFSORT and DFSORT's ICETOOL, 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
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 Using ICETOOL, how we can seperate th... bshkris SYNCSORT 5 Tue May 09, 2017 8:33 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am


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