Get Last (GL)

Command title

Get Last

Description

This command gets the last row from a table and places it in xxxx-ROW-AREA.

COBOL syntax

MOVE 'GL'                   TO xxxx-COMMAND.
CALL 'TBLBASE' USING        TB-PARM
                            xxxx-COMMAND-AREA
                            xxxx-ROW-AREA.

C syntax

memcpy( tbCommArea.tbCommand, "GL", 2 );
TBLBASE( &tbParm, &tbCommArea, pRowArea );

Parameters

xxxx-ROW-AREA

Explanation

Since the last subscript is returned in the COUNT field, the GL Command can be used to determine the number of rows in a non-Hash table. The COUNT returned for a GL of a Hash table cannot be used to determine the number of rows in the table.

Return value

If the table is empty, FOUND is set to N and ERROR code set to zero.

If the command completes successfully, FOUND is set to Y.

Notes

GL can be used in conjunction with Date-Sensitive Processing.

Exceptions

With HASH-EMPTIES-RETURNED set to N, tableBASE suppresses the return of empty rows for tables which have a Hash organization. See Change Status (CS) for additional information on HASH EMPTIES.

See also

Date-sensitive processing

3. FOUND (1 byte)

8. COUNT (fullword binary)