Product Documentation

c-treeRTG COBOL Edition User's Guide

Previous Topic

Next Topic


The instance element specifies instance-wide configurations for the client/server driver. Each instance represents a connection to the c-treeRTG server.

If ctree.conf has no instance defined, it will default to using the default server: FAIRCOMS@localhost




Default value


Specifies the server name and the host name of the c-treeRTG to connect to. The format can be one of the following syntaxes:




If the host name or the IP address is omitted, host name defaults to localhost.



Specifies the c-treeRTG user name.



Specifies the c-treeRTG user password. See the authfile attribute for a way of storing the password in an encrypted format.



Indicates whether to connect to c-treeRTG at runtime initialization or to wait for the first OPEN operation.

It accepts the following values:

  • "yes" : Indicates to connect at runtime initialization.
  • "no" : Indicates to connect during the first OPEN operation. This is the default value.



Indicates whether to check that the c-treeRTG driver version matches the c-treeRTG server version. This option is turned off by default.

It accepts the following values:

  • "yes" : Turn on version matching check. Versions must match exactly otherwise an error is returned at runtime initialization.
  • "no" : Turn off version matching check. This is the default value.

    See Version Checks below.



Specifies the name of the instance to identify COBOL connections in CTADMN and other tools. Substitution specifiers can be used to set the <instance name=""> attribute:

  • %p Expands to process ID of the instance affected by configuration
  • %t Expands to thread ID of the instance affected by configuration
  • %i Expands to the instance ID number



Specifies an encrypted authorization file created with the ctcmdset utility. If both authfile and user are specified, authfile takes precedence.



Specifies if a secure connection will be used to connect to c-treeRTG server. It accepts "yes" or "no" as values and defaults to "no".
<instance ssl="yes|no">
See SSL Communication Support.



Specifies the file accessible from the c-treeRTG driver containing the server public certificate.
<instance sslcert="cert_file">



By default, the byte endianess is checked at connection time. When set to "no", that check can be skipped. The default is "yes." See the "Endian Check" note below.



Configure the c-treeRTG server to change the default shared memory directory. See "Shared Memory: note below.



<instance server="FAIRCOMS@" user="admin" password="ADMIN" connect="yes" versioncheck="no">



This example shows SSL with a certificate file called ctsrvr.pem:

<instance server="FAIRCOMS@" user="admin" password="ADMIN" ssl="yes" sslcert="ctsrvr.pem">



Version Checks

versioncheck="yes" should not be used in your instance settings unless explicitly instructed to do so. This option enables a strict client server compatibility check which may prevent desired clients from connecting to existing servers when different versions may be expected. The following error can be observed when this check is enabled:

./ctutil Version

Initialized from (ctree.conf)

Client/server incompatibility.

The following may be found in your c-treeRTG debug log when enabled:

9CE2E200> 20181026T103823 api:0310:ctl_init INFO client version: id:34

9CE2E200> 20181026T103823 api:5719:ctl_conffi DEBUG FILE "odh1db" matches rule <file name="*" dir="*" type="*">

9CE2E200> 20181026T103823 api:4852:ctl_setins INFO server version: id:34

9CE2E200> 20181026T103823 api:0451:ctl_compat ERROR 37:-4:0 client/server incompatibility: <>

Remove this option or change to versioncheck="no" to avoid these errors. This check can be considered in testing environments before production deployment to ensure absolute client server compatibility.

Endian Check

The c-treeRTG data files do not have file schema ("DODA" in c-tree terminology), therefore c-treeRTG cannot take advantage of FairCom's Netformat communication logic, which automatically flips bytes between dissimilar platforms. This logic checks at connection time to ensure that the byte endianness of both client and server is the same (if it is not, the connection is terminated and the operation fails). In cases where this logic is not necessary (e.g., files without numeric data types), the byte endianess check can be relaxed so the connection can succeed.

The configuration attribute <instance endiancheck="no"> allows skipping the byte endianess check. This attribute defaults to "yes."

<instance ctshmemdir> to Set Shared Memory Directory under Unix

On Unix platforms, the c-treeRTG server shares a directory with the c-treeRTG clients when they communicate via the shared memory protocol. It is possible to configure the c-treeRTG server to change the default shared memory directory with configuration keyword SHMEM_DIRECTORY. Using different shared memory directories allows running multiple c-treeRTG servers with the same name on the same machine. To configure the c-treeRTG clients to set the shared memory directory, it is necessary to set the c-tree global variable ctshmemdir.

This revision implements a new <instance ctshmemdir> attribute to configure the shared memory directory for the <instance> by setting the c-tree global variable ctshmemdir.

The <instance ctshmemdir> is ignored under Windows as it is meaningful only for Unix platforms.

Dynamically Setting Attributes

Environment Variables

The <instance> attributes server, user, and password can be set dynamically through environment variables. The syntax is the same as described in Substitution Specifiers topic:

%(ENV) expands to the value of the environment variable ENV.

Any environment variable can be used. Simply specify its name in place of ENV in %(ENV).

For example:

<instance server="%(SERVNAME)@%(HOSTNAME)" user="%(USERNAME)" password="%(PASSWORD)"/>

Only server, user, and password can be set using environment variables.


If a password is not specified in the configuration file through the <instance password> attribute, it is possible to specify the password in the URL that it is used to open the file.

For example, if the ctree.conf contains the following <instance> definition:

<instance server="servname@hostname" user="username"/>

any connection would fail if username password has been set in c-tree Server because the <instance> does not have a password attribute. But opening the file with the following URL would specify the password and therefore be able to connect:


Warning: It is never advisable to send passwords "in the clear" (where they are visible), such as in a URL. This feature is provided only for environments where security is not an issue, such as a test environment.

Using Multiple Instance Tags

The following is an example of a multi-tenant environment with multiple c-treeRTG servers (FAIRCOMS@server1, FAIRCOMS@server2, and FAIRCOMS@server3), each with its own instance tag:


<instance server="FAIRCOMS@server1" name="%(RTG_INSTANCE)">

<log file="/data/ctree.log">y</log>

<file name="ps*">

<prefetch records="30">yes</prefetch>


<file name="cc*">

<prefetch records="10">yes</prefetch>


<file> </file> <!-- default file matching rule -->


<instance server="FAIRCOMS@server2" name="%(RTG_INSTANCE)">

<file name="custfile1">


<file name="custfile2">



<instance server="FAIRCOMS@server3" name="%(RTG_INSTANCE)">

<file name="orderfile">




Notice the instance tag for each of the three servers:

  • FAIRCOMS@server1 establishes a log file, ctree.log, and prefetches certain files that are specified using wild cards (ps* and cc*).
  • FAIRCOMS@server2, handles files custfile1 and custfile2.
  • FAIRCOMS@server3, handles orderfile.

FAIRCOMS@server1 includes a default file matching rule: <file> </file>. This rule ensures that c-treeRTG can handle any possible file, including files that do not match any other rules. Because it matches all files, it should be placed after all other rules. A default file matching rule is required when using multiple instances.