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

Remove dups and perform math function.


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rahul_kolhe

New User


Joined: 08 Nov 2006
Posts: 15

PostPosted: Sat Nov 18, 2006 8:51 pm
Reply with quote

Hi All,
i want to remove duplicate record but wanted to have some of fileds values to get added and substracted in output files

e.g.
input

Code:

12300 Rahul +100.00
12300 Rahul +060.00



Output1

Code:

12300 Rahul +160.00


Output2

Code:

12300 Rahul +040.00
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: Sat Nov 18, 2006 10:11 pm
Reply with quote

It's not clear what you want to do.

Do you only have two records as shown? Or do you have more than two records? If you have more than two records, do you have just two records with each key that you want to add and subtract? If you have more than two records per key, what do you want to add and subtract?
Please show a more complete example of the records in your input file and the records you expect for output.
Back to top
View user's profile Send private message
rahul_kolhe

New User


Joined: 08 Nov 2006
Posts: 15

PostPosted: Sat Nov 18, 2006 11:25 pm
Reply with quote

Frank,

Sorry, above one is not complete info. Please find below example

Input:
cols
1-5 7-15 16-23
12300 Rahul +100.00
12300 Rahul +060.00
12400 Frank +500.00
12400 Frank +250.00
12500 kolhe +200.00
12500 kolhe +200.00
12600 yeager +100.00

Output1:
12300 Rahul +160.00 ---> did addition
12400 Frank +750.00 ----> did addition
12500 kolhe +200.00 ----> as dups and do not have change invalues
12600 yeager +100.00 ----> only one

Output2:
12300 Rahul +040.00 ---> did substract
12400 Frank +250.00 ----> did substract
12500 kolhe +000.00 ----> as dups put zero's
12600 yeager +000.00 ----> as only one record


Is it possible thru DFSORT?

If any one output is possible then I am okay.
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: Sun Nov 19, 2006 9:58 pm
Reply with quote

Based on what you've told me, I believe the following DFSORT/ICETOOL job will do what you want. You'll need z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) in order to use INREC with SELECT. If you don't have the April, 2006 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTF, see:

Use [URL] BBCode for External Links

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=...  input file (FB/23)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT1 DD DSN=...  output file1 (FB/23)
//OUT2 DD DSN=...  output file2 (FB/23)
//TOOLIN   DD    *
SELECT FROM(IN) TO(T1) ON(1,23,CH) FIRST USING(CTL1)
SORT FROM(T1) USING(CTL2)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(25:SEQNUM,1,ZD,RESTART=(1,15),
    27:16,8,SFF,TO=ZD,LENGTH=5,
    33:27,5)
  OUTFIL FNAMES=T1,
    IFTHEN=(WHEN=(25,1,ZD,EQ,+2),
      OVERLAY=(33:27,5,ZD,MUL,-1,TO=ZD,LENGTH=5))
/*
//CTL2CNTL DD *
  SORT FIELDS=(1,15,CH,A)
  OPTION ZDPRINT
  SUM FIELDS=(25,1,ZD,27,5,ZD,33,5,ZD)
  OUTFIL FNAMES=OUT1,
    BUILD=(1,15,17:27,5,ZD,EDIT=(STTT.TT),SIGNS=(+,-))
  OUTFIL FNAMES=OUT2,
    IFTHEN=(WHEN=(25,1,ZD,EQ,+1),
      BUILD=(1,15,17:C'+000.00')),
    IFTHEN=(WHEN=NONE,
      BUILD=(1,15,17:33,5,ZD,EDIT=(STTT.TT),SIGNS=(+,-)))
/*
Back to top
View user's profile Send private message
rahul_kolhe

New User


Joined: 08 Nov 2006
Posts: 15

PostPosted: Mon Nov 20, 2006 7:51 pm
Reply with quote

Thank you.
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 Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Calling an Open C library function in... CICS 1
No new posts DATE2 function SYNCSORT 15
No new posts Remove leading zeroes SYNCSORT 4
No new posts Use of Perform Thru Exit COBOL Programming 6
Search our Forums:

Back to Top