Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

All incoming records are of the same record type, however their content varies. The first four fields are present in all records, the fifth field varies depending on the content of the field RecordOwnerTypePresent. The last three fields are optional.

Image RemovedImage Added

A schematic representation of the example discussed in this section

external

Since the last three optional fields (including  RecordOwnerType and RecordOwnerDN) consist of several fields, each one will be defined as its own type. That is, an external sequential format.

...


Note
titleNote!

The FillerRecord_0x00_EXT construct. This is the padding which may be present between records. Hence, it is defined as a record type identified by the decoder, however not routed on to the subsequent agent (see the in_map definitions).

...

Code Block
/ Filler needed to be able to recognize on the input stream:
external FillerRecord_0x00_EXT: 
      identified_by(RecordIdentifier == 0x00), static_size(32)
{
   int(little_endian) RecordIdentifier      : static_size(1),
      external_only, encode_value(0x00);

   // Note that no other fields are specified.
   // The UDR size (32) will be consumed and discarded (see in_map).

};

Alternative Syntax

An alternative to use the set construct, in the external definition for AMARecord_extswitched_set could be used. This will impact the syntax for the Package_*_EXT types. Only the syntax differing from the original example is shown. The main reason for using switched_set instead of set is when performance must be increased.

...

Note
titleNote!

No  identified_by  or PackageNumber is present, since this is handled in the containing  switched_set .

internal

No  internal  is used. In this case, the  target_internal  is sufficient; all field names and field types are in order and there is only one type of record present in the input, and no additional fields are required.

in_map

The padding in the records is recognized by the decoder, however it is not actually mapped in to the system due to the use of the  discard_output  flag.

...

Code Block
in_map FillerRecord_0x00_Map : 
                 external(FillerRecord_0x00_EXT),
                 target_internal(FillerRecord_0x00), 
                 discard_output { 
                               automatic; 
                 }; 
in_map AMARecord_Map : external(AMARecord_EXT), 
                       target_internal( AMARecord ) { 
  automatic { 
    RecordOwnerType_EXT : target_internal( RecordOwnerType ); 
    RecordOwnerDN_EXT : target_internal( RecordOwnerDN ); 
    Package_100_EXT : target_internal( Package_100 ); 
    Package_101_EXT : target_internal( Package_101 ); 
    Package_102_EXT : target_internal( Package_102 ); 
  }; 
};

decoder

The padding pseudo-records and data records can arrive in any order, therefore there is no need to define a constructed decoder.

Code Block
decoder AMAFile   :   in_map( AMARecord_Map ),
                      in_map( FillerRecord_0x00_Map );

...