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
 

 

Selecting the Minimum Value

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
kumarmf2004

New User


Joined: 25 Oct 2006
Posts: 4

PostPosted: Fri Dec 09, 2011 12:58 pm    Post subject: Selecting the Minimum Value
Reply with quote

Hi,

I have a query regarding selecting the minimum value using dfsort
Assume Invoice and Date are continuous fields

Input

Invoice Date
1111111 12/10/2011
1111111 12/12/2011
2222222 12/10/2011
2222222 12/13/2011

Output should be like
111111 12/10/2011
222222 12/10/2011

Kumarmf
Back to top
View user's profile Send private message

vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1491
Location: Chennai

PostPosted: Fri Dec 09, 2011 1:30 pm    Post subject:
Reply with quote

This might work,
Code:
//JS010    EXEC PGM=SORT                                       
//SORTIN   DD DISP=SHR,DSN=WELLS.SORTIN                       
//SORTOUT  DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//SYSOUT   DD SYSOUT=*                                         
//SYSIN DD *                                                   
  SORT FIELDS=(1,7,ZD,A,15,4,ZD,A,9,2,ZD,A,13,2,ZD,A)           
/*                                                             
//JS020    EXEC PGM=SORT                                       
//SORTIN   DD DSN=&&T1,DISP=OLD                                 
//SORTOUT  DD DISP=OLD,DSN=WELLS.SORTOUT                     
//SYSOUT   DD SYSOUT=*                                         
//SYSIN DD *                                                   
  SORT FIELDS=(1,7,ZD,A)                                       
  SUM FIELDS=NONE                                               
/*                                   



Stolen sentence:
Quote:
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 994
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Fri Dec 09, 2011 7:45 pm    Post subject:
Reply with quote

vasanthz wrote:
This might work,
Code:
//JS010    EXEC PGM=SORT                                       
//SORTIN   DD DISP=SHR,DSN=WELLS.SORTIN                       
//SORTOUT  DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//SYSOUT   DD SYSOUT=*                                         
//SYSIN DD *                                                   
  SORT FIELDS=(1,7,ZD,A,15,4,ZD,A,9,2,ZD,A,13,2,ZD,A)           
/*                                                             
//JS020    EXEC PGM=SORT                                       
//SORTIN   DD DSN=&&T1,DISP=OLD                                 
//SORTOUT  DD DISP=OLD,DSN=WELLS.SORTOUT                     
//SYSOUT   DD SYSOUT=*                                         
//SYSIN DD *                                                   
  SORT FIELDS=(1,7,ZD,A)                                       
  SUM FIELDS=NONE                                               
/*                                   



Stolen sentence:
Quote:
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html


Surely
SORT FIELDS=(1,7,ZD,A,15,4,ZD,A,9,2,ZD,A,12,2,ZD,A)
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Fri Dec 09, 2011 8:11 pm    Post subject: Reply to: Selecting the Minimum Value
Reply with quote

It's a bit higgledy-piggledy, as one might say.

Although the data is shown seperated by one blank, the description says we should assume they are continuous, so I imagine the blank is not really there.

1,7 14,4, 8,2 and 11,2 I'd "assume".

Output shows only six digits for the invoice...

The second sort would need EQUALS.

There is no need for anything to be ZD, they can all be CH - not expecting any signs, so no need to sort on signs.

Of course, the TS has abandoned us, so we'll not know for sure.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Dec 09, 2011 9:56 pm    Post subject: Reply to: Selecting the Minimum Value
Reply with quote

Kumarmf2004,

Use the following DFSORT/ICETOOL JCL which will give you the desired results in 1 pass . EQUALS is a default option with SELECT.

Code:

//STEP0100 EXEC PGM=ICETOOL                             
//TOOLMSG  DD SYSOUT=*                                 
//DFSMSG   DD SYSOUT=*                                 
//IN       DD *                     
----+----1----+----2----+----3----+----4-                   
1111111 12/12/2011                                     
1111111 12/10/2011                                     
2222222 12/13/2011                                     
2222222 12/10/2011                                     
//OUT      DD SYSOUT=*                                 
//TOOLIN   DD *                                         
  SELECT FROM(IN) TO(OUT) ON(01,7,CH) FIRST USING(CTL1)
//CTL1CNTL DD *                                         
  SORT FIELDS=(01,7,CH,A,    $ INVOICE-NUMBER                 
               15,4,CH,A,    $ INVOICE-YEAR             
               09,2,CH,A,    $ INVOICE-MONTH           
               12,2,CH,A)    $ INVOICE-DAY             
//*
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
No new posts DB2 10.1 Share level locking and Sele... Mary Lewis DB2 1 Wed Apr 15, 2015 9:51 pm
No new posts Selecting a redefined record layout i... mallik4u Compuware & Other Tools 1 Wed Oct 08, 2014 8:14 am
No new posts Query for selecting single type sharad_shanu DB2 2 Tue Aug 26, 2014 10:09 am
No new posts Multiple 400-byte redefine layouts &a... Scott McC Compuware & Other Tools 14 Tue Jul 23, 2013 10:15 pm


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