Published By | Date | Version | Knowledge Level | Keywords |
---|---|---|---|---|
Revelation Technologies | 14 NOV 1989 | 2.X | EXPERT | INDEX.OPEN |
INDEX.OPEN is an external function which attempts to open the index file specified and return a file variable for the index. The index file must exist in an attached volume.
The name of the index (! prefix) file to open, or a file specification consisting of a source datafile name, associated account name, and media name. The media name is stored in the first field of a specified record in the VOLUMES file. The account name is stored in the third field of a specified record in the FILES file. These names must be delimited by * (asterisk).
A variable to be associated with the file
If the index file was opened successfully, INDEX.OPEN returns true and passes the file variable assigned to file in filevar, otherwise INDEX.OPEN returns false.
*Initialization for each example DECLARE FUNCTION INDEX.OPEN DECLARE SUBROUTINE MSG *Open the specified index (! prefix) file STATUS = INDEX.OPEN('!CUST',FILEVAR) MSG('STATUS = %1%|FILEVAR = %2%','','',STATUS:@FM:FILEVAR) *Get the media name and open the index file associated with the *datafile specification FILE = 'CUST' ACCOUNT = 'SYSPROG' OPEN 'VOLUMES' TO VOL.FILE THEN READ VOL.REC FROM VOL.FILE,VOLUME ELSE STOP MEDIA = VOL.REC<<1>> FILE.SPEC = FILE:'*':ACCOUNT:'*':MEDIA STATUS = INDEX.OPEN(FILE.SPEC,FILEVAR) MSG('STATUS = %1%|FILEVAR = %2%','','',STATUS:@FM:FILEVAR) END