IFOPENX (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 IFOPENX call (OPEN EXCLUSIVE) opens the specified file or group, enqueuing in exclusive mode.
Thread type
multiple cursor IFSTRT, single cursor IFSTRT
IFCALL function number
35

Syntax

IFOPENX|IFOPNX(RETCODE,FILE_SPEC,TIME)

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 a required output parameter. The code is a binary integer value.
FILE_SPEC [I,c,r] The file specification is a required parameter that specifies the file or group to be opened. Specify a character string. See FILE_SPEC for a detailed description of the file specification used for IFOPEN that is also valid for IFOPENX.
TIME [I,i,r] The time is a required parameter that specifies the wait time (in seconds). Specify an integer value.

Usage notes

Use the IFOPENX call before any data records are accessed to open a file or group. When IFOPENX is called, the named file or group becomes the current file or group. IFOPENX performs the same operations as IFOPEN; however, IFOPENX enqueues on the file in exclusive rather than in share status.

IFOPENX prevents any other user from accessing the file until the current user closes it. If you issue IFOPENX for a group, all files in the group are enqueued upon in exclusive status and the group itself is enqueued upon in share status. For more information about enqueuing, see Concurrency control and locking mechanisms.

If the first attempt to enqueue on a file fails, Model 204 waits the number of seconds specified in the TIME parameter, then it tries again. If the second attempt fails, Model 204 returns a completion code of 3 to the HLI program.

Coding examples (COBOL)

The COBOL coding example below opens a file using the IFOPENX call. The file is called FILEB and requires a password of OURSECRET. (In this example, the group name FILEB does not exist.)

WORKING-STORAGE SECTION. 01 ARGS-FOR-CALL. 05 RETCODE PIC 9(5) COMP SYNC. 05 FILE-INFO PIC X(15) VALUE `FILEB;OURSECRET;'. 05 TIME PIC 9 COMP SYNC VALUE 3. . . . PROCEDURE DIVISION. . . . CALL "IFOPENX" USING RETCODE, FILE-INFO, TIME. . . .