Maximum value of a field!!!!



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

Maximum value of a field!!!!

Postby ibmmf4u » Mon May 14, 2012 11:46 pm

Hi Everyone,

My Requirement goes this way , I need to retrieve the maximum value of a field and write it to an output file.

Inputfile:-

0100
0500
0700
0900


Outputfile:-



Can some one please help me out in achieving the same with syncsort.

Thanks in advance!!!!
ibmmf4u
 
Posts: 65
Joined: Wed Dec 14, 2011 10:26 pm
Has thanked: 0 time
Been thanked: 1 time

Re: Maximum value of a field!!!!

Postby BillyBoyo » Tue May 15, 2012 12:01 am

If you sort you can get the largest value into a specific position (first or last) in the data. There are then various ways to ensure you only get the first/last.

Have a look at your manual and see what you can find which might be useful.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Maximum value of a field!!!!

Postby ibmmf4u » Tue May 15, 2012 12:16 am

Hi Bill,

Thanks for the guidance . Below piece of code is working fine for my requirement.

//STEP010  EXEC PGM=SORT
//SORTIN   DD *         
0200                   
0500                   
0800                   
0300                   
1300                   
1100                   
1600                   
//SORTOUT  DD SYSOUT=* 
//SYSOUT   DD SYSOUT=* 
//SYSIN    DD *         
  SORT FIELDS=(1,4,CH,D)
  OUTFIL ENDREC=1       
/*                     


The output file contains only the first maximum record.

Outputfile:-


Thanks for helping me out!!!!
ibmmf4u
 
Posts: 65
Joined: Wed Dec 14, 2011 10:26 pm
Has thanked: 0 time
Been thanked: 1 time

Re: Maximum value of a field!!!!

Postby BillyBoyo » Tue May 15, 2012 12:33 am

Only took you 15 minutes as well, impressive. Well done.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Maximum value of a field!!!!

Postby ibmmf4u » Tue May 15, 2012 9:34 pm

Thank you Bill. Its all because of the guidance from you.

Thanks for your help!!!
ibmmf4u
 
Posts: 65
Joined: Wed Dec 14, 2011 10:26 pm
Has thanked: 0 time
Been thanked: 1 time


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post