|
View previous topic :: View next topic
|
| Author |
Message |
kumarmf2004
New User

Joined: 25 Oct 2006 Posts: 4
|
|
|
|
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 |
|
 |
vasanthz
Global Moderator

Joined: 28 Aug 2007 Posts: 1753 Location: Tirupur, India
|
|
|
|
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:
Use [URL] BBCode for External Links |
|
|
| Back to top |
|
 |
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1217 Location: Dublin, Ireland
|
|
|
|
| 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:
Use [URL] BBCode for External Links |
|
Surely
SORT FIELDS=(1,7,ZD,A,15,4,ZD,A,9,2,ZD,A,12,2,ZD,A) |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
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 |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|