I have a file which is of 958 bytes. The file has junk values in some fields, due to which the SUM fileds done on these fields was giving S0C7. So I used INREC to overlay these fields with 0 (these fields are PD). But still the job is failing with S0C7.
If I split this into 2 different Steps, first step contains the INREC and INCLUDE and the second step contains the SORT and SUM fields the job is running fine with expected output.
I also used ICETOOL to verify the output after INREC and there is no discrepancies shown and the job runs fine. Below is the ICETOOL Sort Card.
COPY FROM(SORTIN) TO(T1) USING(CTL1) -> CTL1 contains the INREC and INCLUDE statments
VERIFY FROM(T1) ON(540,9,PD) -> To verfiy if the fields used for SUM fields are having proper values.
VERIFY FROM(T1) ON(039,9,PD) -> To verfiy if the fields used for SUM fields are having proper values.
SORT FROM(T1) TO(SORTOUT) USING(CTL2) -> Contains the SORT and SUM fields statement.
Could you please help me on what is wrong with the first SORT Card. Do I need to use 2 steps to achieve the purpose?
Note: - I cannot omit the records which are having junk values.
I think your problem is the things aren't working in the order you expect. Have you considered using INCLUDE/OMIT COND=, which operates before INREC? You are using INCLUDE= on OUTFIL, which is after INREC, SORT, SUM, OUTREC.
When you split into two steps, your INCLUDE was done before the SORT/SUM. With the single step it was done after the SORT/SUM.
So no, there is no reason to split things up. And no reason to read the file four times in ICETOOL.
It was a typo. My code has an ending brackets in the INCLUDE.
I did try the INCLUDE COND before the INREC. But the problem is I need to overlay 19 '9' from position 4 in case if the 1st 3 positions are 999 (currently the field contains spaces). If I don't do this, the INCLUDE COND will actually skip the record (as shown below).