Previous Topic: $PROGRAM FunctionNext Topic: $RECEIVED Function


$RBA Function

The $RBA function accesses ESDS VSAM files by the relative byte address. The function returns the current relative byte address in numeric form. You can use the $RBA function in the WHERE clause of a FOR statement to select records, as the source operand in SET statements, and in expressions.

This function has the following format:

$RBA[(dataview‑name)]
dataview‑name

The name of a VSAM dataview that defines an ESDS file. The dataview name is required for this function except when it is used as the left‑hand operand in a WHERE clause. You cannot specify the dataview name for this function in the left‑hand operand of the WHERE clause.

Examples

In the following example, the $RBA function is accessed after the FOR NEW processing is completed to determine the relative byte address of the last record added.

FOR NEW PSS‑MASTER
    statements
ENDFOR
SET NEW‑ADDRESS = $RBA(PSS‑MASTER)

In the next example, a table of relative byte addresses determines the starting address.

FOR FIRST PSS‑MASTER
    WHERE $RBA = RBA‑TABLE(REC‑NO)
       statements
ENDFOR