tldm-universe/Ardent/UV/APP.PROGS/RLS.FILE.B

97 lines
3.3 KiB
Plaintext
Raw Normal View History

2024-09-09 21:51:08 +00:00
******************************************************************************
*
* RLS.FILE.B - Release a file opened in named common by OPEN.FILE.B
* (catalog name RELASE$UV$FILE)
*
* Module %M% Version %I% Date %H%
*
* (c) Copyright 1998 Ardent Software Inc. - All Rights Reserved
* This is unpublished proprietary source code of Ardent Software Inc.
* The copyright notice above does not evidence any actual or intended
* publication of such source code.
*
*******************************************************************************
*
* Maintenence log - insert most recent change descriptions at top
*
* Date.... GTAR# WHO Description........................................
* 10/14/98 23801 SAP Change copyrights.
* 11/04/92 10327 WLC Updated comments.
* 10/12/92 10327 WLC Initial Release.
*******************************************************************************
*
* This subroutine preceeds a standard UniVerse BASIC RETURN
* statement. It checks a table to see if any files
* were opened by this routine, and if so issues a RELEASE on them.
* It determines which files were opened by locating variable stamps
* with the unique id setting associated with this source file.
*
SUBROUTINE RELEASE$UV$FILE(UNIQUE.ID)
*
* UNIQUE.ID : string containing the unique id used for the calling source.
* # is unique for each source program.
* (See OPEN.UNIQUE file in /.uvhome)
*
*
* Equates
*
* TABLE.MAX: This is the MAXIMUM number of entries that ONE
* user can make. Basically, the maximum number
* of files that can be "held" open.
*
$INCLUDE UNIVERSE.INCLUDE OPEN.TOOLS.H
*
$OPTIONS PICK
* Declare named common
*
COMMON /UV$open$files/ FILE$VARS(TABLE.MAX),FILE$TABLE(5),curr$UV$ACCOUNT
*
* FILE$VARS : contains actual filevars that are returned
* FILE$TABLE : 5 elements
* element 1 : list of opened file names ascending left (multi valued)
* element 2 : pointer into file$vars array (multi valued)
* element 3 : current number of open files (single value)
* element 4 : file open requests (multi valued)
* element 5 : variable stamp - unique identifier for the variable name
* used in open call. (multi valued)
*
* curr$UV$ACCOUNT : the name of the account in which these files
* were opened.
*
*
* Equates
*
EQU FILES.NOW.OPENED TO FILE$TABLE(1) ;* list of file names
EQU TABLE.POINTER TO FILE$TABLE(2) ;* list of pointers to FILE$VARS
EQU TABLE.COUNTER TO FILE$TABLE(3) ;* next available FILE$VAR entry
EQU OPEN.REQUESTS TO FILE$TABLE(4) ;* list of # of open requests
EQU VARIABLE.LIST TO FILE$TABLE(5) ;* list of variable stamps
EQU NO TO 0
EQU YES TO 1
*
* Find the unique id in the list of variable stamps to determine which files
* to release.
*
NUM.ENTRIES = count(VARIABLE.LIST,@VM)+1
if VARIABLE.LIST # 0 then
for i = 1 to NUM.ENTRIES
loc.id = len(VARIABLE.LIST<i>) - len(UNIQUE.ID)
cnt=1
next.cnt:
loc.ix = index(VARIABLE.LIST<i>, "_":UNIQUE.ID,cnt)
if loc.ix and loc.ix = loc.id then
RELEASE FILE$VARS(TABLE.POINTER<i>)
end else cnt+=1; goto next.cnt
next i
end
*
* Return to calling program
*
return
*
* End of subroutine
*
END