Joined: 09 Mar 2011 Posts: 7312 Location: Inside the Matrix
There is some silliness here.
Firstly, BUILD should be preferred to FIELDS. FIELDS means different things in different places, BUILD only means one thing, so less confusing.
For BUILD (and FIELDS) the default starting position is byte 1. So no need for "1:". 189 bytes are then placed in the output record area, so no need for "190:" either. By including column numbers where they are not needed, clarity is lost and maintenance made more difficult.
Without the OUTREC, the output record would consist of the data 1 for a length of 439.
What the OUTREC is doing is copying 185 bytes from position 1, 260 bytes from position 190, and blatting four bytes to binary one starting at 186.
It should be noted that OUTREC runs after the SUM, so you may now end up with records which are identical but for which duplicates would have been dropped if INREC was used instead of OUTREC.
The code should be
It should be on INREC if you want the SUM to take account of it, else on OUTREC.