Examples of Non-Automatic Maps
Non-automatic maps provide explicit mapping between the external and internal format. Such mappings work on fields with primitive types and/or fields that are instances of other formats. In the latter case, the maps can be nested indefinitely. The following two examples demonstrate these concepts.
Example - Non-Automatic Maps, all primitives
 In the following example a decoder, based on the in_map
, does the following:
Reads an instance of the external recordÂ
ExtFormat
.AssociatesÂ
ef1
 withÂif1.
 That is, any reference toÂif1
 forces decoding of the information ofÂef1
 and in the process converts it to an integer.AssociatesÂ
ef2
 withÂif2.
 That is, any reference toÂif2
 forces decoding of the information ofÂef2
 and in the process converts it to a string.
external ExtFormat { ascii ef1 : static_size(4), padded_with(" "); int ef2 : static_size(2); }; internal IntFormat { int if1; ascii if2; }; in_map InMapFormat: external(ExtFormat), internal(IntFormat) { e:ef1 and i:if1; e:ef2 and i:if2; };
Â
Example - Non-Automatic Maps, externals in externals
In the following example a decoder, based on the in_map
, does the following:
Reads an instance of the external recordÂ
ExtFormat2
.AssociatesÂ
ef1
 withÂif1.
 That is, any reference toÂif1
 forces decoding of the information ofÂef1
. The conversion betweenÂExtFormat1
 andÂIntFormat1
 is, in this case, dictated by the in-map namedÂInMapFormat1
 as declared inÂInMapFormat2.
external ExtFormat1 { ascii ef1 : static_size(4); }; external ExtFormat2 { ExtFormat1 ef1; }; internal IntFormat1 { int if1; }; internal IntFormat2 { IntFormat1 if1; }; in_map InMapFormat1: external(ExtFormat1), internal(IntFormat1) { e:ef1 and i:if1; }; in_map InMapFormat2: external(ExtFormat2), internal(IntFormat2) { e:ef1 and i:if1 using in_map InMapFormat1; };
As seen in the example, explicit map specifications for complex formats can become very large, even describing all the internals to map data too, can be a huge task. This is why automatic mapping is normally used.