Previous Topic: &DEC

Next Topic: &DELAY


&DECODE

The &DECODE verb decodes all or part of an MDO, creating logical ASN.1 components from a serial byte string.

This verb has the following format:

&DECODE MDO=targetmdo
      [ { [ TRANSLATE={ NO | ISO | DEC | ASCII } ]
            SRC_CHARSET=name
          [ TGT_CHARSET=name ]
          [ SINGLE_SUB=xx ]
          [ DOUBLE_SUB=xxxx ] } ]
      [ TRANSFER={ NO | BER } ]
      [ FROM MDO=sourcemdo ]

An NCL procedure can decode all or part of an MDO from a serial byte stream, after transmission using the &DECODE verb.

Operands:

MDO=targetmdo

(Mandatory) It identifies the target component for the decode operation. The target MDO name is:

In both cases, the MDO must exist and be mapped, or the request fails.

TRANSLATE={ NO | ISO | DEC | ASCII }

(Optional) Specifies the translation of character strings. If TRANSLATE=NO is specified, or defaulted, no character set translation occurs. Otherwise, character strings are translated using the character set specified by this operand.

During translation, all character codes are assumed to be from the indicated character set and are translated to their EBCDIC equivalent. Source graphic characters that do not have an equivalent translation are translated to blanks. Control characters are translated to nulls. When used with a transfer syntax, translation takes place after decoding. When used without a transfer syntax, no source MDO is specified and the target MDO is modified in place.

Specification of this operand precludes the use of SRC_CHARSET, TGT_CHARSET, SINGLE_SUB, and DOUBLE_SUB.

SRC_CHARSET=name

(Optional) Names the source character set. If this operand is specified, the TRANSLATE operand cannot be specified.

Use SRC_CHARSET instead of TRANSLATE to specify translation using the Advanced Translation Facility (ATF).

TGT_CHARSET=name

(Optional) Names the target character set. If this operand is specified, the TRANSLATE operand cannot be specified.

TGT_CHARSET defaults to SOLVE. However, you can specify any other character set name to indicate that you want to translate to that character set.

SINGLE_SUB=xx

(Optional) Specifies an overriding target one-byte substitution character. The value is in two hexadecimal characters. For example, to replace all untranslatable characters with an EBCDIC question mark, code SINGLE_SUB=3F (assuming TGT_CHARSET=ASCII).

DOUBLE_SUB=xxxx

(Optional) Specifies an overriding target two-byte substitution character. The value is in four hexadecimal characters.

TRANSFER={ NO | BER }

(Optional) Specifies the use of transfer syntax when decoding. If NO is specified, or defaulted, no decoding takes place. TRANSFER=BER indicates the use of Basic Encoding Rules as the transfer syntax.

When a transfer syntax is specified, the FROM operand is required to indicate the sourcemdo, which is treated as a serial byte stream. Decoding takes place in accordance with the definition of the target MDO, and the result is placed into the target MDO. If translation was also requested (by specifying the TRANSLATE operand), translation of the target component character strings occurs after decoding.

If the TRANSFER operand is omitted, or TRANSFER=NO is specified, no decoding takes place, and the FROM keyword and source MDO cannot be specified.

FROM MDO=sourcemdo

This operand is mandatory and identifies the source component for the decode operation. The source MDO name is:

Return Codes:

&RETCODE

&ZFDBK

Meaning

0

0

All data successfully decoded

4

0

Input was empty-no data was decoded

 

1

Unexpected trailing octets were ignored

 

2

End-of-contents octets were assumed

8

1

Data invalid, could not be decoded

 

2

Mandatory component missing

 

3

Expected tag not found

 

4

Invalid length encoding

 

5

Invalid tag encoding

 

6

Invalid contents encoding

 

7

Incorrect multiple tagging

 

8

Incorrect recurring tag (within a SEQUENCE OF or SET OF type)

 

9

Tag value exceeds implementation limit

 

10

Length value exceeds implementation limit

 

11

Data value exceeds implementation limit

12

0

Undefined MDO name referenced

For &RETCODE 4, the &SYSMSG variable contains a warning message describing the condition.

For &RETCODE 8, the &SYSMSG variable contains an error message describing the component in error, the position in the data stream where the error was encountered, and the actual error condition.

Notes:

Example1:

&DECODE MDO=CMIP.GETARG TRANSLATE=DEC
&DECODE MDO=ROSE TRANSLATE=ISO TRANSFER=NO

In these examples, components present in targetmdo, and defined as ASN.1 character strings, are translated from the indicated character set to their EBCDIC equivalent.

Example 2:

&DECODE MDO=CMIP.GETARG TRANSFER=BER FROM +
        MDO=ROSE.RDIVAPDU
&DECODE MDO=ROSE TRANSLATE=NO TRANSFER=BER FROM +
        MDO=BYTESTR
&DECODE MDO=ROSE TRANSLATE=DEC TRANSFER=BER FROM +
        MDO=BYTESTR

These examples show decoding of a serial byte stream into targetmdo, with character string translation from the indicated character set, if any, to EBCDIC.

Example 3:

&DECODE MDO=BUD SRC_CHARSET=UNICODE

This example translates character data in the MDO BUD from Unicode to EBCDIC.

More information:

Code Page Selection

&ENCODE