GDSX (Extended General Device Support) Manual

Service Routines
Extended General Device Support (GDSX) Manual529931-001
8-52
^OPEN
^OPEN
By calling the ^OPEN procedure, one task can establish a communication path
between all user tasks and a file. ^OPEN may be called whether USCODE is
converted or unconverted.
Except for the following considerations, the syntax, condition code settings, and
considerations regarding this procedure are the same as the OPEN procedure in the
Guardian Procedure Calls Reference Manual.
Considerations
Calling ^OPEN in a nowaited mode causes the calling task to be suspended.
Because the working stack images of tasks are swapped to and from an extended
data segment during I/O operations, I/O must be performed to and from global
buffers.
If the flags parameter is supplied and bit 8 is set for a nowaited call, USCODE
should not issue a subsequent ^AWAITIO. TSCODE takes care of issuing an
AWAITIO to Guardian to return the information to the calling task. No additional
user code is necessary to complete the call.
^OPEN does not support PFS buffering; ^FILE_OPEN_ does support PFS
buffering.
When a user task calls ^OPEN, the resulting open may be private to that task or
public to all tasks in the GDSX process. The distinction made by TSCODE is
based on the address of the filenum parameter passed to ^OPEN: if the address is
local to the task or is in the upper 32K words of the user data segment, the open is
considered private; if the address is in user globals or the buffer pool (anywhere
below %73000), the open is considered public.
For the purpose of editing input data, it may be desirable to read disk files within
GDSX. Because the maximum nowait depth for disk files is 1, at most one nowait
I/O can be in process on a single open of a disk file. Multiple tasks use a
semaphore to control access to the publicly opened file in this example:
INT
DISKFILE,
.DISKSEM[0:3],
.DISKNAME[0:11];
.
PROC USER^INITIALIZE(PRIMARY);
INT PRIMARY;
BEGIN
DISKSEM[0] := DISKSEM[1] := DISKSEM[2] := 0;
CALL INIT^SEM(DISKSEM);
IF PRIMARY THEN
Caution. When a user task stops, TSCODE automatically closes all of the task’s private
opens but leaves public opens open, because other tasks may be using them.