We are pleased to announce the release of Recital 10.0.3.
Here is a brief list of features and functionality that you will find in the 10.0.3 release.
- New Commands:
- SET TMPNAMPATH ON|OFF
- REMOVE TABLE - New Functions:
- CURSORGETPROP()
- CURSORSETPROP()
- CURVAL()
- GETFLDSTATE()
- OLDVAL()
- TABLEREVERT()
- TABLEUPDATE()
- SETFLDSTATE() - Enhanced Functions:
- TMPNAM() - additional parameter to specify the return of basename only
- MAILATTACH() - parameter changed from array to filename to allow directory and file extension to be specified - Enhancements:
- DO level increased from 32 to 64. - Fixes:
- Delay exiting Recital after SYS(3) or SYS(2015)
- SET SOFTSEEK issue when search key above first record in index
- Compilation error with REPLACE command after UDF call
- FETCH INTO memvars error
- END TRANSACTION at command prompt error
- ROLLBACK locking error
- Linux ODBC Driver undefined symbol error
- RELEASE variable with same name as variable in calling program issue
- SQLCODE() issue on non-gateway data access
- Issuing two SQLEXEC() calls error
- LASTSEQNO() in workareas > 1 error
- SET RELATION to detail table in workarea 1 issue
- LIST STATUS on empty table delay
- SET AUTOCATALOG alias entries error
- ADD OBJECT in DEFINE CLASS error
- DEACTIVATE WINDOW error
- SORT error
- Other reported bugs
The getUIComponentBitmapData method can create bitmapdata for a given IUIComponent. Pass any UIcomponent to get its respective bitmapdata.
public static function getUIComponentBitmapData(target:IUIComponent):BitmapData {
var resultBitmapData:BitmapData = new BitmapData(target.width, target.height);
var m:Matrix = new Matrix();
resultBitmapData.draw(target, m);
return resultBitmapData;
}
Now convert the bitmapdata to a jpeg bytearray.
private static function encodeToJPEG(data:BitmapData, quality:Number = 75):ByteArray {
var encoder:JPGEncoder = new JPGEncoder(quality);
return encoder.encode(data);
}
Now encode the ByteArray into Base64.
public static function base64Encode(data:ByteArray):String {
var encoder:Base64Encoder = new Base64Encoder();
encoder.encodeBytes(data);
return encoder.flush();
}
Upload the base64 encoded ByteArray to the server.
public static uploadData():void {
var url:String = "saveFile.php";
var urlRequest:URLRequest = new URLRequest(url);
urlRequest.method = URLRequestMethod.POST;
var urlLoader:URLLoader = new URLLoader();
var urlVariables:URLVariables = new URLVariables();
urlVariables.file = jpgEncodedFile; // as returned from base64Encode()
urlLoader.data = urlVariables;
urlLoader.load(urlRequest);
}
The saveFile.php file on the server.
$input = $_POST['file']; $fp = fopen('filename.jpg', 'w'); fwrite($fp, base64_decode($input)); fclose($fp); ?>
echo "Hello world\n"
In this article Barry Mavin, CEO and Chief Software Architect for Recital details how to Build C Extension Libraries to use with Recital.
Overview
It is possible to extend the functionaliy of Recital products using "Extension libraries" that can be written in C. These extension libraries, written using the Recital/SDK API, are dynamically loadable from all Recital 9 products. This includes:
- Recital
- Recital Server
- Recital Web
Building C Extension Libraries
You can create C wrappers for virtually any native operating system function and access these from the Recital 4GL. Unlike traditional APIs which only handle the development of C functions that are callable from the 4GL, the Recital/SDK allows you to build Classes that are accessible from all Recital products. e.g. You could create a GUI framework for Linux that handles VFP system classes!
To deploy your C Extension Libraries, copy them to the following location:
Windows:
\Program Files\Recital\extensions
Linux/Unix:
/opt/recital/extensions
Please see the Recital/SDK API Reference documentation for further details.
Sample code
Listed below is the complete example of a C Extension Library.:
////////////////////////////////////////////////////////////////////////////////
#include "mirage_demo.h"
////////////////////////////////////////////////////////////////////////////////
// Declare your functions and classes below as follows:
//
// Recital Function Name, C Function Name, Type (Function or Class)
//
#define MAX_ELEMENTS 7
static struct API_SHARED_FUNCTION_TABLE api_function_table[MAX_ELEMENTS] = {
{"schar", "fnSamplesCharacter", API_FUNCTION},
{"stype", "fnSamplesType", API_FUNCTION},
{"slog", "fnSamplesLogical", API_FUNCTION},
{"snum", "fnSamplesNumeric", API_FUNCTION},
{"sopen", "fnSamplesOpen", API_FUNCTION},
{"myclass", "clsMyClass", API_CLASS},
{NULL, NULL, -1}
};
////////////////////////////////////////////////////////////////////////////////
// Recital API initialization. This should be in only ONE of your C files
// **IT SHOULD NEVER BE EDITED OR REMOVED**
INIT_API;
///////////////////////////////////////////////////////////////////////
// This is an example of passing a character parameter and returning one.
RECITAL_FUNCTION fnSamplesCharacter(void)
{
char *arg1;
if (!_parse_parameters(PCOUNT, "C", &arg1)) {
ERROR(-1, "Incorrect parameters");
}
_retc(arg1);
}
///////////////////////////////////////////////////////////////////////
// This is an example of passing a numeric parameter and returning one.
RECITAL_FUNCTION fnSamplesNumeric(void)
{
int arg1;
if (!_parse_parameters(PCOUNT, "N", &arg1)) {
ERROR(-1, "Incorrect parameters");
}
_retni(arg1);
}
///////////////////////////////////////////////////////////////////////
// This is an example returns the data type of the parameter passed.
RECITAL_FUNCTION fnSamplesType(void)
{
char result[10];
if (PCOUNT != 1) {
ERROR(-1, "Incorrect parameters");
}
switch (_parinfo(1)) {
case API_CTYPE:
strcpy(result, "Character");
break;
case API_NTYPE:
strcpy(result, "Numeric");
break;
case API_LTYPE:
strcpy(result, "Logical");
break;
case API_DTYPE:
strcpy(result, "Date");
break;
case API_TTYPE:
strcpy(result, "DateTime");
break;
case API_YTYPE:
strcpy(result, "Currency");
break;
case API_ATYPE:
strcpy(result, "Array");
break;
default:
strcpy(result, "Unkown");
break;
}
_retc(result);
}
///////////////////////////////////////////////////////////////////////
// This is an example returns "True" or False.
RECITAL_FUNCTION fnSamplesLogical(void)
{
char result[10];
int arg1;
if (!_parse_parameters(PCOUNT, "L", &arg1)) {
ERROR(-1, "Incorrect parameters");
}
if (arg1) strcpy(result, "True");
else strcpy(result, "False");
_retc(result);
}
///////////////////////////////////////////////////////////////////////
// This example opens a table.
RECITAL_FUNCTION fnSamplesOpen(void)
{
char *arg1;
if (!_parse_parameters(PCOUNT, "C", &arg1)) {
ERROR(-1, "Incorrect parameters");
}
if (_parinfo(1) == API_CTYPE) {
_retni(COMMAND(arg1));
} else {
_retni(-1);
}
}
///////////////////////////////////////////////////////////////////////
// Define the MyClass CLASS using the API macros
///////////////////////////////////////////////////////////////////////
RECITAL_EXPORT int DEFINE_CLASS(clsMyClass)
{
/*-------------------------------------*/
/* Dispatch factory methods and return */
/*-------------------------------------*/
DISPATCH_FACTORY();
/*---------------------------------*/
/* Dispatch constructor and return */
/*---------------------------------*/
DISPATCH_METHOD(clsMyClass, Constructor);
/*--------------------------------*/
/* Dispatch destructor and return */
/*--------------------------------*/
DISPATCH_METHOD(clsMyClass, Destructor);
/*-----------------------------------*/
/* Dispatch DEFINE method and return */
/*-----------------------------------*/
DISPATCH_METHOD(clsMyClass, Define);
/*------------------------------*/
/* Dispatch SET or GET PROPERTY */
/* method for property NumValue */
/* then return. */
/*------------------------------*/
DISPATCH_PROPSET(clsMyClass, NumValue);
DISPATCH_PROPGET(clsMyClass, NumValue);
/*------------------------------*/
/* Dispatch SET or GET PROPERTY */
/* method for property LogValue */
/* then return. */
/*------------------------------*/
DISPATCH_PROPSET(clsMyClass, LogValue);
DISPATCH_PROPGET(clsMyClass, LogValue);
/*-------------------------------*/
/* Dispatch SET or GET PROPERTY */
/* method for property DateValue */
/* then return. */
/*-------------------------------*/
DISPATCH_PROPSET(clsMyClass, DateValue);
DISPATCH_PROPGET(clsMyClass, DateValue);
/*-------------------------------*/
/* Dispatch SET or GET PROPERTY */
/* method for property TimeValue */
/* then return. */
/*-------------------------------*/
DISPATCH_PROPSET(clsMyClass, TimeValue);
DISPATCH_PROPGET(clsMyClass, TimeValue);
/*-------------------------------*/
/* Dispatch SET or GET PROPERTY */
/* method for property CurrValue */
/* then return. */
/*-------------------------------*/
DISPATCH_PROPSET(clsMyClass, CurrValue);
DISPATCH_PROPGET(clsMyClass, CurrValue);
/*-------------------------------*/
/* Dispatch SET or GET PROPERTY */
/* method for property CharValue */
/* then return. */
/*-------------------------------*/
DISPATCH_PROPSET(clsMyClass, CharValue);
DISPATCH_PROPGET(clsMyClass, CharValue);
/*------------------------------*/
/* Dispatch SET or GET PROPERTY */
/* method for property ObjValue */
/* then return. */
/*------------------------------*/
DISPATCH_PROPSET(clsMyClass, ObjValue);
DISPATCH_PROPGET(clsMyClass, ObjValue);
/*-----------------------------------*/
/* If message not found return error */
/*-----------------------------------*/
OBJECT_RETERROR("Unknown message type");
}
////////////////////////////////////////////////////////////////////////////////
// Define METHOD handlers
////////////////////////////////////////////////////////////////////////////////
DEFINE_METHOD(clsMyClass, Constructor)
{
struct example_data *objectDataArea;
/* Allocate memory for objects objectData area */
objectDataArea = (struct example_data *)
malloc(sizeof(struct example_data));
if (objectDataArea == NULL) return(-1);
/* Assign the default property values */
strcpy(objectDataArea->prop_charvalue, "Test API object");
objectDataArea->prop_numvalue = 15.2827;
objectDataArea->prop_logvalue = 'F';
strcpy(objectDataArea->prop_datevalue, DATE_DATE());
strcpy(objectDataArea->prop_timevalue, DATE_DATETIME());
strcpy(objectDataArea->prop_currvalue, "15.2827");
strcpy(objectDataArea->object_name, "APIobject");
objectDataArea->prop_objvalue
= OBJECT_NEW(objectDataArea->object_name, "exception", NULL);
/* Set the object objectData area */
OBJECT_SETDATA((char *)objectDataArea);
return(0);
}
DEFINE_METHOD(clsMyClass, Destructor)
{
struct example_data *objectData = (struct example_data *)OBJECT_GETDATA();
if (objectData != NULL) {
if (objectData->prop_objvalue != NULL)
OBJECT_DELETE(objectData->prop_objvalue);
free(objectData);
objectData = NULL;
}
return(0);
}
DEFINE_METHOD(clsMyClass, Define)
{
struct example_data *objectData = (struct example_data *)OBJECT_GETDATA();
struct API_EXPRESSION result;
char buffer[512];
int rc;
/* Check the object class */
OBJECT_GETPROPERTY(objectData->prop_objvalue, "class", buffer);
rc = OBJECT_GETARG(buffer, &result);
if (result.errno == 0 && result.type == 'C'
&& strcmp(result.character, "Exception") == 0) {
switch (OBJECT_GETARGC()) {
case 1:
rc = OBJECT_GETPARAMETER(1, &result);
if (result.errno == 0 && result.type == 'C') {
OBJECT_SETARG(buffer, &result);
rc = OBJECT_SETPROPERTY(objectData->prop_objvalue,
"message", buffer);
}
break;
case 2:
rc = OBJECT_GETPARAMETER(2, &result);
if (result.errno == 0 && result.type == 'N') {
OBJECT_SETARG(buffer, &result);
rc = OBJECT_SETPROPERTY(objectData->prop_objvalue,
"errorno", buffer);
}
}
}
result.type = 'L';
result.logical = (rc == 0 ? 'T' : 'F');
OBJECT_RETRESULT(&result);
}
////////////////////////////////////////////////////////////////////////////////
// Define GET property handlers
////////////////////////////////////////////////////////////////////////////////
DEFINE_PROPERTYGET(clsMyClass, NumValue)
{
struct example_data *objectData = (struct example_data *)OBJECT_GETDATA();
if (objectData == NULL) return(-1);
OBJECT_RETPROPERTY('N', objectData->prop_numvalue);
}
DEFINE_PROPERTYGET(clsMyClass, LogValue)
{
struct example_data *objectData = (struct example_data *)OBJECT_GETDATA();
if (objectData == NULL) return(-1);
OBJECT_RETPROPERTY('L', objectData->prop_logvalue);
}
DEFINE_PROPERTYGET(clsMyClass, DateValue)
{
struct example_data *objectData = (struct example_data *)OBJECT_GETDATA();
if (objectData == NULL) return(-1);
OBJECT_RETPROPERTY('D', objectData->prop_datevalue);
}
DEFINE_PROPERTYGET(clsMyClass, TimeValue)
{
struct example_data *objectData = (struct example_data *)OBJECT_GETDATA();
if (objectData == NULL) return(-1);
OBJECT_RETPROPERTY('T', objectData->prop_timevalue);
}
DEFINE_PROPERTYGET(clsMyClass, CurrValue)
{
struct example_data *objectData = (struct example_data *)OBJECT_GETDATA();
if (objectData == NULL) return(-1);
OBJECT_RETPROPERTY('Y', objectData->prop_currvalue);
}
DEFINE_PROPERTYGET(clsMyClass, CharValue)
{
struct example_data *objectData = (struct example_data *)OBJECT_GETDATA();
if (objectData == NULL) return(-1);
OBJECT_RETPROPERTY('C', objectData->prop_charvalue);
}
DEFINE_PROPERTYGET(clsMyClass, ObjValue)
{
struct example_data *objectData = (struct example_data *)OBJECT_GETDATA();
if (objectData == NULL) return(-1);
OBJECT_RETPROPERTY('O', objectData->prop_objvalue);
}
////////////////////////////////////////////////////////////////////////////////
// Define SET property handlers
////////////////////////////////////////////////////////////////////////////////
DEFINE_PROPERTYSET(clsMyClass, NumValue)
{
struct example_data *objectData = (struct example_data *)OBJECT_GETDATA();
struct API_EXPRESSION result;
int rc = OBJECT_ERROR;
OBJECT_GETVALUE(&result);
if (result.errno == 0 && result.type == 'N') {
objectData->prop_numvalue = result.number;
rc = OBJECT_SUCCESS;
}
return(rc);
}
DEFINE_PROPERTYSET(clsMyClass, LogValue)
{
struct example_data *objectData = (struct example_data *)OBJECT_GETDATA();
struct API_EXPRESSION result;
int rc = OBJECT_ERROR;
OBJECT_GETVALUE(&result);
if (result.errno == 0 && result.type == 'L') {
objectData->prop_logvalue = result.logical;
rc = OBJECT_SUCCESS;
}
return(rc);
}
DEFINE_PROPERTYSET(clsMyClass, DateValue)
{
struct example_data *objectData = (struct example_data *)OBJECT_GETDATA();
struct API_EXPRESSION result;
int rc = OBJECT_ERROR;
OBJECT_GETVALUE(&result);
if (result.errno == 0 && result.type == 'D') {
strcpy(objectData->prop_datevalue, DATE_DTOS(result.date));
rc = OBJECT_SUCCESS;
}
return(rc);
}
DEFINE_PROPERTYSET(clsMyClass, TimeValue)
{
struct example_data *objectData = (struct example_data *)OBJECT_GETDATA();
struct API_EXPRESSION result;
int rc = OBJECT_ERROR;
OBJECT_GETVALUE(&result);
if (result.errno == 0 && result.type == 'T') {
strcpy(objectData->prop_timevalue, DATE_TTOS(result.datetime));
rc = OBJECT_SUCCESS;
}
return(rc);
}
DEFINE_PROPERTYSET(clsMyClass, CurrValue)
{
struct example_data *objectData = (struct example_data *)OBJECT_GETDATA();
struct API_EXPRESSION result;
int rc = OBJECT_ERROR;
OBJECT_GETVALUE(&result);
if (result.errno == 0 && result.type == 'Y') {
strcpy(objectData->prop_currvalue, CURR_YTOS(result.currency));
rc = OBJECT_SUCCESS;
}
return(rc);
}
DEFINE_PROPERTYSET(clsMyClass, CharValue)
{
struct example_data *objectData = (struct example_data *)OBJECT_GETDATA();
struct API_EXPRESSION result;
int rc = OBJECT_ERROR;
OBJECT_GETVALUE(&result);
if (result.errno == 0 && result.type == 'C') {
strcpy(objectData->prop_currvalue, result.character);
rc = OBJECT_SUCCESS;
}
return(rc);
}
DEFINE_PROPERTYSET(clsMyClass, ObjValue)
{
struct example_data *objectData = (struct example_data *)OBJECT_GETDATA();
OBJECT objvalue;
int rc = OBJECT_ERROR;
if (OBJECT_GETTYPE() == 'O') {
objvalue = OBJECT_GETOBJECT();
objectData->prop_objvalue = OBJECT_ASSIGN(objvalue, objectData->object_name);
rc = OBJECT_SUCCESS;
}
return(rc);
} SE Linux is a feature of the Linux kernel that provides mandatory access control. This policy based access control system grants far greater control over the resources on a machine than standard Linux access controls such as permissions.
Many modern Linux distributions are shipping with SELinux enabled by default, Fedora 14 and Rhel 6 both install with it enabled.
When you run Recital Web on a SELinux enabled machine and navigate to the default.rsp page you will see something similar to the screen shot below.

