Page 1 of 1

sorting with excluding header and trailer

PostPosted: Thu Jun 09, 2016 3:42 pm
by arya_starc
Suppose if this is my input file

HEADER
1111AAAA
3333CCCC
2222BBBB
TRAILER



I want to sort this input file excluding the HEADER and TRAILER but the HEADER and TRAILER should be in the output of the sorted file.

i.e this should be the output

HEADER
1111AAAA
2222BBBB
3333CCCC
TRAILER



Is there a way to do it?

Re: sorting with excluding header and trailer

PostPosted: Thu Jun 09, 2016 4:34 pm
by NicC
If you are wanting a sort solution why do you post in the Cobol section? And why do you not use the code tags? And why not give all the required details - LRECL, RECFM, approximate record count.

BTW - you have "datasets" not "files".

And why have you not searched or read the manuals? There you would have come across the DATASORT operator.

Moving to DFSort section.

Re: sorting with excluding header and trailer

PostPosted: Thu Jun 09, 2016 10:18 pm
by BillyBoyo
ICETOOL's DATASORT is for exactly that case.

Re: sorting with excluding header and trailer

PostPosted: Mon Jun 13, 2016 12:12 pm
by arya_starc
yeah..thanks billy


DATASORT FROM(SORTIN) TO(SORTOUT) HEADER TRAILER USING(ABCD)
SORT FIELDS=(27,18,CH,A)