Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 WRITE to VSAM giving duplicate RC picus_mf CICS 1 Fri Feb 23, 2018 2:52 pm
No new posts add sequence number for duplicate rec... SRUTHI DRAVIDAMANI COBOL Programming 11 Thu Feb 22, 2018 5:37 pm
No new posts how to add the amount for duplicate r... SRUTHI DRAVIDAMANI COBOL Programming 6 Wed Feb 21, 2018 7:21 pm
No new posts Merging records, but not all the time prino DFSORT/ICETOOL 17 Sat Feb 17, 2018 4:20 pm
No new posts Need all records with high key kalidasvs SYNCSORT 15 Fri Feb 09, 2018 10:38 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us