You are specifying DCB for an output file from SORT. There is no need to do this, SORT will do it. Since SORT will do it, using a DCB yourself just increases complexity and maintenance.
I think your expected output is incorrect, as you show three records with a key of 1, but only two on your input.
This may have lead you to code the OVERLAY like that.
On the REFORMAT record the "left" side represents the current record, and the right the next record. You should have no need to take the data from the right and put it on the left.
The first IFTHEN gets your "end of key" condition, the BUILD makes a new record, how you want it, with the flag on.
The second IFTHEN deals with all other records, where you can BUILD with a blank in your flag.
I you not realise it, but once a record is true for IFTHEN=(WHEN=(logical expression) no more IFTHEN processing ceases for that record, unless you specify HIT=NEXT in the IFTHEN. So you don't need to "avoid" the record you've just changed by negating the condition.
I've changed OUTREC to INREC. In this case makes no difference to processing, and in such cases I personally standardise on INREC (partly because people seem to think OUTREC has "special powers").
I've taken off all your column positions. The default start position for a fixed-length record is 1:, so you don't need that. If you don't specify a column, the next available position is used anyway. So taking them out and letting SORT roll with it is much easier for maintenance and readability.
You specified 3C' ', which is fine, but 3X does exactly the same thing without needing to ensure there is only one space between those quotes. It is worth locating this in the manual, as you should then find a couple of other things which can be helpful in a similar way.