Description

Compresses overflow in a table; fixes Group Format Errors (GFEs); increments, decrements, resizes the sizelock for a table; defines a new threshold for a linear hash (OpenInsight) table.

Syntax

Fix_LH (tablename, fixtype, lockflag[, fourthparam])

Parameters

The first three parameters, defined in the "Subfunctions" section, are identical regardless of fixtype. The fourth parameter varies according to subfunction. Refer to the "Sizelock" section following the next two tables for more information about the Sizelock parameter.

A table must be attached to run the Fix_LH stored procedure against it.

ParameterDescription
tablenameThe name of the table on which to perform an operation. The operation performed is specified in fixtype.
Fixtype

Four operations can be performed against a table. The list below describes the code to assign to fixtype and the operation that is performed.

ValueDescription
1Compress the overflow for a table.
2Fix a GFE.
3Increment or decrement the sizelock for a table.
4Specify a new threshold for a table.
5Specify a particular sizelock.
LockflagIf true (1), the table is locked before it is fixed.

Subfunctions

There are five Fix_LH subfunctions which are listed in the following table.

Purpose of SubfunctionSyntax
Compress overflowFix_LH (tablename, fixtype, lockflag)

The compression operation removes empty frames in the .OV portion of a file. If empty frames exist, the size of the .OV file will be smaller when this operation completes.

Fix GFE's

Fix_LH(... grouprangelist)

ParameterDescription
grouprangelistThe group or range of groups to fix in the table. If null, the engine attempts to fix the entire table. To fix a range of groups, pass a list in grouprangelist. For example, for groups 1-4, 7-9, 11-20, grouprangelist would be in the form: 1@VM4@FM7@VM9@FM11@VM20
Change sizelock

Fix_LH(... modifierflag)

ParameterDescription
modifierflag

To increment or decrement the sizelock, set modifierflag to one of the codes in the list below. If null, 0 is used.

modifierflagDescription
0Decrement the sizelock by 2 (default).
1Increment the sizelock by 2.

If the original sizelock of the table is less than 2, the sizelock is incremented or decremented by 1 instead of 2.

Set sizelock

Fix_LH(... newsizelock)

ParameterDescription
newsizelockPass any absolute value by which to set the sizelock.
Set threshold

Fix_LH(... newthreshold)

ParameterDescription
newthresholdSpecify a value for newthreshold, using a numeric value between 10 and 100. This number is a percentage indicating how full the Primary Space must be before the file is resized.

Sizelock

The sizelock parameter is used to control the automatic resizing of the primary address space. A sizelock of "0" indicates that a table should be allowed to expand as more rows are entered, and become smaller as rows are deleted. A sizelock of "1" indicates that a table should be allowed to expand, but should not become smaller. This is useful in cases of a presized table, when a preliminary expectation is for the table to hold 1000 rows, but more rows may be added. If a sizelock is set to "2" or more, the table is not allowed to expand or contract. A sizelock of "2" is very important during a select operation executed on a network, when one user is searching a table for information while another user is entering new data.

OpenInsight increments the sizelock by 2 for the duration of the select operation. If another user is adding information, it is possible that the system could determine that a table needs to be resized. If this were to occur during a select operation, the process might yield unpredictable results: rows that have not yet been evaluated might be skipped, or rows might be processed more than once. Because the sizelock is "2," no resizing takes place. Once the process is finished, the sizelock is decremented by 2, restoring it to the table's original sizelock value. While the table might now be slightly out of size, the addition or deletion of another row will result in correct resizing.

Remark

Not all methods of the Fix_LH routine can be used on a table controlled by the LH Service.

See also

LockUnLockVerify_LH

Example

The following examples illustrate operations on linear hash files, using Fix_LH.

/* Locks the CAR_PARTS table and compresses the overflow portion of the table. */
Fix_LH("CAR_PARTS" "1", "1")
If Get_Status(ErrCodes) Then
       GoSub ErrorHandling
End
* Locks CAR_PARTS and fixes groups 1 and 4 through 7.
Fix_LH("CAR_PARTS", "2", "1"', ["1", ["4", "7"] ])
If Get_Status(ErrCodes) Then
       GoSub ErrorHandling
End
* Locks CAR_PARTS table and decrements the sizelock by 2.
Fix_LH("CAR_PARTS", "3", "1", "0")
If Get_Status(ErrCodes) Then
       GoSub ErrorHandling
End
* Locks CAR_PARTS, and changes the threshold to 90%.
Fix_LH("CAR_PARTS","4", "1", "90")
If Get_Status(ErrCodes) Then
       GoSub ErrorHandling
End
  • No labels