Posted: Wed Mar 23, 2005 3:20 pm Post subject: Sort using delimiter space
Hi,
My input file has only 2 columns as follows. Reg len is 80. The lengthof first column will be 1 to 9, length of 2nd key is 2. The keys are delimited by single space.
The records have to sorted as per first column value, but whenever the duplicate exists, then it has to consider only the duplicates(not the first record in duplicates). The value of 2nd column will be in ascending order for duplicates(for ex: The record 4444 has high value 67 in duplicate record and 11 in first record).
The key can have only 2 rows at the most. For ex, there will not be any other new row for 4444.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Wed Mar 23, 2005 4:28 pm Post subject:
Here's a DFSORT job that uses the the new IFTHEN and OVERLAY parameters available with z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (Dec, 2004) to do what you want. I assumed that your input file has RECFM=FB and LRECL=80, although the job can be changed appropriately for other attributes.
It wasn't clear from your example if you want to sort the column 1 values in 1-9 as character values or numeric values. For example, if you have:
1 99
02 99
Sorting the 1 and 02 as character values ('1 ' and '02') gives you '02' and then '1 ', whereas sorting the 1 and 02 as normalized numeric values (01 and 02) gives you 1 and then 02. I chose character sorting in the example below, but if you want to use numeric sorting, just change the SORT statement to:
Code:
SORT FIELDS=(81,9,UFF,A,90,2,CH,A)
UFF is a new DFSORT format that will extract the digits (0-9) from any value, thus normalizing them for sorting. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Wed Mar 23, 2005 7:45 pm Post subject:
Syncsort does NOT support the IFTHEN, OVERLAY or UFF parameters. These are all exclusive features of DFSORT. So there's nothing you can change - other than getting your shop to switch from Syncsort to DFSORT. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
You can try the following JCL. OFILE will contain the desired o/p. This JCL is very similar to the one posted by Frank, except that I have used OUTFIL along with INCLUDE and OUTREC instead of IFTHEN and OVERLAY parameters used by Frank. And as Frank mentioned earlier, the UFF parameter is not available with SYNCSORT, so you will have to use CH in the CTL2CNTL control card
You really do need DFSORT's new UFF format for this kind of thing. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Thu Mar 24, 2005 12:00 pm Post subject:
Kolusu,
Yes, you could use SELECT that way for the second pass with Mithun's example. But you still have the UFF vs CH problem.
Note that with DFSORT, you could use UFF instead of CH for the 81,9 field in the SELECT ON parameter and SORT statement. But, of course, with DFSORT, you could use the one pass solution with UFF I suggested instead. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Mon May 08, 2006 6:45 pm Post subject:
Here's an easier way to do this kind of thing using the new PARSE function available with z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006):
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum