Difference between revisions of "USE"

From Recital Documentation Wiki
Jump to: navigation, search
 
Line 33: Line 33:
  
 
==Description==
 
==Description==
The USE command opens an existing table in the currently selected workarea or in the workarea specified in the IN <workarea> option.  The <filename> can be substituted with a <expC1> enclosed in round brackets that returns a valid file name.  The <filename> can include the encryption key for encrypted database tables.  The three part comma-separated key should be enclosed in angled brackets and appended to the filename, e.g. mytable<key_1,key_2,key_3>.
+
The USE command opens an existing table in the currently selected cursor (also known as workarea) or in the cursor specified in the IN <cursor> option.  The <filename> can be substituted with a <expC1> enclosed in round brackets that returns a valid file name.  The <filename> can include the encryption key for encrypted database tables.  The three part comma-separated key should be enclosed in angled brackets and appended to the filename, e.g. mytable<key_1,key_2,key_3>.
  
 
====AGAIN====
 
====AGAIN====
The AGAIN keyword is used to open an already open table in another workarea.  The compatibility mode must be set to an alternative Xbase mode. Please see the SET COMPATIBLE command for more information.
+
The AGAIN keyword is used to open an already open table in another cursor.  The compatibility mode must be set to an alternative Xbase mode. Please see the SET COMPATIBLE command for more information.
  
 
====ALIAS <name>====
 
====ALIAS <name>====

Latest revision as of 14:52, 7 January 2010

Purpose

Open a table


Syntax

USE [<filename> | (<expC1>)

[AGAIN]

[ALIAS <name>]

[AUTOMEM]

[ENCRYPTION <expC2>]

[EXCLUSIVE]

[IN <cursor>]

[INDEX <index filelist> | (<expC3>)]

[NODBX]

[NOUPDATE]

[ORDER <.ndx file>|[TAG] <.dbx tag> [OF <.dbx filename>]]

[ORDER BY <exp1> WHERE <exp2>]]


See Also

BRIDGE(), CREATE BRIDGE, CREATE VIEW, DB_DATADIR, DECRYPT, ENCRYPT, INUSE(), OPEN DATABASE, SET AUTOFORMAT, SET COMPATIBLE, SET DATADIR, SET ENCRYPTION, SET FORMAT, SET INDEX, SET ORDER, SET VIEW, USED()

Description

The USE command opens an existing table in the currently selected cursor (also known as workarea) or in the cursor specified in the IN <cursor> option. The <filename> can be substituted with a <expC1> enclosed in round brackets that returns a valid file name. The <filename> can include the encryption key for encrypted database tables. The three part comma-separated key should be enclosed in angled brackets and appended to the filename, e.g. mytable<key_1,key_2,key_3>.

AGAIN

The AGAIN keyword is used to open an already open table in another cursor. The compatibility mode must be set to an alternative Xbase mode. Please see the SET COMPATIBLE command for more information.

ALIAS <name>

An optional alias name can be specified for the workarea with the ALIAS keyword. Once a table is opened in a workarea, the workarea can be identified using any of the following 'aliases': the workarea letter (A-Z) excluding M; the specified ALIAS name, or if none is specified, the first 32 characters of the file name

AUTOMEM

An empty memory variable of corresponding name, data type and size will be created for each field from the table.

ENCRYPTION <expC2>

The ENCRYPTION <expC2> clause is used to specify the encryption key for encrypted tables. The <expC2> is a string containing a three part comma-separated key, e.g. "key_1,key_2,key_3". The key may optionally be enclosed in angled brackets, e.g. "<key_1,key_2,key_3>". ". The SET ENCRYPTION command allows a default encryption key to be defined. If the ENCRYPTION <expC2> clause is not specified and the key is not included in the <filename>, this default key will be used. If the default key is not the correct key for the table, an error will be given. If no default key is active, a dialog box will be displayed in Recital Terminal Developer to allow the user to enter the key.

EXCLUSIVE

If the EXCLUSIVE keyword is specified, then the table is opened for private use, disallowing access by other users. To open a table for shared use, issue the SET EXCLUSIVE OFF command before the USE command.

IN <cursor>

If the IN keyword is specified then the table is opened in the workarea specified by alias. Alias can be either: the workarea letter (A-Z) excluding M or the workarea number. Specifying 0 as the workarea number causes the table to be opened in the lowest free workarea.

INDEX <index filelist>

The INDEX <index filelist> clause specifies a list of index files which should be opened and associated with the table. The <index filelist> may contain both single (.ndx), and multiple (.dbx) files. The first index in the list is known as the master index file, and is used to search for key values with the SEEK and FIND commands. The SET ORDER TO command can be used to reselect a master index from the list of open index files. Index files are created within the CREATE and MODIFY STRUCTURE Terminal Developer Development Tools, or using the INDEX ON command.

NODBX

If the NODBX keyword is specified then the table is opened without its associated production index file. All index definitions in the table header are released.

NOUPDATE

When NOUPDATE is specified, the table and related index file are opened with read only access. When used with an RMS bridge on OpenVMS, the RMS file is opened with 'shared read' access instead of 'shared read-write' access.

ORDER <.ndx file> | [TAG] <.dbx tag> [OF <.dbx filename>]

The ORDER qualifier can be used to specify the master index. The order can be specified by using the name of an .ndx file or by specifying the name of a tag. The OF <.dbx filename> may be used to explicitly specify the .dbx file to use.

ORDER BY <exp1> where <exp2>

This format of the USE command is only available for database gateways. When the ORDER BY <exp1> clause is used, the data file on the information server is initially opened and ordered by the expression specified. When the WHERE <exp2> clause is used, the data file on the server will extract only records that meet the criteria defined by <exp2>.

All open files associated with the currently selected workarea are closed before any new files are opened. The USE command on its own closes all open files associated with the currently selected workarea. After a table has been opened, the record pointer is positioned to record number 1 if no index files have been specified, or to the first record in the master index if the table has been opened with associated index files.

Please see the SQL USE command for information on the MySQL compatible USE <database> usage.

Example

use accounts index address.dbx;
  order tag last of address;
  in 3


Products

Recital Server, Recital