Fetch by Key (FK)

Command title

Fetch by Key

Description

This command fetches a row from a table and places it in xxxx-ROW-AREA.

COBOL syntax

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

C syntax

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

Parameters

xxxx-ROW-AREA

xxxx-KEY-AREA (optional)

Explanation

This command locates a row that has the same key as the one specified in the xxxx-KEY-AREA parameter. If the xxxx-KEY-AREA parameter is omitted, the key is taken from the key location in the xxxx-ROW-AREA parameter.

Return value

If the row is found, FOUND is set to Y, a copy of the row is moved into xxxx-ROW-AREA and COUNT is set to the subscript of the fetched row. If the requested row is not found in the table, FOUND is set to N and the COUNT contains the appropriate subscript for a potential insertion.

Notes

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

Exceptions

None

See also

Date-sensitive processing

3. FOUND (1 byte)

8. COUNT (fullword binary)