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 'TBLBASE' USING        TB-PARM
                            xxxx-COMMAND-AREA
                            xxxx-ROW-AREA
                            [xxxx-KEY-AREA].

C syntax

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

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.

Notes

None

Exceptions

None

See also

3. FOUND (1 byte)

8. COUNT (fullword binary)