View previous topic :: View next topic
|
Author |
Message |
dp33770
New User
Joined: 04 Jul 2007 Posts: 91 Location: Hyderabad
|
|
|
|
I have a file in which 1st rec. is a header.
While sorting I want to skip the fisrt rec and sort the remaining.
I am using the below code in sort card.
SORT FIELDS=(4,3,CH,A,1,3,CH,A),
SKIPREC=1
But the output record is removing 1st record which I am skiping.
Can anyone tel me how to start sorting the rec after 1st rec.
The output file should have the first rec. also
Thanks |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Which sort product are you using on your system? Which release?
One way to do what you want is to force an "A" at the end of the "header" and "B"s at the end of the other records. The sort then becomes this contrived field to keep the first record first followed by the positons you want to sort.
Is there something unique about the first record other than placement in the file? |
|
Back to top |
|
|
dp33770
New User
Joined: 04 Jul 2007 Posts: 91 Location: Hyderabad
|
|
|
|
We use SYNCSORT.
The first rec is just a header which need to come at first position.
I cant append 'A' and 'B' in the records...as the file is being FTPed after.
DO we hav something like Start AFter or STARTREC .... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
This would be a bit less than elegant, but you could copy the first record into a new work file1 (it will only have 1 record).
You would then sort all of the records #2 thru #n into a new work file2.
Lastly you could concatenate the single record file1 before the sorted many record file2 copying all the records to the final output file.
FTP the final output file.
If this was my requirement, i'd write the very little bit of cobol code needed. |
|
Back to top |
|
|
dp33770
New User
Joined: 04 Jul 2007 Posts: 91 Location: Hyderabad
|
|
|
|
Thank you.... |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
dp33770,
As suggested here earlier, you CAN add some indicators to the header record/detail records, do the sort and remove it while writing to output. Do you have anything which identifies a header record?
Please post a few sample records with relevant fields and input file attributes.. |
|
Back to top |
|
|
|