IFRNUM (HLI function)

From m204wiki
Jump to navigation Jump to search

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

Summary

Description
The IFRNUM call (EXTRACT RECORD NUMBER) returns the number of the current record in the specified cursor in an output parameter.
Thread type
multiple cursor IFSTRT
IFCALL function number
121

Syntax

IFRNUM(RETCODE,CURSOR_NAME,RECNUM)

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.
CURSOR_NAME [I,s,r] Is a required input parameter that specifies the name of the cursor whose record number is to be returned. This is a short character string, the name previously assigned to the cursor in a corresponding IFOCUR call.

See the description of CURSOR_NAME for the IFOCUR call.

RECNUM [O,c,r] Is a required output parameter that returns the number of the current record for the specified cursor. Specify a character string variable. Model 204 returns a number in display format, up to eleven characters in length.

Usage notes

Use the IFRNUM call to access the internal number of the record, that is, the database record number, at the location where the specified cursor is currently positioned.

The IFRNUM call is the equivalent of the $Currec function in SOUL in the multiple cursor environment.

IFRNUM returns a -1 for the current record number (RECNUM) to indicate that there is no current record for the specified cursor. This result occurs if no fetch is issued or if an IFRELA call was issued to release the record set.

Note: To successfully issue the IFRNUM call, you must specify a cursor that meets both of the following requirements:

  • The cursor was declared in a previously compiled IFOCUR call on the thread. See the IFOCUR (open cursor) call.
  • The cursor is open.

Coding example (COBOL)

WORKING-STORAGE SECTION. 01 CALL-ARGS. 05 RETCODE PIC 9(5) COMP SYNC. 05 RECNUM PIC X(11). 05 CURNAME PIC X(4) VALUE "CR1;". . . . PROCEDURE DIVISION. . . . CALL "IFRNUM" USING RETCODE, CURNAME, RECNUM.