Syntax for converting the data type


To convert the data type, add a CONVERT (outputType,sourceType) statement after a triplet. The utility supports the following data-type conversions:

Data-type conversion

CONVERT statement

Packed to character

(CONVERT(C,P))

Binary to character

(CONVERT(C,B))

Character to packed

(CONVERT(P,C))

Binary to packed

(CONVERT(P,B))

Character to binary

(CONVERT(B,C))

Packed to binary

(CONVERT(B,P))

Hexadecimal to character

(CONVERT(C,X))

Example

Description

Notes

FIELDS(1:16,4,CONVERT(C,B))

Converts the binary full word at offset 16 in the source segment into a numeric string of the default length, which is 11 characters

None

FIELDS(1:1,3,CONVERT(C11,P))

Normally, three packed bytes translates to five characters, but this override results in 11 characters padded on the left with zeros

None

FIELDS(1:1,3,CONVERT(C1,P))

Converts three packed bytes to a single character result ('0' through '9'), truncating on the left, even if there were non-zero values there in the source

Overriding to a smaller length is also allowed.

Converting from the hexadecimal data type to the character data type is different. The raw values of the source field convert to displayable hexadecimal values that consist of exactly twice the number of bytes. You cannot override the length for this type of conversion.

Information
Example

If the source field is a binary full word containing the decimal value 4,079, the destination result is the eight-character C'00000FEF'.

For this type of conversion, use CONVERT(DUMP).

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*

BMC AMI Online Reorg for IMS 5.2