Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 column with count of rows within dist... ronald wouterson DB2 4 Sun Sep 17, 2017 9:48 pm
No new posts Convert rows and column into JSON for... Dinesh Manivannan DB2 2 Sun Sep 03, 2017 6:50 pm
No new posts Select numeric portion from CHAR data... balaji81_k DB2 6 Sat Aug 19, 2017 1:51 am
No new posts Loading data to table gives wrong for... Raghu navaikulam DB2 19 Thu Jul 13, 2017 2:11 pm
No new posts CA-Endevor Admin - 3 years minimum vasanthz Mainframe Jobs 0 Tue Apr 04, 2017 5:36 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us