Can I use COBFILEIO to give access to my c-tree files to a Java program?

Question ID : 326
Created on 2022-04-08 at 3:30 AM
Author : Veryant Support [support@veryant.com]

Online URL : http://support.veryant.com/support/phpkb/question.php?ID=326



Yes, it is possible. Because the isCOBOL runtime framework uses a dynamic file handler and the COBFILEIO generated routines rely on that file handler directly.

The generation and compilation of the COBFILEIO OOP COBOL and Java Exception classes is the same as if you were going to access JISAM files.
It is at runtime that you need to set the following property to access the C-tree file system instead of JISAM:

   iscobol.file.index=ctreej
A good way to test this is by using the sample provided with the isCOBOL SDK. It can be found in the sampleis-javajava-uses-cobfileio sub-folder under the isCOBOL SDK installation folder.

Create an iscobol.properties in that folder and include the following lines in it:

   iscobol.file.index=ctreej
   iscobol.file.prefix=[full path to the test c-tree files folder]
(make sure that folder for the c-tree files exist in advance)

Then use the test-cobfileio.bat under Windows or test-cobfileio.sh under Linux to generate and compile the COBFILEIO classes and run the java test class.

The following screenshot shows how that test can be run. (It has the Javadoc generation commented out to make it simpler.)



Back to Original Question