Description

Creates native tables and their dictionaries.

Syntax

Create_Table (locationlist, tablename, dictflag, databaseID, tableattributeslist, protectflag)

Parameters

The Create_Table subroutine has the following parameters.

ParameterDescription
locationlistStates the location of the existing table. Can be specified in either of the following ways:

[ location ]

[ location, table_type ]

[ location, table_type, control_table_path ]

volume_pointer_name

tablenameThe table or tables to create at the specified location. Do not attempt to create just a dictionary portion, by prefacing a table name with "DICT ". Use dictflag, below.
DictflagSet to true, in order to create only the dictionary part of a table. You can set up the structure of the dictionary before creating the data portion of the table.
databaseIDSpecifies the database to which the table belongs. If null, databaseID defaults to the current database.
tableattributeslist

Table type-specific attributes passed as an @FM-delimited list. The following form specifies the file attributes for a Linear Hash table: [ numrows, avgsize, numentries, framesize, resizethreshold ]

AttributeDescription
numrowsEstimate of the number of rows in the table.
avgsizeAverage number of characters in a row, including the key (this does not set a maximum).
numentriesEstimate of the number of dictionary rows (in other words, columns in the data table).
framesizeSize of each frame in bytes. Default is 1024 bytes.
resizethresholdPercentage of how full primary space must be before the table is re-sized.
protectflagIf true, then control features (PROTECT.MFS) are added to the table. See also Control_On.

Remarks

You can use Create_Table to define alternate table attributes, but you cannot use it to define the table structure.

Use Get_Status() to check for an error creating the table.

If the user creating a table is not a database owner (System Administrator), then his name is prefixed to the table name, to identify the table as being owned by that user and therefore not available to everyone.

To create a table using the toolset, use the table builder. If you must create a table programmatically:

1. Call Create_Table to create only the dictionary portion of a table.

2. Call Create_Table again, this time to create the data portion of the table.

See also

Alias_TableAttach_TableCopy_Table

Example

/* Creates a Linear Hash table, CONTACTS, 
at the location defined by the volume pointer name MY_DATA on the CUSTOMERS database. 
The table attributes are set to an estimated 1,000 rows, an average row size of 400 bytes, 
an estimated 25 columns, a framesize of 1,024 bytes, and a resize threshold of 80 percent. */
Declare Subroutine Create_Table
AttribList = "1000,400,25,1024,80"
Convert "," to @FM in AttribList
Create_Table ("MY_DATA", "CONTACTS", "", "CUSTOMERS", AttribList, "")
  • No labels