The format used to write a record to a file should be cleared before each use. Otherwise stale data left in the format from previous records may be
saved into the current record if it does not have data for all the fields in the format.
Noncompliant code example
C IF X <> Y
...
C ENDIF
C WRITE RECFMT
/free
if x <> y;
...
endif;
write recfmt;
/end-free
Compliant solution
C CLEAR RECFMT
C IF X <> Y
...
C ENDIF
C WRITE RECFMT
/free
clear recfmt;
if x <> y;
...
endif;
write recfmt;
/end-free