Special File Handling
*TBRED* Direct Access to Thoroughbred® Files
  This functionality is a +PxPlus Exclusive
Format OPEN (chan[,option])"*TBRED*;FILE= hostfile "

Where:

chan Channel or logical file number.
options BSZ=num File option for specifying record size (number of bytes). The default record size is 1,024 bytes unless it is overridden via BSZ=.
hostfile The hostfile text contains the name of the file as it would be seen from the server process..
*TBDIO* Logical file name (not case-sensitive).
   
Description The TBDIO File IO server provides remote read/write access to Thoroughbred® keyed and indexed files. Access to the files is provided through TCP/IP to a PxPlus server running the PLUSTIO.pls program on your host Unix/Linux system. The TBDIO takes the requests and pipes them through to a Thoroughbred® application program that itself performs the IO thereby assuring proper data formatting and file integrity.

From the application perspective, you have three options to access the TBDIO server:

   
Method 1 Object Interface:

The actual TBDIO interface is provided by the object "*plus/obj/tbdio" which can be called directly to access the files remotely.

Create the object "*plus/obj/tbdio" and use the methods to read/write/remove records.

a = new("*plus/obj/tbdio", "name_of_server")
chnl = a'Open("file")
a'ReadNext(chnl, bfr$)
...
a'Close(chnl)

The object interface provides basic methods to open, close, read, write, and remove records. Additional methods are provided to obtain the next KEY, record IND, and FID of the files.

 
Method 2 Using *TBRED*:

You can use the "*TBRED* file declaration to open the file as in "*tbred*;file=XXXXX" where XXXXX is the file on the Thoroughbred® server

%TBDIO_Server$="name_of_server"

OPEN (chnl) "*tbred*;file=XXXXX"

By setting the name of the TBDIO server in the global variable %TBDIO_Server$, you can then directly access any file from the server by opening the logical file name *TBRED*. The pathname (or OPT=) must be followed by a FILE= option that declares the name of the desired file on the server. If desired, you can also supply a SERVER= option in the pathname (or OPT=) with the name of the TBDIO server.

Once this file is opened, your application can issue normal Read/Write/Remove/Close directives against the file along with Key/Ind/Fid functions.


 
Method 3 Direct File Open:

If you do not want to change your OPEN statements, you can create a link file accessible from the PxPlus session, which links to the 'tbdio' driver to open the remote file.

The system is provided with a standard link file "_tbred_" that can be found in the PxPlus lib directory. Copy this link file to a new file (use the name of the file you wish to open in Thoroughbred®). Now, when the system opens this file it will connect to the TBDIO server and it will attempt to open a Thoroughbred® file of the same name.

For example:

copy <pxplus directory>/lib/_tbred_ MYCUST

Now when you OPEN (1) "MYCUST" the system will logically issue an OPEN (1) "*tbred*;FILE=MYCUST". This allows you to have a transparent access to the TBDIO serviced files from your application programs.

 
Supported functionality The TBDIO interface support the following directives/functions:
Directives Functions
OPEN KEY( )
READ KEF( )
WRITE KEL( )
EXTRACT KEP( )
REMOVE IND( )
CLOSE FIB( )
   
Technical Background The TBDIO Server consist of three components the PxPlus TCPIP server program, the TBDIO IO service program and a default IPLINPUT that is used to access Thoroughbred®. The server itself is designed to be run in background on your Unix server in the directory where you have the Thoroughbred® installed and where you execute the command to launch it (./b).

The files provided in the *plus/tbdio directory (<pxplus dir>/lib/_plus/tbdio) are as follows:

  • PLUSTIO.pls - PxPlus server program
  • PLUSTIO.tbd - Thoroughbred® file access module
  • PLUSTIO.ipl - IPLINPUT for the process

In order to run the TBDIO server, you must first copy these from the PxPlus library into your Thoroughbred® directory. Once the files have been copied, you can run the server. Note: you will need to modify the IPLINPUT to access you data directories.

The server, when run, expects two arguments to be passed to it from the command line:

arg 1 - Port number (default is 20,000 if not specified)
arg 2 - Shutdown password

Once initiated, the TBDIO server will launch the sub process and begin accepting requests.

While the server itself can be killed, the best way to terminate the server is to use the Object interface 'Shutdown method. When it is called, a request will be sent to the server to shutdown. For security purposes, you have to pass the 'Shutdown method the same password you specified in Arg2 for it to take effect otherwise the shutdown command is ignored.

A typical command line to run the server would be:

/pxplus/pxplus PLUSTIO.pls -arg 20000 TaTa4Now

We suggest including this in your system 'inittab' tables.

   
   


*Note* The system is limited to 100 files being opened concurrently.


MSORT files The *TBRED* interface supports MSORT files and the use of Alternate keys.

The SORT names are automatically converted into alternate key names. In addition, you can access the files using either the SORT name or by key number. In this case, the first SORT name becomes key number 0; the second becomes key number 1, etc.

The FIN (nn, "KEY_NAMES") can be used to retrieve the list of SORT names.

   
  Thoroughbred® is a registered trademark of Thoroughbred Software International, Inc