anchor.diff:        #copy{}}, _Context) when (FieldName1 =/= FieldName2) orelse ((FieldName1 == FieldName2) andalso (Value == absent)) ->
      throw({error, {'ERR D6', FieldName2, "Mandatory field can not be absent with copy operator."}});
   
  -encode(MsgFields = [{FieldName1, _Value} | _], #field{name = FieldName2, presence = optional, operator = #copy{}},
  -      Context = #context{pmap = PMap})
  -   when (FieldName1 =/= FieldName2) ->
  -   {<<>>, MsgFields, Context#context{pmap = <<PMap/bits, 0:1>>}};
  -
  -encode([{FieldName1, Value} | MsgFieldsRest], #field{type = Type, name = FieldName2, presence = optional, operator = #copy{}},
  -      Context = #context{pmap = PMap})
  -   when (FieldName1 == FieldName2) andalso (Value == absent) ->
  -   {encode_type(Type, null, true), MsgFieldsRest, Context#context{pmap = <<PMap/bits, 1:1>>}};
  +encode(MsgFields = [{FieldName1, Value} | MsgFieldsRest],
  +   #field{type = Type, name = FieldName2, presence = optional, operator = #copy{dictionary = D, key = Key}},
  +      Context = #context{pmap = PMap, dicts = Dicts, application = App, template = #template{name = TemplateName}})
  +   when (FieldName1 =/= FieldName2) orelse ((FieldName1 == FieldName2) andalso (Value == absent)) ->
  +   Dict = select_dict(D, TemplateName, App),
  +   RetMsgFields = if (FieldName1 =/= FieldName2) -> MsgFields; true -> MsgFieldsRest end,
  +   case erlang_fast_dicts:get_value(Dict, Key, Dicts) of
  +      empty ->
  +         {<<>>, RetMsgFields, Context#context{pmap = <<PMap/bits, 0:1>>}};
  +      _Value -> % or undef
  +         Dicts1 = erlang_fast_dicts:put_value(Dict, Key, empty, Dicts),
  +         {encode_type(Type, null, true), RetMsgFields, Context#context{pmap = <<PMap/bits, 1:1>>, dicts = Dicts1}}
  +   end;
   
   encode([{_, Value} | MsgFieldsRest],
      #field{type = Type, presence = Presence, operator = #copy{dictionary = D, key = Key, value = InitialValue}},
  
positive.code:    #field{type = Type, name = FieldName2, presence = Presence, operator = #default{value = InitialValue}},
        Context = #context{pmap = PMap}) ->
     case Presence of
        optional when (FieldName1 =/= FieldName2) ->
           {<<>>, MsgFields, Context#context{pmap = <<PMap/bits, 0:1>>}};
        optional when (FieldName1 == FieldName2) andalso (Value == absent) ->
           {<<>>, MsgFieldsRest, Context#context{pmap = <<PMap/bits, 0:1>>}};
        _ when (FieldName1 == FieldName2) andalso (Value =/= InitialValue) ->
           {encode_type(Type, Value, is_nullable(Presence)), MsgFieldsRest, Context#context{pmap = <<PMap/bits, 1:1>>}};
        _ when (FieldName1 == FieldName2) andalso (Value == InitialValue) ->
  
negative.code:    Res3 = {_, _, _Context4} = encode([{<<"Security">>, <<"RSESM6">>}], Field, Context3),
     ?assertMatch({<<16#ff, 16#52, 16#d3>>, [], #context{pmap = <<>>}}, Res3).
  
  appendix_3_2_6_3_test() ->
     Field = #field{type = decimal, presence = optional, name = <<"Value">>, operator = #decFieldOp{
           exponent = #copy{dictionary = ?template_name, key = "key_exponent"},
           mantissa = #copy{dictionary = ?template_name, key = "key_mantissa"}
        }},
     Context = create_context(<<>>),
     Res1 = {_, _, Context1} = encode([{<<"Value">>, {942755, -2}}], Field, Context),
     ?assertMatch({<<16#fe, 16#39, 16#45, 16#a3>>, [], #context{pmap = <<2#11:2>>}}, Res1),
     Res2 = {_, _, _Context2} = encode([{<<"Value">>, {942760, -2}}], Field, Context1),
     ?assertMatch({<<16#39, 16#45, 16#a8>>, [], #context{pmap = <<2#1101:4>>}}, Res2).
  
  -endif.
  