Topic: APLX Help : Help on APL language : System Functions & Variables : ⎕FTIE Open an existing file
[ Previous | Next | Contents | Index | APL Home ]

www.microapl.co.uk

⎕FTIE Open (tie) an existing file for exclusive use


The ⎕FTIE and ⎕FSTIE functions open ('tie') an existing component file. The syntax is:

      FILENAME ⎕FTIE TIENO {PASS}

or:

      FILENAME ⎕FSTIE TIENO {PASS}

If you tie the file using ⎕FTIE, it is tied for exclusive use and no other users or tasks will be able to tie it until you untie it. If you tie it using ⎕FSTIE, other tasks and/or users can also tie it using ⎕FSTIE.

FILENAME is a character vector specifying the name of the file to tie, following the same rules as ⎕FCREATE. The name may be specified in either of two ways. If the name contains a directory-separator character (: / or \), it is treated as a full host path name, and you need to specify the file extension, by convention .aqf. Otherwise it is treated as basic file name only, optionally preceded by a volume number 0 to 9, separated by one or more spaces from the name. In the latter case, the file is searched for in the directory 0 to 9 specified (the actual path is set the preferences dialog or ⎕MOUNT), and the file extension .aqf is added automatically.

TIENO is an arbitrary non-zero integer to be used in subsequent read/write operations to identify the file (the tie is exclusive). The tie number must not currently be in use to tie another file. Alternatively, you can provide a tie number of 0, in which case APLX automatically allocates the next available unused tie number, and returns it as the explicit result of the function.

The optional PASS parameter is a pass number. If you use this parameter, it must match one of the valid pass numbers for your user ID set in the access matrix (see the discussion of ⎕FSTAC below), and you must use the same pass number in all subsequent operations until you untie the file.

For example:

Exclusive-tie the file RUN3.aqf in library 0, under tie number 2:

      'RUN3' ⎕FTIE 2

Share-tie the file RUN4.aqf in library 1, allowing APLX to allocate the tie number:

      'RUN3' ⎕FSTIE 0
3

Share-tie the file c:\temp\RUN3.aqf, allowing APLX to allocate the tie number and using pass number 33421:

      'c:\temp\RUN3.aqf' ⎕FSTIE 0 33421
4

If you try to tie a file which is already tied for exclusive use by another user or task, APLX will retry for a few seconds in the hope that the tie will be released. If this does not occur, the operation will fail with error code 24 in ⎕LER, or ⎕ET:

      'RUN3' ⎕FTIE 2
FILE OR COMPONENT HELD
      'RUN3' ⎕FTIE 2
      ^
      ⎕LER
24 0
      ⎕ET
6 5

Files are untied automatically when an APLX task ends. They are NOT untied when you )CLEAR the workspace or )LOAD another workspace.

Special considerations for Client-Server implementations of APLX

See ⎕FCREATE for details on how component files can be located on either the Client or Server machine.

Mixing 32-bit and 64-bit Component Files

If you are running both 32-bit and 64-bit versions of APLX, then it is possible to share component files between the two architectures, but there are some special points you should be aware of. See the introduction to the ⎕Fxxx Component File System for details.


Topic: APLX Help : Help on APL language : System Functions & Variables : ⎕FTIE Open an existing file
[ Previous | Next | Contents | Index | APL Home ]