Difference between revisions of "C-ISAM Data Files"

From Recital Documentation Wiki
Jump to: navigation, search
 
(6 intermediate revisions by one user not shown)
Line 1: Line 1:
{{YLM to tidy up}}
+
On UNIX and Linux platforms, Recital supports access to Informix compliant C-ISAM files.
=Accessing C-ISAM Data Files=
+
 
+
On UNIX and Linux platforms, Recital Terminal Developer, Recital Mirage Server and the Recital Database Server support access to Informix compliant C-ISAM files.
+
  
 
Data access is achieved through a C-ISAM Bridge.  This requires the creation of a Bridge file and an empty Recital table that has the same structure as the C-ISAM file.
 
Data access is achieved through a C-ISAM Bridge.  This requires the creation of a Bridge file and an empty Recital table that has the same structure as the C-ISAM file.
  
Creating the Recital Table
+
 
 +
==See Also==
 +
[[ALTER TABLE]], [[CREATE]], [[CREATE BRIDGE]], [[SQL CREATE BRIDGE|CREATE BRIDGE (SQL)]], [[CREATE TABLE]], [[DISPLAY STRUCTURE]], [[Error Messages: C-ISAM RDD|Error Messages]], [[LIST STRUCTURE]], [[MODIFY STRUCTURE]], [[SQL SELECT|SELECT]], [[USE]]
 +
 
 +
 
 +
==Creating the Recital Table==
 
Create a Recital table with the same structure as the C-ISAM file.  The fields/columns in the structure file must exactly match the data type and length of those in the C-ISAM file.  The Recital table will have one byte more in total record length due to the Recital record deletion marker.
 
Create a Recital table with the same structure as the C-ISAM file.  The fields/columns in the structure file must exactly match the data type and length of those in the C-ISAM file.  The Recital table will have one byte more in total record length due to the Recital record deletion marker.
  
To create the table, use the SQL CREATE TABLE command or the Recital Terminal Developer CREATE worksurface.  The table should be given a ’.str’ file extension (rather than the default ’.dbf’) to signify that this is a structure file only.
+
To create the table, use the [[CREATE TABLE|SQL CREATE TABLE]] command or the Recital Workbench [[CREATE]] worksurface.  The table should be given a ’.str’ file extension (rather than the default ’.dbf’) to signify that this is a structure file only.
  
 
Please see the end of this section for information on matching Informix and Recital data types.
 
Please see the end of this section for information on matching Informix and Recital data types.
  
Creating the Bridge File
 
In Recital Terminal Developer, the Bridge File can be created using the CREATE BRIDGE worksurface.  For Recital Database and Mirage Server clients, the Bridge File can be created in two ways: by using an ’ini’ file, or by the SQL CREATE BRIDGE command.
 
  
Maximums Widths
+
==Creating the Bridge File==
 +
The Bridge File can be created in two ways: using an ’ini’ file, or with the [[CREATE BRIDGE|SQL CREATE BRIDGE]] command. 
 +
 
 +
Note: The Bridge File can also be created using the [[CREATE BRIDGE]] worksurface in the Recital Workbench. 
 +
 
 +
 
 +
====Maximums Widths====
 
The following maximum widths apply to the bridge elements:
 
The following maximum widths apply to the bridge elements:
  
Line 34: Line 40:
  
  
’ini’ file
+
====ini file====
 
Firstly, an ’ini’ file should be created on the server in the data directory where the C-ISAM file is held.  The ini file has the following structure:
 
Firstly, an ’ini’ file should be created on the server in the data directory where the C-ISAM file is held.  The ini file has the following structure:
  
 +
 +
<pre>
 
[bridge]
 
[bridge]
 
bridgetype=<bridgetype>
 
bridgetype=<bridgetype>
Line 42: Line 50:
 
databasename=<name of the Recital structure table>
 
databasename=<name of the Recital structure table>
 
alias=<the name to use to access your file>
 
alias=<the name to use to access your file>
 +
</pre>
  
e.g. cisamdemo.ini
 
  
 +
cisamdemo.ini
 +
 +
 +
<pre>
 
[bridge]
 
[bridge]
 
bridgetype=CISAM
 
bridgetype=CISAM
Line 50: Line 62:
 
databasename=cisamstru.str
 
databasename=cisamstru.str
 
alias=cisamdemo
 
alias=cisamdemo
 +
</pre>
 +
  
 
NOTE: There should be no white space either side of the ’=’ signs.
 
NOTE: There should be no white space either side of the ’=’ signs.
  
The Bridge file can now be created from the ini file.  This can be given a ’.dbf’ file extension (rather than the default ’.brg’) so that it can be accessed like a normal Recital table.  The SQL EXECUTE IMMEDIATE command is used to run the Recital/4GL CREATE BRIDGE FROM command:
+
The Bridge file can now be created from the ini file.  This can be given a ’.dbf’ file extension (rather than the default ’.brg’) so that it can be accessed like a normal Recital table.  The SQL [[EXECUTE IMMEDIATE]] command is used to run the Recital/4GL [[CREATE BRIDGE|CREATE BRIDGE FROM]] command:
  
e.g.
 
  
 +
<code lang="recital">
 
create bridge cisamdemo.dbf from cisamdemo
 
