Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- RaSQL/B 6.1a for Clipper - <b>n_xuse()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
N_XUSE()
Open Btrieve file in current area

Syntax
N_XUSE(<cTable>, <cStructure>|<aStructure>)

RDD Syntax
USE <cTable> [VIA "RQBRDD"]  [ALIAS <cAlias>]
[DEFINITION <cStructure>|<aStructure>] 
[NEW]  [EXCLUSIVE]  [SHARED]  [READONLY] 

Arguments
<cTable> is a Btrieve filename.

<cStructure>|<aStructure> is the Btrieve file structure specified as a 
string or array. Unlike DBF files, Btrieve tables have no builtin file 
structure. Thus it is necessary that you pass the file structure to N_XUSE() 
when opening the table.
See Appendix B for the format of this parameter.

It is not necessary to include index information because RaSQL/B will obtain 
that information from the Btrieve table itself.

Appendix A lists the Btrieve data types and their allowable internal 
lengths.

If N_XERROR() returns error code 22, Record buffer length too small, you 
have incorrectly specified the record structure. To verify the actual length 
of the record, use N_XSRECSIZ(). See the example given with the entry for 
N_XSRECSIZE().

Returns
True if the table was opened successfully.
False if the table could not be opened. The resulting error code can be 
found with N_XERROR().

Remarks
Attempts to open an existing table in the current select area. Up to 250 
tables can be opened, one in each file area, limited only by available 
memory and system configuration.

If your program has set an open mode with N_XOPENMODE(), Btrieve will use 
it. Otherwise, it will open the table in normal read/write mode.

If the table was created with an owner, then before calling N_XUSE() your 
program must first set that owner name as current owner with N_XOWNER().

When Btrieve opens a table it automatically opens indexes, too. INDEX 
clauses and SET INDEX TO commands are ignored if specified. 

Note
If you are specifying a long structure in-line (i.e., not loading it from an 
RQB or some other file) then specifying the structure as entries in an array 
will cause much less memory fragmentation than specifying it as a series of 
concatenated strings.  If applicable, RELEASE the array memory variable 
after N_XUSE.

Examples
* File structure passed as a string
N_XUSE('patients.dta', ;
  'ID                  C    16.0  ;'+ ;
  'First_Name          C    12.0  ;'+ ;
  'Middle_Name         C    10.0  ;'+ ;
  'Last_Name           C    20.0  ;'+ ;
  'Address             C    25.0  ;'+ ;
  'City                C    15.0  ;'+ ;
  'State               C     2.0  ;'+ ;
  'Zip                 C    10.0  ;'+ ;
  'Phone               C    12.0  ;')

* File structure passed as an array
DECLARE stru[9]
stru[1] = 'ID                  C    16.0  ;'
stru[2] = 'First_Name          C    12.0  ;'
stru[3] = 'Middle_Name         C    10.0  ;'
stru[4] = 'Last_Name           C    20.0  ;'
stru[5] = 'Address             C    25.0  ;'
stru[6] = 'City                C    15.0  ;'
stru[7] = 'State               C     2.0  ;'
stru[8] = 'Zip                 C    10.0  ;'
stru[9] = 'Phone               C    12.0  ;'
N_XUSE('patients.dta', stru)


See Also: Appendix A Appendix B N_XOPENMODE() N_XOWNER() N_XSRECSIZ() N_XVARSTRU()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson