Examples of Non-Automatic Maps(3.1)
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
, will do the following:
Read an instance of the external recordÂ
ExtFormat
.AssociateÂ
ef1
 withÂif1
, that is, any reference toÂif1
 will force decoding of the information ofÂef1
 and in the process convert it to an integer.AssociateÂ
ef2
 withÂif2
, that is, any reference toÂif2
 will force decoding of the information ofÂef2
 and in the process convert 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
, will do the following:
Read an instance of the external recordÂ
ExtFormat2
.AssociateÂ
ef1
 withÂif1
, that is, any reference toÂif1
 will force decoding of the information ofÂef1
. The conversion betweenÂExtFormat1
 andIntFormat1
 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.