Skip to content

Structure_Abort

See Also: Structure_End, Structure_Start

Purpose

To terminate a table structure operation without completing it.

Syntax

Structure_Abort
tableNum

Argument Explanation

  • tableNum: The variable containing the handle from the corresponding Structure_Start.

What It Does

This command can be used when constructing error handling routines. The Structure_Abort command will undo any structure operations that have been done since the last Structure_Start.

Structure_Start hTable
// Create an index, and set its attributes. Also process any errors.
Create_Index hTable at iIndex
on error gosub bad_structure
Set_Attribute DF_INDEX_SEGMENT_FIELD of hTable iIndex 1 to 2
Set_Attribute DF_INDEX_SEGMENT_FIELD of hTable iIndex 2 to 4
Set_Attribute DF_INDEX_SEGMENT_FIELD of hTable iIndex 3 to 0
Structure_End hTable

bad_structure:
    showln "An error has occurred while creating the index. Program will abort."
    Structure_Abort hTable
    abort
    return

This example will call the error-handling procedure bad_structure if any errors occur during the creation of the index.

Notes

  • After a restructure, tableNum contains a table handle rather than the table number it was passed before the restructure. Therefore, an open tableNum statement after a restructure will return an error. It is good practice either to create a separate variable to pass to Structure_Start for tableNum or to perform restructures in procedures that use a local variable for the parameter.