Get Previous (GP)

Command title

Get Previous

Description

This command decrements 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 'GP'                   TO xxxx-COMMAND.
CALL 'DK1TCALL' USING        TB-PARM
                            xxxx-COMMAND-AREA
                            xxxx-ROW-AREA.

Parameters

xxxx-ROW-AREA

Explanation

Automatic open of the table causes COUNT to be set to zero; GP will then decrement that, resulting in a non-existent row pointer.

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.

The table must be open or implicitly opened in the TSR or VTS-TSR. Multiple error codes can be returned by this command.

Notes

GP 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)