Question:
Can I set the iscobol.file.index or iscobol.file.index.FileName variables inside my COBOL program?
My application reads a file which has information about which file system to use for each data file.
Some data files are Jisam. Others are in Oracle. My application allows the user to choose which files to create in the database. So I need to set this programmatically.
How do I do that in isCOBOL?
Answer:
You can set both "file.index" and "file.index.
Note that you don't use the 'iscobol.' at the beginning of the property name when you set properties with SET ENVIRONMENT.
For instance, if your users want file1 to be a database, you would set this in your properties file:
iscobol.file.index=jisam
and in your program set that file's file handler dynamically:
set environment "file.index.file1" to "easydb"
In versions 2022R2 and later, you can also set or change the CLASS clause for each file "on the fly" by using a hook program.
Write a program to set file.class to whatever file handler you want, and set that program as a hook using:
iscobol.file.index.open_hook=[hook_program_name]There is a sample of this in the installed samples folder, under extend-and-customize/file-open-hook.
Article ID: 90
Created: September 2, 2009
Last Updated: January 27, 2023
Author: Support KB Author
Online URL: https://support.veryant.com/phpkb/article.php?id=90