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

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


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


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

PostPosted: Thu Apr 12, 2007 8:48 pm
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
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 Developer


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

PostPosted: Fri Apr 13, 2007 8:51 pm
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:

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:

Use [URL] BBCode for External Links
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 Compare 2 files(F1 & F2) and writ... JCL & VSAM 5
No new posts Duplicate transid's declared using CEDA CICS 3
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Join multiple records using splice DFSORT/ICETOOL 5
Search our Forums:

Back to Top