If you launch the SELinux troubleshooter you will see the following problem.
SELinux is blocking the apache server from accessing the Recital server running on port 8001.

To manage you SELinux policy you must have the policycoreutils package group installed. The policycoreutils contains the policy core utilities that are required for basic operation of a SELinux system.
If you wish to use a GUI tool, you must install the policycoreutils-gui package.
At the command prompt execute the following:
As root
$ yum install policycoreutils
$ semanage port -a -t http_port_t -p tcp 8001
$ service recital restart
$ service httpd restart
We use the semanage command here to allow the http server access to port 8001. Once you have completed the steps detailed above you can go and navigate back to the default.rsp page in your borwser, where you will find the permission denied message is now replaced by the default.rsp page.

SELinux does a great job of restricting services and daemons so rather than simply disabling it, why not work with it!
When it comes to security, every little bit helps...
This article looks at the range of client access mechanisms for Windows that can be used with the Recital C-ISAM Bridge and details bridge configuration and usage.
Overview
Just because the format of data is regarded as 'legacy' does not make that data in any way obsolete. Modern client interfaces can not only extend the life of long-term data, but also provide different ways to analyse and gain advantage from that data.
Recital Corporation provides a range of solutions to interface to Informix compliant C-ISAM data on Linux or UNIX from Windows clients.
.NET
Click image to display full size
Fig 1: Recital Mirage .NET application accessing the C-ISAM Demo table.
Recital offers two alternative ways to access C-ISAM data using Microsoft .NET:
The Recital .NET Data Provider is a managed Data Provider written in C# that provides full compatibility with the Microsoft SQLserver and OLE DB data providers that ship with the .NET framework. It is fully integrated with the Visual Studio .NET IDE supporting data binding and automatic code generation using the form designer. The Recital .NET Data Provider works in conjunction with the Recital Database Server for Linux or UNIX to access C-ISAM data.
Recital Mirage .NET is a complete solution for migrating, developing and deploying 4GL database applications. Recital Mirage .NET works in conjunction with the Recital Mirage .NET Application Server for Linux or UNIX to access C-ISAM data.
JDBC
Click image to display full size
Fig 2: Java™ Swing JTable accessing the C-ISAM Demo table via the Recital JDBC Driver.
The Recital JDBC Driver is an all Java Type 4 JDBC 3.0 Driver, allowing you to access C-ISAM data from Java applets and applications. The Recital JDBC Driver works in conjunction with the Recital Database Server for Linux or UNIX to access C-ISAM data.
ODBC
Click image to display full size
Fig 3: Microsoft® Office Excel 2003 Pivot Chart and Pivot Table accessing the C-ISAM Demo table via the Recital ODBC Driver.
The Recital ODBC Driver is an ODBC 3.0 Driver, allowing you to access C-ISAM data from your preferred ODBC based Windows applications. You can develop your own applications in languages such as C++ or Visual Basic, manipulate the data in a spreadsheet package or word processor document and design charts, graphs and reports. The Recital ODBC Driver works in conjunction with the Recital Database Server for Linux or UNIX to access C-ISAM data.
Configuring the Recital C-ISAM Bridge
Data access is achieved through a C-ISAM Bridge. This requires the creation of an empty Recital table that has the same structure as the C-ISAM file and of a RecitalC-ISAM Bridge file.
On Linux and UNIX, Recital Terminal Developer and the Recital Database Server come complete with an example C-ISAM data file, C-ISAM index and Recital C-ISAM bridge that can be used for testing and as a template for configuring your own C-ISAM bridges. The Recital Database Server also includes a bridge creation ini file.
Step 1:
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 SQL CREATE TABLE command can be called directly:
SQLExecDirect:
In: hstmt = 0x00761BE8,
szSqlStr = "CREATE TABLE cisamdemo.str (DD Char(4)
DESCRIPTION "Dd...", cbSqlStr = -3
Return: SQL_SUCCESS=0
or be included in a 4GL program:
// createtab.prg
CREATE TABLE cisamdemo.str;
(DD Char(4) DESCRIPTION "Dd",;
CONFIRM Char(6) DESCRIPTION "Confirm",;
PROCDATE Char(6) DESCRIPTION "Procdate",;
CONTROL Char(5) DESCRIPTION "Control",;
DOLLARS Decimal(13,2) DESCRIPTION "Dollars",;
DEALER Char(5) DESCRIPTION "Dealer",;
TERRITORY Char(2) DESCRIPTION "Territory",;
WOREP Char(12) DESCRIPTION "Worep",;
CURRTRAN Char(3) DESCRIPTION "Currtran",;
TRADDATE Char(6) DESCRIPTION "Traddate",;
CITY Char(10) DESCRIPTION "City",;
ACCOUNT Char(11) DESCRIPTION "Account",;
PRETRAN Char(2) DESCRIPTION "Pretran",;
AFSREP Char(14) DESCRIPTION "Afsrep",;
REPKEY Char(9) DESCRIPTION "Repkey",;
BRANCH Char(3) DESCRIPTION "Branch",;
WODEALER Char(5) DESCRIPTION "Wodealer",;
BANKCODE Char(2) DESCRIPTION "Bankcode",;
COMMRATE Decimal(6,4) DESCRIPTION "Commrate",;
NEWREP Char(1) DESCRIPTION "Newrep",;
SETTLE Char(1) DESCRIPTION "Settle",;
POSTDATE Char(6) DESCRIPTION "Postdate")
if file("cisamdemo.str")
return .T.
else
return .F.
endif
// end of createtab.prg
Server-side 4GL programs can be called by all clients, e.g. from a Java class with a JDBC connection:
//---------------------------------
//-- create_str.java --
//---------------------------------
import java.sql.*;
import java.io.*;
import Recital.sql.*;
public class create_str {
public static void main(String argv[]) {
try {
new RecitalDriver();
String url = "jdbc:Recital:" +
"SERVERNAME=cisamserver;" +
"DIRECTORY=/usr/recital/data/southwind;" +
"USERNAME=user;" +
"PASSWORD=password";
Connection con = DriverManager.getConnection(url, "user", "pass");
Statement stmt = con.createStatement();
CallableStatement sp = con.prepareCall("{call createtab}");
boolean res = sp.execute();
String outParam = sp.getString(1);
System.out.println("Returned "+outParam);
sp.close();
con.close();
} catch (Exception e) {
System.out.flush();
System.err.flush();
DriverManager.println("Driver exception: " + e.getMessage());
e.printStackTrace();
}
try {
System.out.println("Press any key to continue...");
System.in.read();
} catch(IOException ie) {
;
}
}
}
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 article for information on matching Informix and Recital data types

