Product Documentation

c-treeRTG COBOL Edition User's Guide

Previous Topic

Next Topic

Micro Focus and ExtFH Compatible Interfaces

c-treeRTG COBOL Edition supports Micro Focus COBOL and other dialects through the standard Callable File Handler interface, ExtFH. Refer to your COBOL runtime documentation for specific external file handler configuration.

In This Section

Dynamic Redirection

Recompiling Your Application (Optional)

Configuration Note for Micro Focus on 64-bit AIX

Library Unloading Enhancement

Previous Topic

Next Topic

Dynamic Redirection

The client library for Micro Focus is available inside the Driver\ctree.cobol\EXTFH\ folder.

At runtime set the DYNREDIR environment variable to point to the c-treeRTG COBOL Edition driver library as follows:

Windows

set DYNREDIR=CTEXTFH.dll!CTEXTFH

Unix

export DYNREDIR=CTEXTFH.so

When using Micro Focus Visual COBOL for Linux a path can be specified for the DYNREDIR variable.

export DYNREDIR=/usr/local/lib/CTEXTFH.so

When using DYNREDIR with Micro Focus Visual COBOL it is possible to use redirinstance without specifying the library and the func. In this case, the c-treeRTG interface will signal to the COBOL runtime that it does not handle the files and the runtime falls back to the next filesystem specified by DYNREDIR.

When using DYNREDIR, once the CTEXTFH file handler has determined that the file is not in c-tree format, it returns 0 to the COBOL runtime to indicate that it will not perform the I/O operations for the file. Once the COBOL runtime receives 0 from CTEXTFH, the next specified custom file handler in the DYNREDIR, is tried by the COBOL runtime. If no other custom file handler has been specified, the file's I/O operations are processed by the default COBOL File Handler. Opentext Dynamic File Handler Redirection

Previous Topic

Next Topic

Recompiling Your Application (Optional)

There are two methods to instruct Micro Focus COBOL to use the c-treeRTG COBOL Edition file handler:

In This Section

Using the CALLFH Compiler Directive

Specifying c-tree as Indexed File Handler at Link Time

Previous Topic

Next Topic

Using the CALLFH Compiler Directive

Compile your programs with the directive:

$set callfh"CTEXTFH"

Link the FairCom DB CTEXTFH.lib library to your program objects. For example:

COBOL –d –g myprogram.obj _CLASS+CTEXTFH+COBINTFN

This causes all COBOL I/O operations to be compiled into calls to c-treeRTG COBOL Edition driver.

Please be aware that the c-treeRTG COBOL Edition driver implements support only for indexed files. If your application uses other types of files, this approach is not viable. Please consider using the alternative Dynamic Redirection approach instead.

Previous Topic

Next Topic

Specifying c-tree as Indexed File Handler at Link Time

To link c-tree as indexed file handler with a COBOL program, you must specify the following flags on the cob command line:

-m ixfile=CTEXTFH to specify ctree as file handler for fixed record length indexed files

-m ixfilev=CTEXTFH to specify ctree as file handler for variable record length indexed files

This ensures that the necessary external references to the ctree library are included in the resulting executable file, and that they are used instead of the default Micro Focus File Handler.

Examples

cob -x prog.cbl -m ixfile=CTEXTFH -m ixfilev=CTEXTFH CTEXTFH.so

Previous Topic

Next Topic

Configuration Note for Micro Focus on 64-bit AIX

When configuring c-treeRTG for Micro Focus on 64-bit AIX systems, you will need to use the following settings:

  • The <redirinstance> properties in the c-treeRTG configuration file, ctree.conf, should be set as follows:

    lib="libcobrts64.so" func="EXTFH"

    For example:

    <redirinstance lib="libcobrts64.so" func="EXTFH">

    ...

    </redirinstance>

  • An AIX environment variable must be set as follows:

    LDR_PRELOAD64=$COBDIR/lib/libcobrts64.so

Previous Topic

Next Topic

Library Unloading Enhancement

When Micro Focus COBOL runtime is done using the file-handler, it does not make an EXTFH call (usually before terminating) to de-initialize the file-handler. We used to de-initialize c-tree at file close or at transaction end when there were no more open files and no running transactions. This released c-tree resources as soon as possible including the file pool and memory files. When a new file was opened, c-tree re-initialized.

Now a new strategy has been implemented by detecting the library loading and unloading and de-initializing c-tree at library unload. This new behavior is now the default and can be controlled by the new configuration keyword <exfthexit>.

TOCIndex