# Historical File Splitting

Maintenance Methods |

This table lists the maintenance methods used with the Historical File Splitting utility:

Method | Description
Open(pathname$) | Opens file whose historical file split information is to be edited/defined.
AddSegment(pathname$[,condval$]) | Creates a new active segment. This function automatically converts a non-split file into a split file when the first active segment is created. The file specified in pathname$ does not have to exist; the system will create it automatically. If the split file has a conditional test field defined, you need to pass the condition values that will cause records to be added to this segment. If no conditional test field exists, it will set the segment that was currently active as updatable, the new segment as able to receive new records, and all other segments will be set as locked/read only.
GetSegmentCount( ) | Returns the number of segments/files (0 if not split).
DropSegment(segment) | Removes file/segment by Index. If removing the last segment, the file is reverted back to a non-splitting format.
LockSegment(segment) | Sets the specified segment as locked (no updates allowed).
UnLockSegment(segment) | Sets the specified segment as unlocked (updatable). Current/last added segment is always updatable and is where all new records will be placed.
isSegmentLocked(segment) | Returns true (non-zero) if specified segment is locked. Returns false if it is not locked.
SetTestField(fieldDesc$) | Defines the field to test when adding records. fieldDesc$ may contain a simple field name or field name with offset/length in standard PxPlus format. Example: DateCreated$(1,4)
GetTestField$( ) | Returns the field tested when adding records. Will return "" if not specified.
SetSegmentTest(segment,condVal$) | Changes conditional field test value(s).
GetSegmentTest$(segment) | Returns conditional field test value(s) for the given segment.
SetSegmentPath(segment,NewPath$) | Changes/renames pathname.
GetSegmentPath$(segment) | Returns pathname for the given segment.
GetSegmentTime$(segment) | Return the date/time that the given segment was added. The format is YYYY-MM-DD hh:mm:ss.
GetKeySortSeq(keyno) | Returns 1 if the specified key number is marked as Ascending, -1 if marked as Descending; otherwise, returns 0 (zero) if not specified.
GetUniqueKey(keyno) | Returns 1 if the specified key number is marked as being Unique in the file description.
SetKeySortSeq(keyno,order) | Sets the specified key as either Ascending (order=1), Descending (order=-1), or Unspecified (order=0).