The encoding of these values is naturaly constructed. It contains nested encodings of each component value. In the case of SEQUENCE and SEQUENCE OF types, the order of values is meaningful and thus must be preserved.
You will not probably read following examples but just the text is not too short...
TypA :: SET {p BOOLEAN, q INTEGER, r BIT STRING}
valA TypA ::= {p TRUE, r '83F'H, q -7}
11 0B 01 01 01 03 03 04 83 F0 02 01 F9
and two more encoding are possible.
Readings ::= SEQUENCE OF INTEGER (-100 .. 60)
medicineHat Readings ::= {-5, -4, 4, 15, 20, 24, 29, 28, 20, 15, 3, -2}
10 24 02 01 FB 02 01 FC 02 01 04 02 01 0F 02 01 14 02 01 18 02 01 1D 02 01 1C 02 01 14 02 01 0F 02 01 03 02 01 FE
The encoding of CHOICE type is precisely that of the cosen alternative. Having
OneOrSeveralIntegers ::= CHOICE {
one INTEGER,
several SEQUENCE OF INTEGER
}
the values
single OneOrSeveralIntegers ::= one -129
multiple OneOrSeveralIntegers ::= several {=129, 0}
would be encoded as
02 02 FF 7F
10 07 02 02 FF 7F 02 01 00
The encoding of ANY valy is precisely that of the selected value of the selected type. Thus, the value INTEGER -129 of type ANY is encoded as:
02 02 FF 7F
The encoding of values of a tagged type depends on tagging style - whether it is implicit or explicit. If the tagging is implicit, the tag of encoding in identifier is replaced by applied one. But if the tagging is explicit, both standard (the type reflecting) and applied tag are conveyed. This implies that all explicit tagged types are constructed.
Consider the example of INTEGER value -27066. The standard encoding would be:
02 02 96 46
If the value is given an implicit tag of [5], encoding will change to:
85 02 96 46
If an implicit [APPLICATION 35] tag is given:
5F 1F 02 96 46
But if an explicit tag of [5] is applied, explicit tag is conveyed in identifier of constructed type, while standard tag of INTEGER is held in nested encoding:
A5 04 02 02 96 46