How to BEGIN this GROUP



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

How to BEGIN this GROUP

Postby ricklennox » Fri Apr 01, 2011 7:20 pm

Hi - Sorry if this has been covered elsewhere, but I've gone through DFSORT application guides and the Smart Tricks guide and haven't found a solution.

Records have two key fields (in positions 1 and 3) and unpredictable numeric data (in position 5) :
a a 1
a a 1
a a 2
a a 5
a b 1
a b 6
b a 1
b a 2
b a 9

After sorting the records on the keys (ascending) and the numeric data (descending), I'd like to group the records by the keys and propagate the highest numeric value to the group (red records have changed numeric value) :
a a 5
a a 5 (was 'a a 2')
a a 5 (was 'a a 1')
a a 5 (was 'a a 1')
a b 6
a b 6 (was 'a b 1')
b a 9
b a 9 (was 'b a 2')
b a 9 (was 'b a 1')

My problem is, I have nothing fixed to give the BEGIN in order to propagate the value within the GROUP.
ricklennox
 
Posts: 11
Joined: Thu Dec 16, 2010 5:59 am
Has thanked: 0 time
Been thanked: 0 time

Re: How to BEGIN this GROUP

Postby skolusu » Fri Apr 01, 2011 9:21 pm

ricklennox,

Use the following DFSORT JCL which will give you the desired results

//STEP0100 EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD *                                         
----+----1----+----2----+----3----+----4----+----5----+--
A A 1                                                   
A A 1                                                   
A A 2                                                   
A A 5                                                   
A B 1                                                   
A B 6                                                   
B A 1                                                   
B A 2                                                   
B A 9                                                   
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                         
  SORT FIELDS=(1,3,CH,A,5,1,CH,D),EQUALS                 
  OUTREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,3),PUSH=(5:5,1))
//*
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: How to BEGIN this GROUP

Postby ricklennox » Fri Apr 01, 2011 11:30 pm

Thank you very much. I didn't know there was a KEYBEGIN, I'll have to look that up.
ricklennox
 
Posts: 11
Joined: Thu Dec 16, 2010 5:59 am
Has thanked: 0 time
Been thanked: 0 time

Re: How to BEGIN this GROUP

Postby Frank Yaeger » Fri Apr 01, 2011 11:47 pm

KEYBEGIN is a new DFSORT function available with the Oct, 2010 DFSORT PTF. For more information, see:

http://www.ibm.com/support/docview.wss? ... g3T7000242
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post