You are here: Functions > BYTE()

BYTE()

BYTE() returns the ASCII character interpretation of a byte at a specified position in the current record.

Use BYTE() to examine the contents of a position in a record, without having to define a field for the purpose. If you use this function on EBCDIC data, the value returned will also be EBCDIC. You may have trouble comparing this to character values.

Function Format

BYTE(N)

The BYTE() function allows access to individual bytes in the input record. The value N refers to a position in the record (counting from 1), irrespective of any field definitions. The function accesses the byte at position N and returns the contents as a single character string.

Examples

Given a record containing:

10072DOE JOHN 123188

....|....1....|....2....|....3....|....4....|

BYTE(4) = "7"

BYTE(12) = "H"

BYTE(30) = " "