MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Sort only certain records in a file

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
chikdu
Beginner


Joined: 06 Jul 2005
Posts: 29
Topics: 20

PostPosted: Fri Dec 11, 2009 3:38 am    Post subject: Sort only certain records in a file Reply with quote

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


So utimately my file should look like

XIRR0200O2009-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.53.176334
00332009-12-09-08.49.52.543410
00332009-12-09-08.49.52.716000
00342009-12-09-08.49.53.382384
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
00352009-12-09-08.49.52.681352
00802009-12-09-08.49.52.918482
00802009-12-09-08.49.52.221461
XIRR0200000000016

ie: only the '0033' and '0034' records sorted for timestamp.

Any help would be greatly appreciated.

Thanks,
Chikdu.
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Dec 11, 2009 11:52 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Send e-mail Visit poster's website
chikdu
Beginner


Joined: 06 Jul 2005
Posts: 29
Topics: 20

PostPosted: Sun Dec 13, 2009 11:13 pm    Post subject: Reply with quote

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

Sorry for the confusion.

Thanks,
Chikdu
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Mon Dec 14, 2009 6:13 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group