Previous Topic: Mapping Directives

Next Topic: Local Form Control


MDO Tag Generation

Before the first ASN.1 statement in a module is encountered, one of the following directives can be used to indicate how MDO tags are to be generated.

--< TAGS(ANY) >--      compiler is to generate tags
--< TAGS(EXPLICIT) >-- tags are explicitly coded in the source

ANY is the default, meaning that the compiler generates a unique tag value for each component reference in a module. Even where a component name occurs more than once in the module it is given a separate tag. In general this means that the actual tag values used are unpredictable across compiles. If there is no desire to control any MDO tag values, and no requirement to store MDOs in their local form, then this is the easiest way to define MDO tagging.

If EXPLICIT tagging is used, the compiler assumes that the first explicit ASN.1 tag found for a component is in fact the MDO tag value, regardless of its tag class. If no explicit tag is found for a component, the compiler generates a tag value for it as described above for TAG(ANY). Note that this means that the compiler does not use the default tagging for ASN.1 base types as they are likely to lead to ambiguities.

When defining explicit tags care must be taken to ensure that a tag value is used only once within a given structure. However, this tagging technique is very useful where control over tag values is desirable but there is no requirement to BER encode the data, and hence the tags used throughout the module need only be thought of as being MDO tags.

Alternatively, where it is necessary to BER encode the data, but it is also desired to control the MDO tags, the need might arise to use explicit MDO tags that are not part of the ASN.1 source. This can be done by using the following compiler directive following the component name being tagged:

--< [ nn ] >--

This directive follows the component name, but precedes any explicit ASN.1 tag or type information, for example:

userid        --< [ 10 ] >- [ PRIVATE 23 ] GraphicString

In this example, the userid component has an MDO tag value of 10, but if BER encoded, it is tagged with a private tag value of 23, and possibly the GraphicString universal tag, depending upon whether the tag option is set to IMPLICIT or EXPLICIT. The tag option immediately follows the word DEFINITIONS in an ASN.1 module.

Setting the MDO tag value this way always overrides any other MDO tag generation option.