anchor.diff:      end.
   
   -spec merge(#dpcs_ff1{}, #dpcs_ff1{}) -> #dpcs_ff1{}.
  -merge(_, _) ->
  -    fail.
  +merge(#dpcs_ff1{key=K, cocd=C, kanjaid=Kid, stay=Stay1, wards=Wards1} = L,
  +      #dpcs_ff1{key=K, cocd=C, kanjaid=Kid, stay=Stay2, wards=Wards2}) ->
  +    Stay = case {Stay1, Stay2} of
  +               {_, null} -> Stay1;
  +               {null, _} -> Stay2;
  +               {{S1}, {S2}} -> {orddict:merge(S1, S2)}
  +           end,
  +    Wards = Wards1 ++ Wards2,
  +    L#dpcs_ff1{stay=Stay, wards=Wards}.
   
   -spec merge_fields(orddict:orddict(), orddict:orddict()) -> orddict:orddict().
   merge_fields(LFields, RFields) ->
  
positive.code:                 current_medicalno=MedicalNo,
                  records=RecordToAdd ++ Records0}
      end,
  
      C#ctx{line_no = LineNo+1}.
  
  -spec new(Cocd :: iolist(),
            Kanjaid :: iolist(),
  
negative.code: from_file(Filename, [YYYYMM, _HospitalID], _Logger) ->
      F = fun(Line, Ctx) ->  parse_line(Line, YYYYMM, Ctx) end,
      {ok, Ctx1} = japanese:fold_all_lines(Filename, F, #ctx{}),
      #ctx{records=Records0, line_no=_LineNo} = Ctx1,
      Records1 = lists:sort(fun(L, R) -> dpcs_ff1:key(L) < dpcs_ff1:key(R) end, Records0),
      Records = merge_same_keys(Records1, []),
      {ok, lists:reverse(Records)}.
  
  -spec from_file(filename:filename(), list(), pid(), fun()) -> {ok, #dpcs_ff1{}}.
  