Posted: Fri Jul 25, 2008 3:18 pm Post subject: Need to extract the only column values using sort
Hi all,
Herein I have a input file, out of which I need only one particular column values in the output file.
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
BATCH T * 3 T0J0AJ7C T0J0AJ7 013F 12618
******************************** Bottom of Data ********************************
In the above mentioned screenshot i want the coulum starting from 57 to 62. SORT FIELDS=(57,6,CH,A), as in the above screenshot it is 12618.
could anyone pls help me to extract only that column in the output file using the sort.
Many many thanks in advance. _________________ Satya
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Fri Jul 25, 2008 3:33 pm Post subject:
If you want to extract the data from 57 to 62 and SORT it, you can use these DFSORT control statements:
Code:
INREC BUILD=(57,6)
SORT FIELDS=(1,6,CH,A)
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:
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Tue Jul 29, 2008 10:40 am Post subject:
Actually, that wouldn't give the same result. If you're getting the same result, then the test data you're using is probably not good enough to show the difference.
INREC is processed before SORT so:
Code:
INREC BUILD=(57,6)
SORT FIELDS=(1,6,CH,A)
would extract 57,6 into 1,6 and then sort on 1,6. So you would be reducing the records to 6 bytes before sorting but still sorting on the field that was in 57,6 in the input record.
OUTREC is processed after SORT so:
Code:
OUTREC BUILD=(57,6)
SORT FIELDS=(1,6,CH,A)
would sort on 1,6 and then extract 57,6 into 1,6. Here you're sorting on whatever happened to be in 1,6 of the input records rather than on 57,6. And you're not reducing the records before sorting.
If you want to use OUTREC, you would need:
Code:
SORT FIELDS=(57,6,CH,A)
OUTREC BUILD=(57,6)
This would sort on 57,6 in the input records and then extract 57,6 to 1,6. Again, you're not reducing the records before sorting.
Reducing the record length to 6 before sorting with INREC can be more efficient than sorting on the entire record. _________________ 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 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