GDSX (Extended General Device Support) Manual
Service Routines
Extended General Device Support (GDSX) Manual—529931-001
8-27
^FILE_OPEN_
•
^Open is called in the primary process; hence, it is optional to provide the following
parameters:
°
primary file_id
°
primary process_id
°
primary block buffer
°
primary block length
•
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
BEGIN
DISKNAME ':=' ["$XYZ SOME FILE "];
CALL ^FILE_OPEN(DISKNAME, DISKFILE, ...);
IF < THEN
BEGIN
.
produce suitable error message
.
CALL ^TERMINATE;!Stop GDSX process
END;
END;
END;
PROC DEVICE^HANDLER(FILE, ME, TYPE);
BEGIN
.
IF PSEM(DISKSEM, 200D) THEN
BEGIN
CALL ^READ(DISKFILE, BUFFER, ....);
IF = THEN
CALL ^AWAITIO(DISKFILE,....);
IF <> 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.