View previous topic :: View next topic
|
Author |
Message |
Rock Xu
New User
Joined: 04 Dec 2009 Posts: 15 Location: Shanghai China
|
|
|
|
Hello, Everyone:
There is one file with the first line which is the header and the last line which is the tailer. I want only the middle lines be sorted, but the first line and the last line should still be there in the output file. So I can not simply do it by include cond or omit cond. How can I do then?
Ps: The record type can be distinguished by the first 2 positions, for the header it is 01, 02 for the records I want to sort, 03 for the tailer. |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
Back to top |
|
|
Rock Xu
New User
Joined: 04 Dec 2009 Posts: 15 Location: Shanghai China
|
|
|
|
Hello, Superk:
My records is like this:
01header
02.........
02.........
02.........
03tailer
The record length is 180. And I tried this way:
INREC IFTHEN=(WHEN=INIT,OVERLAY=(181:C'1')),
IFTHEN=(WHEN=(1,2,CH,EQ,C'01'),OVERLAY=(181:C'0'))
SORT FIELDS=(23,4,CH,A;45,8,CH,A;54,6,CH,A)
INREC IFTHEN=(WHEN=(1,2,CH,EQ,C'03'),OVERLAY=(181:C'9'))
OUTREC FIELDS=(1,180)
The output like this:
01header
03tailer
02.........
02.........
02.........
As you see, althought header and tailer have been retained but I want to move the tailer to the last line.(Because it is the tailer.) |
|
Back to top |
|
|
singhju
New User
Joined: 01 Dec 2010 Posts: 25 Location: Gurgaon
|
|
|
|
Give a simple try to DATASORT as suggested by superk and it will work for you. Moreover it is more simpler than what you are trying. |
|
Back to top |
|
|
Rock Xu
New User
Joined: 04 Dec 2009 Posts: 15 Location: Shanghai China
|
|
|
|
Yeah. It works. Thanks, superk and singhju. |
|
Back to top |
|
|
|