Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
MGayathri

New User

Joined: 19 May 2007
Posts: 25
Location: Chennai

Posted: Sat May 26, 2007 10:17 pm    Post subject: To do Calculation using Sort

Hi,
I have an input file:

 Code: col1 col2 ---- ----- abc  050 abc  025 abc  025 abc  100 def  075 def  025

Then I need the output file as:

 Code: abc2 def1

For key abc, sum up the col2 values and divide by 100, similarly for def.

Is it possible to do such calculation in dfsort?

Frank Yaeger

DFSORT Moderator

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

Posted: Sun May 27, 2007 1:05 am    Post subject:

Here's a DFSORT job that will do what you asked for:

 Code: //S1    EXEC  PGM=ICEMAN //SYSOUT    DD  SYSOUT=* //SORTIN DD * abc  050 abc  025 abc  025 abc  100 def  075 def  025 /* //SORTOUT DD SYSOUT=* //SYSIN    DD    *   SORT FIELDS=(1,3,CH,A)   SUM FIELDS=(6,3,ZD)   OUTREC BUILD=(1,3,     6,3,ZD,DIV,+100,TO=ZD,LENGTH=1) /*
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Sort numeric fields with trailing spaces sancraig16 SYNCSORT 7 Tue Apr 03, 2018 1:21 am Find & Replace string in CA-SORT mrgnndhmk CA Products 1 Fri Mar 30, 2018 12:58 am SORT 3 files,extract specific fields ... Kiransr DFSORT/ICETOOL 13 Fri Mar 23, 2018 10:54 am How to Generate JCL using Sort naveen katkuri DFSORT/ICETOOL 7 Tue Mar 13, 2018 3:50 pm Need better approach to create a sort... Vamshi Veludandi DFSORT/ICETOOL 8 Thu Mar 08, 2018 5:59 pm

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us