Fig 4: Recital CREATE/MODIFY STRUCTURE worksurface for character mode table creation.
Step 2: Creating the Bridge File
If you have Recital installed on the server platform, the Bridge File can be created using the CREATE BRIDGE worksurface. The corresponding command to modify the bridge file is MODIFY BRIDGE <bridge file>. This is the cisamdemo.dbf bridge file in the CREATE/MODIFY BRIDGE WORKSURFACE:
> modify bridge cisamdemo.dbf

Fig 5: Recital CREATE BRIDGE/MODIFY BRIDGE worksurface for bridge creation.
For Recital Database Server clients, the Bridge File can be created using the Recital/SQL CREATE BRIDGE command:
Recital/SQL CREATE BRIDGE:
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"
The examples above assume that the C-ISAM file, the bridge file and the Recital structure file are all in the current working directory. Full path information can be specified for the <externalname> and the <databasename>. For added flexibility, environment variables can be used to determine the path at the time the bridge is opened. Environment variables can be included for either or both the <externalname> and the <databasename>. A colon should be specified between the environment variable and the file name.
e.g.
CREATE BRIDGE cisamdemo.dbf; TYPE "CISAM"; EXTERNAL "DB_DATADIR:cisamdemo"; METADATA "DB_MIRAGE_PATH:cisamdemo.str"; ALIAS "cisamdemo"
Recital CREATE BRIDGE/MODIFY BRIDGE worksurface:

