Thanks to all of u for ur help.
I am solving that problem in a different way combining JCL & REXX.
I am facing a new problem now. I am trying to sort a file into four different output files using OUTFIL. But i dont want the entire record. So I used INCLUDE COND to achieve that. Again i want to truncate some parts from that record. For this when i use OUTREC the job is abending that the syntax is not correct.
When this syntax is used the output is
CTR301I MOB.#CO.R01.RT01.I402P01.INSURANC.G0021V00 +001 CB
in one line
Regardless of the order in which you code the statements, they are processed in the following order: SORT statement, OUTREC statement, OUTFIL statements. The OUTREC statement reformats the sorted records to 42 bytes. The OUTFIL INCLUDE operates against the reformatted record, but tries to access 39,8 which is beyond the end of the 42-byte reformatted record.
What you probably want is to use the OUTREC parameter of OUTFIL rather than the OUTREC statement, e.g.
The order of processing in this case is: SORT statement, OUTFIL INCLUDE, OUTFIL OUTREC. So the OUTFIL INCLUDE operates against the sorted input records, and the OUTFIL OUTREC operates against the included records.
Well in this case the first OUTREC statement reformats the records to 6 bytes and the OUTFIL INCLUDEs operate against those 6 bytes. Since the INCLUDEs have 1,1, it doesn't matter if they operate against the input records or the reformatted records - position 1 has the same value eiter way. The second OUTREC statement is ignored as a duplicate.