Get Next (GN)

Command title

Get Next

Description

This command increments the COUNT field of the xxxx-COMMAND-AREA by 1 and then retrieves the row with that subscript to the xxxx-ROW-AREA.

COBOL syntax

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

C syntax

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

Parameters

xxxx-ROW-AREA

Explanation

If the command causes the table to be opened automatically or this is the first command after an explicit open, the input value of COUNT is set to zero by the open. Therefore, if the table is not empty, the first row in the table is retrieved.

Return value

If the table is empty or the resulting COUNT designates a non-existent row, FOUND is set to N and ERROR code set to zero.

If the row is found, FOUND is set to Y.

Notes

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

In a multi-tasking or multi-user online environment, results for commands that utilize a count or sequential accessing of table rows may get unexpected results if another task/user is updating or deleting rows in the same table.

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)