Replace by Key (RK)

Command title

Replace by Key

Description

This command replaces a row that already exists in a table.

COBOL syntax

MOVE 'RK'                   TO xxxx-COMMAND.
CALL 'DK1TCALL' USING        TB-PARM
                            xxxx-COMMAND-AREA
                            xxxx-ROW-AREA
                            [xxxx-KEY-AREA].

Parameters

xxxx-ROW-AREA

xxxx-KEY-AREA — included for backward compatibility. The table key is extracted from xxxx-ROW-AREA, and the xxxx-KEY-AREA parameter is ignored.

Explanation

It searches the table for a row with a key matching the one specified. The key is obtained from the xxxx-ROW-AREA. The xxxx-KEY-AREA parameter is not used. If it is supplied in the call, it is ignored.

Return value

If the row is found, FOUND is set to Y, the content of the xxxx-ROW-AREA replaces that row in the table and COUNT is set to the subscript of the replaced row.

If the requested row is not found in the table, FOUND is set to N, the row is not replaced and COUNT will contain the appropriate subscript for a potential insertion.

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

Notes

None

Exceptions

For a single batch program using a local TSR, the table can be open for read.

See also

3. FOUND (1 byte)

8. COUNT (fullword binary)