create bridge cisamdemo.dbf from cisamdemo
 +
</code>
  
CREATE BRIDGE (SQL)
 
The CREATE BRIDGE SQL command defines and creates the bridge in one step:
 
  
e.g.
+
====CREATE BRIDGE (SQL)====
exec sql
+
The [[SQL CREATE BRIDGE|CREATE BRIDGE]] SQL command defines and creates the bridge in one step:
CREATE BRIDGE cisamdemo.dbf  
+
 
TYPE "CISAM"
+
 
EXTERNAL "cisamdemo.dat"
+
<code lang="recital">
METADATA "cisamdemo.str"
+
CREATE BRIDGE cisamdemo.dbf;
ALIAS "cisamdemo";
+
TYPE "CISAM";
 +
EXTERNAL "cisamdemo.dat";
 +
METADATA "cisamdemo.str";
 +
ALIAS "cisamdemo"
  
 
//or
 
//or
  
exec sql
+
CREATE BRIDGE cisamdemo.dbf;
CREATE BRIDGE cisamdemo.dbf
+
AS "TYPE=CISAM;EXTERNAL=cisamdemo.dat;METADATA=cisamdemo.str;ALIAS=cisamdemo"
AS "TYPE=CISAM;EXTERNAL=cisamdemo.dat;METADATA=cisamdemo.str;ALIAS=cisamdemo";
+
</code>
  
Using the Bridge
+
 
 +
==Using the Bridge==
 
The Bridge can now be used.  To access the C-ISAM file, use the ’alias’ specified in the Bridge definition.
 
The Bridge can now be used.  To access the C-ISAM file, use the ’alias’ specified in the Bridge definition.
  
e.g.
 
  
 +
<code lang="recital">
 
Select * from cisamdemo
 
Select * from cisamdemo
 +
</code>
 +
  
 
==Data Types==
 
==Data Types==

Latest revision as of 16:18, 5 July 2011

On UNIX and Linux platforms, Recital supports access to Informix compliant C-ISAM files.

Data access is achieved through a C-ISAM Bridge. This requires the creation of a Bridge file and an empty Recital table that has the same structure as the C-ISAM file.


See Also

ALTER TABLE, CREATE, CREATE BRIDGE, CREATE BRIDGE (SQL), CREATE TABLE, DISPLAY STRUCTURE, Error Messages, LIST STRUCTURE, MODIFY STRUCTURE, SELECT, USE


Creating the Recital Table

Create a Recital table with the same structure as the C-ISAM file. The fields/columns in the structure file must exactly match the data type and length of those in the C-ISAM file. The Recital table will have one byte more in total record length due to the Recital record deletion marker.

To create the table, use the SQL CREATE TABLE command or the Recital Workbench CREATE worksurface. The table should be given a ’.str’ file extension (rather than the default ’.dbf’) to signify that this is a structure file only.

Please see the end of this section for information on matching Informix and Recital data types.


Creating the Bridge File

The Bridge File can be created in two ways: using an ’ini’ file, or with the SQL CREATE BRIDGE command.

Note: The Bridge File can also be created using the CREATE BRIDGE worksurface in the Recital Workbench.


Maximums Widths

The following maximum widths apply to the bridge elements:


Element Maximum Width in Characters Description
Type 10 Bridge type: CISAM
External 80 External file name
Metadata 80 Recital ’structure’ table name
Alias 10 Alias name


ini file

Firstly, an ’ini’ file should be created on the server in the data directory where the C-ISAM file is held. The ini file has the following structure:


[bridge]
bridgetype=<bridgetype>
externalname=<name of the C-ISAM file>
databasename=<name of the Recital structure table>
alias=<the name to use to access your file>


cisamdemo.ini


[bridge]
bridgetype=CISAM
externalname=cisam.dat
databasename=cisamstru.str
alias=cisamdemo


NOTE: There should be no white space either side of the ’=’ signs.

The Bridge file can now be created from the ini file. This can be given a ’.dbf’ file extension (rather than the default ’.brg’) so that it can be accessed like a normal Recital table. The SQL EXECUTE IMMEDIATE command is used to run the Recital/4GL CREATE BRIDGE FROM command:


create bridge cisamdemo.dbf from cisamdemo


CREATE BRIDGE (SQL)

The CREATE BRIDGE SQL command defines and creates the bridge in one step:


CREATE BRIDGE cisamdemo.dbf;
TYPE "CISAM";
EXTERNAL "cisamdemo.dat";
METADATA "cisamdemo.str";
ALIAS "cisamdemo"
 
//or
 
CREATE BRIDGE cisamdemo.dbf;
AS "TYPE=CISAM;EXTERNAL=cisamdemo.dat;METADATA=cisamdemo.str;ALIAS=cisamdemo"


Using the Bridge

The Bridge can now be used. To access the C-ISAM file, use the ’alias’ specified in the Bridge definition.


Select * from cisamdemo


Data Types

Informix Recital
Byte Numeric
Char Character
Character Character
Date Date
Datetime Character
Decimal Numeric
Double Precision Float
Float Real
16 Bit Integer Short
Integer Numeric
Interval Character
32 Bit Long Integer
Money Numeric
Numeric Numeric
Real Numeric
Smallfloat Numeric
Smallint Numeric
Text Unsupported
Varchar Character