9 9 BINTOHEX

LANSA Technical

9.9 BINTOHEX

Þ Note: Built-In Function Rules.

Converts the contents of the source field from its binary format to an alphanumeric string consisting of two characters for each byte in the source.

For example, if Source contains AB, Return alphanumeric string will be C1C2 (IBM i) 4142 (Windows)

For use with

LANSA for i

YES

Visual LANSA for Windows

YES

Visual LANSA for Linux

YES

 

 

Arguments

No

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

w

Req

Source:
Visual LANSA Note: Source field type can be any RDMLX field type with unlimited length.

1

Unlimited

 

 

2

N

Opt

Number of bytes to be converted. See Technical Note below.

1

11

0

0

 

 

Return Values

No

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

X

Req

Returned string
Characters will be 0-9, A-F

2

Unlimited

 

 

2

A

Opt

Return code.
OK = action completed.
ER = An error occurred.

2

2

 

 

 

 

Technical Note

Second Argument

Built-In Function Behaviour

0 (Default)

The value of the first argument (Source) is treated as a NULL terminated string:

The first NULL byte in the source will be the terminator of the string.

If there is no NULL byte in the source, the BIF will process the whole field.

Any trailing BLANK, Carriage Return(CR) or Line Feed(LF) of the string being processed will be truncated.
For example (in Windows): 
If the source value is

0xC1D4D840C1D4E2E8C4F0F220001F01

Then the actual value processed by this BIF will be:

0xC1D4D840C1D4E2E8C4F0F2

because

the input value is only read until the first NULL( 0x00 )

then the trailing BLANK ( 0x20 ) is truncated.

Any negative value

The whole value of the source field will be processed. No truncation will happen.

Positive, not bigger than the current size of the first argument field

The BIF will process only the specified number of bytes from the source field. No truncation will happen to this portion of the source value.

Bigger than the current size of the first argument field

Return ER.
No conversion will happen.