This appendix shows how incoming ASN.1 records can be encoded into a sequential external format.
An ASN.1 format definition can be pasted directly into an Ultra asn_block. Nested structures are saved as they are in the target_internal type, however the nested fields cannot easily be encoded to a different format without using an APL agent (Analysis or Aggregation). In the example, the incoming ASN.1 record is encoded to a sequential record, mapping all the field values to corresponding fields in the sequential format.
Mapping - nested structures to plain, sequential structures - can be accomplished in three ways:
By creating a constructed external format definition, that is, where the external record definition consists of sub-externals.
By extending the target_internal with first leveltemporary fields which hold the values of the nested fields to be encoded.
By creating a new UDR which is populated with values from the incoming nested UDR.
It is possible to encode to a constructed sequential external, that is, an external sequential definition containing other externals to represent the nested fields. The disadvantage with this approach is that it is not possible to mix different level fields in the produced output record.
Name the fields in the outgoing external exactly as in the incoming ASN.1 structure. This allows the use of automatic mapping.
Create an internal which holds the nested fields to be mapped to the sequential format. Define a target_internal holding both the asn_block and the internal. The values of the nested fields of the target_internal are copied to the fields added with the internal format specification, using APL code.
APL code is necessary to extract the nested values
Format Definition (shortened):
All following fields are declared optional. This is to enable differentiation between an absent value and a zero value (default for int type). Thus, if no value is entered it is encoded as empty in output format, as opposed to 0 (zero).
Since no automatic mapping specifications are given, no named internal types for SubUDR1 and SubUDR2 are received. This is not a problem as long as referencing the types directly (for instance in APL) is unnecessary.
e:duration and i:duration_i;
e:calledNumber and i:calledNumber_i;
A structure of sub-UDRs with the same field names as in the internal mapped from is created (that is, the target_internal which has the same structure as the ASN.1 external). This only produces a line-based comma separated output file.
Create an internal for the sequential format, however do not add it to the incoming ASN.1 structure's target_internal. Instead for each incoming UDR, create a new UDR and copy the field values from the ASN.1 UDR. The ASN.1 UDR can then be discarded, routing the new internal further.
Internal presentation of the input ASN.1 UDR
Internal presentation of the output sequential UDR
The ASN.1 definition can be copied directly into an Ultra asn_block definition. An external for the sequential outgoing UDRs is created.
Format Definition (shortened):
// The same field names as in the internal format are used
// to be able to use automatic mapping.
An internal, containing fields matching the external field names, is created in order to hold the values to be encoded.