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

maximum/minimum value in a column


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

New User


Joined: 02 May 2006
Posts: 3

PostPosted: Wed May 03, 2006 5:21 am
Reply with quote

Hi ALL,


I have to obtain only the records with the maximum or minimum value in column (1,11,ch) into the output file.

Is their any way which we can do through jcl sort.

THANKS

Carlos
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: Wed May 03, 2006 5:34 am
Reply with quote

It's not clear what your values look like or what exactly you want for output. Please show an example of your input records and what you expect for output.
Back to top
View user's profile Send private message
cosorio

New User


Joined: 02 May 2006
Posts: 3

PostPosted: Wed May 03, 2006 7:55 pm
Reply with quote

ON(1,11,CH)

INPUT:
55555555555XXXXX
99999999999BBBBB
22222222222ZZZZZ
12345678900BBBBB
99999999999CCCCC
33333333333XXXXX
12345678900AAAAA
99999999999AAAAA

OUTPUT (MAX CASE):
99999999999AAAAA
99999999999BBBBB
99999999999CCCCC

OUTPUT (MIN CASE):
12345678900AAAAA
12345678900BBBBB
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: Wed May 03, 2006 8:52 pm
Reply with quote

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

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
* Sort on key ascending.
  SORT FIELDS=(1,11,CH,A)
* Create DFSORT Symbols as follows:
* MINKEY,'minimumkey'
* MAXKEY,'maximumkey'
  OUTFIL REMOVECC,NODETAIL,OUTREC=(80X),
    HEADER1=('MINKEY,''',1,11,''''),
    TRAILER1=('MAXKEY,''',1,11,'''')
/*
//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=...  input file
//MIN DD DSN=...  output for minimum key
//MAX DD DSN=...  output for maximum key
//SYSIN    DD    *
* Sort on key ascending.
  SORT FIELDS=(1,11,CH,A)
* Use MINKEY to get the minimum key records.
  OUTFIL FNAMES=MIN,INCLUDE=(1,11,CH,EQ,MINKEY)
* Use MAXKEY to get the maximum key records.
  OUTFIL FNAMES=MAX,INCLUDE=(1,11,CH,EQ,MAXKEY)
/*
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 Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts How to load to DB2 with column level ... DB2 6
No new posts RC query -Time column CA Products 3
No new posts first column truncated in search result IBM Tools 13
No new posts Split a record with data in a differe... DFSORT/ICETOOL 8
Search our Forums:

Back to Top