Posted: Fri Dec 11, 2009 3:38 am Post subject: Sort only certain records in a file
Hi,
I have a file for which I want to sort only certain records based on certain criterea.
As an example,
take the below file
AKRR0200O2009-12-092009-12-091
00222009-12-09-08.49.52.461096
00222009-12-09-08.49.52.716000
00222009-12-09-08.49.52.543410
00332009-12-09-08.49.52.543410
00332009-12-09-08.49.52.716000
00332009-12-09-08.49.53.176334
00342009-12-09-08.49.53.382384
00342009-12-09-08.49.52.927788
00342009-12-09-08.49.52.811485
00342009-12-09-08.49.52.540475
00342009-12-09-08.49.52.461096
00352009-12-09-08.49.52.681352
00802009-12-09-08.49.52.918482
00802009-12-09-08.49.52.221461
AKRR0200000000016
The first and the last record is a header and trailer.
I want to sort only the records with first 4 bytes as '0033' and '0034', say for the timestamp.
00332009-12-09-08.49.52.543410
00332009-12-09-08.49.52.716000
00332009-12-09-08.49.53.176334
00342009-12-09-08.49.53.382384
00342009-12-09-08.49.52.927788
00342009-12-09-08.49.52.811485
00342009-12-09-08.49.52.540475
00342009-12-09-08.49.52.461096
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Fri Dec 11, 2009 11:52 am Post subject:
What is the RECFM and LRECL of the input file?
What is the starting position, length and format of the "timestamp" you want to sort on? How do you want to sort it - ascending or descending?
Your example of sorted output doesn't make much sense as it seems to be sorting descending on the 53/52 values, but ascending on the 543410/716000 values. So you need to explain how you want the timestamps sorted exactly.
Your input example has AKRR in the header and trailer record, but your output example has XIRR - why the change? _________________ 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
Frank,
My file RECFM is FB and LRECL is 80 bytes.
The timestamp format would be YYYY-MM-DD hh:mm:ss.nnn.
I want to sort the timestamp ascending for 0033 and then again timestamp ascending for 0034. For 0022, 0035 and 0080 records, the timestamp should not be sorted.
Sorry about that my output file has AKRR in header and trailer
AKRR0200O2009-12-092009-12-091
00222009-12-09-08.49.52.461096
00222009-12-09-08.49.52.716000
00222009-12-09-08.49.52.543410
00332009-12-09-08.49.52.543410
00332009-12-09-08.49.52.716000
00332009-12-09-08.49.53.176334
00342009-12-09-08.49.52.461096
00342009-12-09-08.49.52.540475
00342009-12-09-08.49.52.811485
00342009-12-09-08.49.52.927788
00342009-12-09-08.49.53.382384
00352009-12-09-08.49.52.681352
00802009-12-09-08.49.52.918482
00802009-12-09-08.49.52.221461
AKRR0200000000016
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Mon Dec 14, 2009 6:13 pm Post subject:
Again:
Quote:
What is the starting position, length and format of the "timestamp" you want to sort on? How do you want to sort it - ascending or descending?
Your example of sorted output doesn't make much sense as it seems to be sorting descending on the 53/52 values, but ascending on the 543410/716000 values. So you need to explain how you want the timestamps sorted exactly.
Your input example has AKRR in the header and trailer record, but your output example has XIRR - why the change?
Please show the correct expected output for your input example.
Quote:
The timestamp format would be YYYY-MM-DD hh:mm:ss.nnn.
The apparent timestamp value in your first input record looks like:
2009-12-09-08.49.52.46109
which would appear to be:
YYYY-MM-DD-hh.mm.ss.nnnnn
not:
YYYY-MM-DD hh:mm:ss.nnn
Please clarify.
I'm on vacation for the next few weeks and trying to spend as little time answering questions on help boards as possible, so I don't have time to guess at what you want or mean. _________________ 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