Fig 6: Recital CREATE BRIDGE/MODIFY BRIDGE worksurface - using environment variables.
Using the Bridge
The Bridge can now be used. To access the C-ISAM file, use the ‘alias’ specified in the Bridge definition.
SQL:
SELECT * FROM cisamdemo
Recital/4GL:
use cisamdemo
Indexes
The cisamdemo.dat file included in the Recital distributions for Linux and UNIX has three associated index keys in the cisamdemo.idx file:
Select area: 1 Database in use: cisamdemo Alias: cisamdemo Number of records: 4 Current record: 2 File Type: CISAM (C-ISAM) Master Index: [cisamdemo.idx key #1] Key: DD+CONFIRM+PROCDATE+CONTROL Type: Character Len: 21 (Unique) Index: [cisamdemo.idx key #2]
Key: DD+SUBSTR(CONFIRM,2,5)+TRADDATE+STR(DOLLARS,13,2) +CURRTRAN+ACCOUNT Type: Character Len: 42 Index: [cisamdemo.idx key #3] Key: DEALER+BRANCH+AFSREP+SUBSTR(PROCDATE,5,2) +SUBSTR(CONTROL,2,4) Type: Character Len: 28
The Recital C-ISAM bridge makes full use of the C-ISAM indexes. SQL SELECT statements with WHERE clauses are optimized based on any of the existing indexes when possible. The following ODBC SELECT call makes use of key #3 rather than sequentially searching through the data file.
SQLExecDirect:
In: hstmt = 0x00761BE8,
szSqlStr = "select * from cisamdemo
where dealer+branch+afsrep=' 00161 595-7912",
cbSqlStr = -3
Return: SQL_SUCCESS=0
Get Data All:
"DD", "CONFIRM", "PROCDATE", "CONTROL", "DOLLARS", "DEALER",
"TERRITORY", "WOREP", "CURRTRAN", "TRADDATE", "CITY", "ACCOUNT",
"PRETRAN", "AFSREP", "REPKEY", "BRANCH", "WODEALER", "BANKCODE",
"COMMRATE", "NEWREP", "SETTLE", "POSTDATE"
"0159", " 15522", "930312", "13356", 4992.60, "00161", "19",
"", "210", "930305", "", "70000100009", "", "595-7912",
"930315791", "", "", "59", 0.0000, "1", "", "930315"
1 row fetched from 22 columns.
Using the Recital/4GL, the primary index is set as the master index when the bridge is first opened. Any secondary indexes can be selected using the SET ORDER TO <expN> command. The Recital/4GL SEEK or FIND commands and SEEK() function can be used to search in the current master index.
> SET ORDER TO 3 Master index: [cisamdemo.idx key #3] > SEEK “00161 595-7912”
Appendix 1: 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 |
Appendix 2: C-ISAM RDD Error Messages
The following errors relate to the use of the Recital CISAM Replaceable Database Driver (RDD). They can be received as an ‘errno <expN>’ on Recital error messages:
|
ERRNO() |
Error Description |
|
100 |
Duplicate record |
|
101 |
File not open |
|
102 |
Invalid argument |
|
103 |
Invalid key description |
|
104 |
Out of file descriptors |
|
105 |
Invalid ISAM file format |
|
106 |
Exclusive lock required |
|
107 |
Record claimed by another user |
|
108 |
Key already exists |
|
109 |
Primary key may not be used |
|
110 |
Beginning or end of file reached |
|
111 |
No match was found |
|
112 |
There is no “current” established |
|
113 |
Entire file locked by another user |
|
114 |
File name too long |
|
115 |
Cannot create lock file |
|
116 |
Memory allocation request failed |
|
117 |
Bad custom collating |
|
118 |
Duplicate primary key allowed |
|
119 |
Invalid transaction identifier |
|
120 |
Exclusively locked in a transaction |
|
121 |
Internal error in journaling |
|
122 |
Object not locked |
// declare some simple procedures
proc display(cArg)
echo "display=" + cArg
endproc
proc show(cArg)
echo "show=" + cArg
endproc
// create an object based on an anonymous class
myobj = new object()
// add some properties
myobj["name"] = "barry"
myobj["company"] = "recital"
// now declare an anonymous method
myobj["mymethod"] = display
// call the method
myobj.mymethod("hello world") // displays "display=hello world"
// redeclare the method
myobj["mymethod"] = show
// call the method
myobj.mymethod("hello world") // displays "show=hello world"
Where this becomes particularly useful is when you have a procedure that calls anonymous methods in order to process data. This technique can be used to call anonymous procedures in your code.
proc processdata(oArg)
oArg.mymethod(oArg.name)
endproc
proc show(cArg)
echo "show=" + cArg
endproc
myobj = new object()
myobj["name"] = "barry"
myobj["mymethod"] = show
processdata(myobj) // displays "show=barry"