RALF (Restricted Access to Locked Files) is a set of routines that allow the caller to open, obtain header information about, and optionally read records from a file that is already locked by RMS (typically while another user has it open for write).
The information in this document is subject to change without notice and should not be construed as a commitment by anyone.
The software described in this document is provided as is. No guarantee is made to the suitability, reliability, security, usefulness, performance or good taste of this software.
Email addresses: ralf at tomwade.eu or ralf at beyondthepale.ie
Availability: Permission is granted to use, copy, and distribute this program in any form as long as:
Please contact the authors for permission to incorporate the program or a work derived from it into a commercial product for sale, lease, rent etc.
Please advise the authors of any modifications or improvements in order that they may be considered for incorporation in a future release. Modified versions should be clearly distinguished from the original before being distributed.
Contents |
RALF is written in Macro32, but can be called by any language using the VMS calling standard. Include files defining constants are provided for Fortran, Pascal, Basic, and C.
RALF is provided both as an object library (.OLB) and shareable image (.EXE), along with full sources. Sample programs that use the RALF calls are also provided.
RALF runs on OpenVMS VAX, OpenVMS Alpha, Integrity (Itanium) and OpenVMS X86.
$ UNZIP :== $SYS$DISK:[]UNZIP $ UNZIP RALF024 $ |
File | Purpose |
---|---|
RALF.PS | Postscript documentation |
RALF*.HTML | HTML documentation files |
RALF.TXT | Text documentation |
RALF.PDF | PDF documentation |
RALF.SDML | Documentation source |
BUILD.COM | Command procedure to compile & link. |
RALF_VAX.EXE | VAX shareable image. |
RALF_ALPHA.EXE | Alpha shareable image. |
RALF_IA64.EXE | Integrity shareable image. |
RALF_X86.EXE | X86 shareable image. |
RALF_VAX.OLB | VAX object library. |
RALF_ALPHA.OLB | Alpha object library. |
RALF_IA64.OLB | IA64 object library. |
RALF_X86.OLB | X86 object library. |
RALF_LINK.OPT | Option file for linking caller applications. |
RALF_STARTUP.COM | Startup file. |
RALF.MAR | Macro32 source file. |
RALFLIB.MLB | Macro symbol definition library. |
RALFDEFS.* | Symbolic constants for various languages. |
PEEK.* | Sample PEEK program with sources. |
FILEINFO.* | Sample FILEINFO program with sources. |
2.5 Postinstallation Tasks
The RALF_STARTUP.COM file should be called from the System startup file
(SYSTARTUP_VMS.COM). Note that this is not required if you wish to link
applications using the object library rather than the shareable image.
2.6 Sample Installation
The following shows a sample installation using the VMSINSTAL facility.
$ @sys$update:vmsinstal OpenVMS Software Product Installation Procedure V8.3 It is 8-DEC-2020 at 14:00. Enter a question mark (?) at any time for help. * Are you satisfied with the backup of your system disk [YES]? * Where will the distribution volumes be mounted: us$:[twade.ralf] Enter the products to be processed from the first distribution volume set. * Products: ralf * Enter installation options you wish to use (none): The following products will be processed: RALF V2.4 Beginning installation of RALF V2.4 at 14:00 %VMSINSTAL-I-RESTORE, Restoring product save set A ... ******************************************************************************* * Ralf V2.4 * * * * by Peter Coghlan & Tom Wade * ******************************************************************************* %VMSINSTAL-I-RESTORE, Restoring product save set B ... %VMSINSTAL-I-RESTORE, Restoring product save set C ... %VMSINSTAL-I-RESTORE, Restoring product save set D ... * Do you want to purge files replaced by this installation [YES]? y You must specify a directory in which RALF files are stored. If the directory does not exist, the installation procedure will create it. * Directory for RALF files [SYS$SYSDEVICE:[RALF]]: sw$:[ralf] The documentation for RALF is in DecDocument. The documentation source is provided, along with generated output in HTML, Postscript and plain text. All questions regarding the installation have been asked. The installation will now continue without the need for further operator intervention %VMSINSTAL-I-SYSDIR, This product creates system disk directory SW$:[RALF]. %VMSINSTAL-I-MOVEFILES, Files will now be moved to their target directories... Installation of RALF V2.4 completed at 14:01 Adding history entry in VMI$ROOT:[SYSUPD]VMSINSTAL.HISTORY Creating installation data file: VMI$ROOT:[SYSUPD]RALF024.VMI_DATA Enter the products to be processed from the next distribution volume set. * Products: |
$ @BUILD |
which will rebuild the the object files for the current architecture (VAX, Alpha, Integrity or X86). Note that you will have to execute this command on each architecture to build the complete object set.
Usage:
status = RALF_Open (context, filespec, [default_filespec], [itemlist])
Argument | Data Type | Access | Mechanism |
---|---|---|---|
context | Longword | Write | Address |
Filespec | Character | Read | Descriptor |
Default Filespec | Character | Read | Descriptor |
Itemlist | Data Structure | Read/Write | Address |
Context
Address of a longword integer into which RALF_Open returns a context variable. This context variable is used in subsequent read or close calls. You may have several files opened by Ralf simultaneously, using the context variable to specify which file is the target of the read or close operation.
Filespec
File specification of the file to be opened.
Default Filespec
Specifies a partial file specification, the fields of which are used to fill in any unspecified fields of the Filespec argument. This argument is optional.
Itemlist
Optional argument allowing you to specify additional information to Ralf, or to return information from the file's file header. See the section on Obtaining File Header Information for a full description of this argument.
3.1.2 Description
This routine makes a call to the File ACP to open the specified file,
rather than use an RMS $OPEN call, allowing the routine to open a file
that has been opened exclusively by RMS. The routine will translate the
file specification into a device name and File ID (FID), which is then
passed to the ACP for the open operation.
3.1.3 Return Values
Return Value | Description |
---|---|
SS$_NORMAL | Normal successful completion |
SS$_UNSUPPORTED | Attempt to open a non sequential file |
SS$_INSFARG | Caller must specify at least 2 arguments |
SS$_TRU | Device name truncated |
SS$_IVBUFLEN | Optional Buffer size must be at least 1 block |
SS$_BADPARAM | Invalid size specified for an item |
SS$_TOOMUCHDATA | List is more than 29 items or no terminator |
Other error | returned by System Service |
Usage:
status = RALF_Close (context)
Argument | Data Type | Access | Mechanism |
---|---|---|---|
context | Longword | Read | Address |
Address of a longword integer containing the Ralf context. This context must have been returned by a previous call to Ralf_Open or Ralf_Openbyfid.
3.2.2 Description
This routine deaccesses the file, deassigns the channel, releases the
event flag and frees allocated buffer memory.
3.2.3 Return Values
Return Value | Description |
---|---|
SS$_NORMAL | Normal successful completion |
SS$_INSFARG | Missing context argument |
Other error | as returned by system services |
Usage:
status = RALF_Read_Record (context, buffer, [length])
Argument | Data Type | Access | Mechanism |
---|---|---|---|
context | Longword | Read | Address |
Buffer | Character | Write | Descriptor |
Length | Longword | Write | Address |
Context
Address of a longword integer containing a context returned by a previous call to Ralf_Open or Ralf_Open_By_Fid.
Buffer
Address of a character string buffer into which Ralf will return the record.
Length
Address of a longword into which Ralf will write the length (in bytes) or the record returned.
3.3.2 Description
This routine will return the next record from the opened file. It will
use the file header information to determine the nature of the RMS
record structure in the file. For example for a variable length
sequential file Ralf will interpret the first two bytes as a record
length indicator, or will look for a record terminator in a stream
file, or will simply return the next count of data for a fixed record
file. It will also skip over the null byte inserted by RMS to ensure
records begin on a word boundary.
Return Value | Description |
---|---|
SS$_NORMAL | Normal successful completion |
SS$_ENDOFFILE | No more data in file |
SS$_TRU | Data truncated as buffer too small |
SS$_UNSUPPORTED | Ralf could not determine the record format |
Other error | as returned by System Services |
3.4 Ralf_Name_To_Fid
Convert a file name to File Identifier (FID).
Usage:
status = RALF_Name_To_FID (device, ldev, fid, filespec, [default_filespec])
Argument | Data Type | Access | Mechanism |
---|---|---|---|
Device | Character | Write | Descriptor |
Ldev | Longword | Write | Address |
FID | 3 Word array | Write | Address |
Filespec | Character | Read | Descriptor |
Default_Filespec | Character | Read | Descriptor |
Device
Name of the disk device on which the file resides.
Ldev
Length of the device name string returned in 1st argument.
FID
Address of a 3 word array in which the File Identifier (FID) is returned.
Filespec
Name of the file (including directory path).
Default Filespec
Default file specification. This argument is optional. If provided, it is combined with the filespec argument to provide any unspecified fields.
3.4.2 Description
The File ACP accesses files using a File Identifier. This is a data
structure 3 words (6 bytes) long. This routine translates a file
specification string into a device name and File ID.
The output of this routine may be used in a call to the
Ralf_Open_By_Fid routine. Alternatively, you can call the Ralf_Open
routine directly specifying a single file specification.
3.4.3 Return Values
Return Value | Description |
---|---|
SS$_NORMAL | Normal successful completion |
STR$_TRU | Device name truncated to fit in user argument |
SS$_INSFARG | Caller passed less than four arguments to routine |
Usage:
status = RALF_Open_By_FID (context, device, fid, [itemlist])
Argument | Data Type | Access | Mechanism |
---|---|---|---|
context | Longword | Write | Address |
Device | Character | Read | Descriptor |
FID | 3 Word array | Read | Address |
Itemlist | Data Structure | Read/Write | Address |
Context
Address of a longword integer into which RALF_Open_By_FID returns a context variable. This context variable is used in subsequent read or close calls. You may have several files opened by Ralf simultaneously, using the context variable to specify reach file is the target of the read or close operation.
Device
Name of the disk device on which the file resides.
FID
Address of a 3 word array containing the File I/D.
Itemlist
Optional argument allowing you to specify additional information to Ralf, or to return information from the file's file header. See the section on Obtaining File Header Information for a full description of this argument.
Next | Contents |