IFDREC (HLI function)

From m204wiki
Revision as of 22:12, 12 July 2016 by ELowell (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The conventions used on this page are described in Function call notation conventions.

Summary

Description
The IFDREC call (DELETE RECORD) deletes the current record from its file.
Thread type
multiple cursor IFSTRT, single cursor IFSTRT
IFCALL function number
19

Syntax

IFDREC(RETCODE,CURSOR_NAME)

Compile-only form
Not available
Execute-only form
Not available

Specify the parameters in the syntax order shown above.

Parameter Description
RETCODE [O,i,r] The Model 204 return code is the required first parameter. The code is a binary integer value.

If the IFDREC call is unsuccessful, Model 204 returns an error completion code of 4 if there is no current record.

CURSOR_NAME [I,s,r] The name of the cursor is an input parameter that is available only for use with a multiple cursor IFSTRT thread, and it is required for specifying the current record to be deleted. Specify the cursor name as a short character string, using the name previously assigned to the cursor in a corresponding IFOCUR call. See CURSOR_NAME in IFOCUR for a description of the cursor name.

Note: The cursor name is not a valid parameter for use with a single cursor IFSTRT thread.

Usage notes

Use the IFDREC call to delete a record from a file.

Note: You cannot use IFDREC with a sorted record set.

When FOPT=X'10' and the date/time stamp feature is installed, the IFDREC function is supported for DTS files.

IFDREC reclaims the file storage space that is occupied by the deleted record and allows the record numbers to be reused. In order to reuse record numbers from records that will be deleted, first use the IFDVAL call to eliminate any INVISIBLE fields in the record, then use IFDREC to delete the record.

The IFDREC call is valid on all types of IFSTRT threads. On a multiple cursor IFSTRT thread, you must specify the cursor name whose current record is to be deleted. On a single cursor IFSTRT thread, IFDREC deletes the current record from the current record set.

Note: There is another call, IFDSET, that also deletes records from a file and executes faster than IFDREC but does not reclaim storage space.

Coding example (COBOL)

WORKING-STORAGE SECTION. 01 ARGS-FOR-CALL. 05 RETCODE PIC 9(5) COMP SYNC. . . . 05 CURSOR-NAME PIC X(7) VALUE "CRFORD;". . . . PROCEDURE DIVISION. . . . CALL "IFDREC" USING RETCODE, CURSOR-NAME.

Note: In the example, IFDREC deletes a field on a multiple cursor IFSTRT thread. The IFDREC call references the cursor (named CRFORD) that was opened to a found set by a previous IFOCUR call (not shown) and deletes the record that was last fetched. See the coding example for IFOCUR.