Thanks for providing support for all MF Queries.Now i would like to know about sort using ICETOOL.
I have a PS file RECFM=FB,LRECL=172. file has many company reports within itself.
Each company report has 3 header and no trailer.
In the first company report, in the first header, we have first sort field 'company id' (numeric field) and in the same row we have the second sort field 'date'. In second and third header no sort fields. after third header, records for the first company starts with first field is numeric field. after all records for the first company, then first header for the second company starts. and so on.
this is how reports for all company is written in that file.
Here i have a doubt in ICETOOL, can i sort the file within each company in the below order ?
1. company id
3. records of that company
i.e.,each company will be first sorted on company id and then date and then records for that company in ascending.
i know i can sort it in COBOL using SORT keyword.
i am little confused on sort using icetool. Can we sort it for the above criteria using DATASORT . If so please let me know
DATASORT works where there is a file-header or file-trailer (or both) on a file. I think you have a different situation.
If you know how to get your answer using the COBOL SORT verb, then you can do the same thing with DFSORT.
expat has given you a good start. The format of your date is not "natural" for sorting, and lines two and three of each group will confuse things as they have different data than the numerics you want to sort on for the detail lines.
If you are still stuck, show us how you'd do it in COBOL and we can assist in applying that with SORT Control Cards.
You will have to search the forum / manuals on how to chop the addition fields off as I am a bit busy at the moment to go looking, probably OUTFIL OUTREC=
Expat you got it almost right. OP's header records had(CO,FI and PR) in postions 1 and 2 and your detail records have numeric data. So you should be ok as characters get sorted first and then numeric data. But if they have different values then you may need to sequence the group records and preserve the first 3 as is.
btw this is similar to the smart DFSORT trick "Sort detail records between headers and trailers" which can be found here
Is sorting the data going in to the report possible?
If not, use expat's suggestion, swapping the date into "sort" order (76,4,74,2,72,2).
Take note of what Kolusu said. If your first three lines are always like that, then there will be no harm in sorting on 1,2, as the letters will always come before numbers, and the letters are in order. If you can have different text per heading in those first three lines, then there is a little more to do.