Topic: APLX Help : Help on APL language : APL Primitives : ⍐ File hold
[ Previous | Next | Contents | Index | APL Home ]

www.microapl.co.uk

File hold


One-argument form

in one-argument form alters the file allocation quota (how much the file may 'hold'). When a file is first created it is restricted to a given size. (This size will vary from system to system). The file allocation quota may be examined via 2⍇. A file may be created by reading the file allocation quota. A file so created will have no components.

The general form is ({} means optional):

             R ← ⍐ {[LIBRARY]} FILE,ALLOCATION {,USER,PASSWORD}

A file number of 0 means change the default allocation given to all new files. returns the old value of the allocation quota.

             ⍐[1] 120 200000         (The file allocation quota of file 120 on
       50000                          library 1 is to be raised to 200000 bytes)
             ⍐[2] 0 100000           (The default file allocation on library 2 is
       50000                          to be increased to 100000 bytes)

Two-argument form

This more common form of allows file access by other users in a shared file system temporarily to be suspended. While a hold is in effect at the component or file level, the user issuing the successful hold is granted exclusive access to the held component or file to perform his file update(s). The general form of the command is:

             R←A ⍐ {[LIBRARY]} FILE,COMPONENT {,USER NO,PASSWORD}

For a component number of 0 the entire file is held. The left argument A determines the strength of the hold:

       0       means release the component or file, removing a previous hold
       1       means restrict write access by others
       2       means restrict read and write access by others
             1 ⍐[1] 120 3            (Restrict write access to component 3
        1                             of file 120 on library 1)
             2 ⍐ 98 0                (Restrict read/write access to whole
        1                             of file 98 on library 0 (default))
             0 ⍐[1] 120 3            (Release component 3 of file 120
        1                             on library 1)
             0 ⍐ 98 0 1000           (Release file 98 on library 0, file
        1                             belongs to user 1000)

In two-argument form, returns a 1 if the operation was successful, 0 otherwise.

Effect of Access Matrix on Hold Operation

Some file operations are not affected by the function, and some others are blocked even to the holder. The following table illustrates:

        Operation                               Effect of Hold
                                          File Hold     Component Hold
        Read components                      2                2
        1⍇ 2⍇                                2                0
        3⍇                                   2                2
        Insert Components                   1+2               N
        Append Components                   1+2               0
        Replace Components                  1+2              1+2
        Delete a File                       1+2               N
        Delete a Component                  1+2               N
        Set File Allocation                 1+2               N
        Rename                              1+2               N
        Hold/Release File                   1+2               N
        Hold/Release Components             1+2              1+2
        6⍇ 7⍇                                0                0
        Read Access Matrix                   2                0
        Write Access Matrix                 1+2               N

where:

       0   means the operation is not affected by a hold
       2   means  that  when  the  hold strength is 2  (read  and  write  held),
           only  the  holder  may perform the operation.   For  components,  the
           block is only on the held components
      1+2  means  that  when the hold strength is 1 or 2,   only the holder  may
           carry out the operation.  Again, for components, the block is only on
           the held components
       N   means that when the hold strength is 1 or 2, no one may carry out the
           operation

Topic: APLX Help : Help on APL language : APL Primitives : ⍐ File hold
[ Previous | Next | Contents | Index | APL Home ]