AFS-CONTRACT
Contracts a file data section or index that is configured for automatic file sizing (AFS file).
Syntax
AFS-CONTRACT file-specifier {index-name} {( [ B | percentage ]}
Syntax Elements
file-specifier Specifies the required data section or the data section containing the required index.
See General Conventions for the full syntax of file-specifier.
index-nameOptional. The name of the required index.
Options
BRun as a background process (recommended for contracting large files and indexes). A background AFS-CONTRACT continues when the user logs off.
percentageThe percentage by which to contract the data section or index. The default, if this parameter is omitted, is to contract to the current modulo; that is, by removing all the groups appended to the file. If there are no appended groups, the modulo is halved and the AFS file is contracted to the new modulo.
Restrictions
Can only be run by the database owner.
Operation
AFS-CONTRACT contracts an AFS file by reversing the expansion process. Groups appended to the file are removed and the data they contain is reintegrated into the remaining groups. When the number of groups falls below the current modulo, the modulo is halved. Note, however, that if the current modulo is an odd number it cannot be halved. Therefore, once any appended groups have been removed, an AFS file with an odd modulo cannot be contracted any further.
Comments
A process performing sequential access to an AFS file (for example, COUNT, LIST or SELECT) while it is being contracted may get incorrect results (for example, missing or duplicate items). AFS-CONTRACT should therefore be used with caution. It is recommended that it be used only when the required data section or index is not being accessed by other processes.
You can stop AFS-CONTRACT at any time
provided the BREAK key has not been disabled. Press the BREAK key and then
enter
END
to exit the DataBasic debugger. Note that if you want
to restart the contraction process, you will need to use
the ISTAT command to find out how much
of the contraction has completed.
Examples
The default data section of the AFS file MYAFSFILE has a current modulo of 126 and has expanded to 140 groups. This is then contracted by 50% as follows:
AFS-CONTRACT MYAFSFILE (50
On completion, the file will have 70 groups and the modulo will have been halved to 63.
If the file is then contracted by a further 50%, all the expansion groups will be removed, reducing the number of groups to 63. Contraction will then stop, because the odd numbered modulo cannot be halved.