BYTE( ) function

Returns the character stored in the specified byte position in the current record.

Syntax

BYTE(byte_location)

Parameters

byte_location

Numeric. The byte position in the current record to retrieve the character for. The value refers to a position in the record (counting from 1), irrespective of any field definitions.

Output

Character.

Remarks

You can use this function 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 not be able to compare this to character values.

If you want to retrieve the binary representation for specified byte location, use the BIT( ) function.

Example

Extract a record if a specific character is found

You can use the BYTE( ) function to identify records in a data file where a particular character is present in a particular byte position. This is typically the case in Print Image (Report) files or Adobe Acrobat (PDF) files where data is formatted in a consistent way throughout the document. For example, to locate and extract records that include a period at byte position 113, you would use the following command:

EXTRACT RECORD IF BYTE(113) = “.” TO "Output.fil"


(C) 2013 ACL Services Ltd. All Rights Reserved. | Send feedback