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
----


