Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

maximum/minimum value in a column

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: maximum/minimum value in a column
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 Moderator


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

PostPosted: Wed May 03, 2006 5:34 am    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Wed May 03, 2006 8:52 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts CA-Endevor Admin - 3 years minimum vasanthz Mainframe Jobs 0 Tue Apr 04, 2017 5:36 am
This topic is locked: you cannot edit posts or make replies. DB2 query Using Recursion, Converting... smilewithashu2 DB2 3 Tue Jan 03, 2017 12:50 pm
No new posts SQZ pipe delimited file with 1 column... Rick Silvers DFSORT/ICETOOL 6 Sun Nov 06, 2016 8:11 pm
This topic is locked: you cannot edit posts or make replies. Checking wether a string starts from ... sundaram.naveen CLIST & REXX 9 Thu Oct 06, 2016 11:56 am
No new posts Add system date inside of a PS file a... pramitdas DFSORT/ICETOOL 5 Sun Aug 28, 2016 12:06 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us