OPEN command

Opens an Analytics table and the associated data file.

Syntax

OPEN {table_name|data_file <FORMAT layout_name>} <BUFFERLENGTH length> <CRLF> <DBASE> <INDEX index_file> <PRIMARY|SECONDARY> <SKIP bytes> <RELATION key_field>

Parameters

Name Description
table_name

The name of the Analytics table to open.

data_file

The data file to associate with the table specified by FORMAT layout_name.

Analytics assumes a file extension of .fil if no extension is specified. To open a file with no extension, insert a period (.) at the end of the file name.

FORMAT layout_name

optional

The Analytics table layout to apply to the data file that you open as a table.

BUFFERLENGTH n

optional

The length in bytes of the input buffer area to be allocated to the table. The default value is 33,000 bytes.

Larger buffer areas may improve processing speed at the expense of RAM available for storing Analytics commands.

If any IBM variable length blocks are read which exceed the buffer length, Analytics displays an error message and stops processing. The default value is set in the Buffer Size field in the Table tab in the Options dialog box.

You will seldom need to change BUFFERLENGTH n, because the default is sufficient to handle almost all situations.

CRLF

optional

Specifies that a variable length ASCII file is to be read. Analytics automatically adjusts for the varying record lengths.

By default, files are assumed to be fixed-length files.

DBASE

optional

Specifies that the data source is a dBASE file. Analytics recognizes the type of dBASE file and automatically creates a table from the file description. Can be omitted for dBASE files with a .dbf extension.
INDEX index_file

optional

The index file to apply to the table when it is opened.

The file extension for the index file name is assumed to be .inx when none is specified. You can specify INDEX with either primary or secondary tables.

PRIMARY | SECONDARY

optional

Specifies that a table is opened as either a primary table or a secondary table. If omitted, the table is opened as a primary table.
SKIP bytes

optional

The number of bytes to bypass at the physical start of the table.

SKIP can be used to ignore table header records or leading portions of the table that do not follow the layout of the remainder of the table. If omitted, the table is read starting at the first byte.

Note

non-Unicode Analytics 1 byte = 1 character
Unicode Analytics, extended ASCII (ANSI) data 1 byte = 1 character
Unicode Analytics, Unicode data 2 bytes = 1 character

For Unicode data, specify an even number of bytes only. Specifying an odd number of bytes can cause characters to display incorrectly.

RELATION key_field

optional

Specifies that the table is to be opened as an ad hoc related table. Analytics does not retain this relation when the table is closed.

You must also specify the INDEX parameter when you use RELATION. key_field is the key field or expression used to create the relation between two tables.

Examples

Opening a table while specifying a table layout

You open the April_2012 table using the March_2012 table layout:

OPEN April_2012 FORMAT March_2012

Opening a dBASE file

You open a dBASE file named Inventory.dbf for which there is no existing table:

OPEN Inventory

Opening a table and apply a pre-existing index

To open either a primary or a secondary table, and apply an index that already exists for the table, use the following syntax:

OPEN Accounts_receivable INDEX Customer_number_AR
OPEN Customer SECONDARY INDEX Customer_number

Opening a table and establish an ad hoc relation to another table

You need to establish a temporary relation between an open table named Customers (the primary table) and a table named Accounts_receivable (the secondary table).

You use an index named Customer_index and a key field in the primary table named Last_name:

OPEN Accounts_receivable INDEX Customer_index RELATION Last_name