Open data file

Command groupFlag affectedReversibleExecute on clientPlatform(s)
Data filesYESNONOAll

Syntax

Open data file
 
 ([
Do not close other data
][,
Read-only
][,
No conversion by runtime
][,
Convert without user prompts
][,
Full Unicode conversion
])
 
file-name[,internal-name]
 or 
odb://[address:port:]name[,internal-name]

Options

Do not close other dataIf specified,the command does not close all open data files before opening the specified data file
Read-onlyIf specified,the data file is opened in read-only mode
No conversion by runtimeOmnis normally offers to convert data files created by an earlier version of Omnis. If this option is specified,the runtime version of Omnis will not offer to convert the file,and the command will fail
Convert without user promptsIf specified,and conversion is allowed, Omnis will immediately perform the conversion without giving the user any prompts that require a response; also, the user cannot cancel the conversion
Full Unicode conversionUnicode Studio only.If specified,and convert without user prompts is specified,do full Unicode conversion instead of quick conversion (quick conversion is only ok when you know all character data in the file is 7 bit)

Description

This command opens the specified data file and makes that file the "current" data file. It clears the flag if the data file cannot be found or opened. If the Do not close other data check box option is not specified, all existing data files are closed even if the command fails. Opening a data file which is already open will close and reopen that data file. The Read-only check box causes the data file to be opened in read-only mode.

If you select the No conversion by runtime option, and the data file was created with a previous version of Omnis, then the runtime version of Omnis will not convert the data file. The default is that an Omnis runtime will ask the user if they want to convert the data file.

If an opened data file uses more than one segment, all segments are opened. The rules for finding the additional segments which form part of the data file are as follows:

You can override the default internal name by specifying your own in the parameter for the command.

If the data file is to be accessed using the ODB (Omnis Data Bridge), then instead of using a pathname, you specify the location of the file using a special syntax:

where address:port is the TCP/IP address and port number of the ODB server, e.g. 127.0.0.1:5900, and name is the name of a data file accessed using the ODB server. You can omit address:port:, in which case Omnis uses the address and port stored in the $odbserver root preference. Note that the value of $odbserver is stored in the file odb.txt in the studio folder of the Omnis installation tree.

Example

Open data file
 
Sales.df1,Sales

If flag true
  
Find first
  
If flag true
    
Open data file
 (
Do not close other data
)
 
Purch.df1,Purchases

    
If flag true
      
Calculate
 
fPurchases
.
Field1
 as 
fSales
.
Field1

      
Prepare for insert with current values
      
Enter data
      
Update files if flag set
    
End If
  
End If
End If
 
# Example 2 - Transfer datafile 1 to datafile 2

Open data file
 
pOrders.df1,pOrders1

If flag true
  
Set main file
 
fOrders

  
Find first
 
on 
fOrders
.
OrderNum

  
While flag true
    
Prepare for insert with current values
    
Open data file
 
pOrders2.df1,pOrders2

    
Update files if flag set
    
Open data file
 
pOrders.df1,pOrders1

    
Next
 
on 
fOrders
.
OrderNum

  
End While
End If
 
# Example 3 - Open a data file on a specific ODB server

Open data file
 
odb://127.0.0.1:5900:test

 
# Example 4 - Open a data file using the ODB server identified by $prefs.$odbserver

Open data file
 
odb://test