skip to main content

Accessing from isCOBOL : Creating c-tree files into SQL Server from the COBOL Program

Creating c-tree files into SQL Server from the COBOL Program
In order to create new files directly in c-tree SQL Server, the following property must be set in the configuration:
Only c-tree files will be affected, all other indexed files will not.
Setting the iscobol.sqlserver.iss (boolean) to true is not enough. isCOBOL needs to locate the iss dictionary for the file.
In order to creating the iss dictionary files, COBOL programs containing file descriptions must be compiled with –efc option.
For example:
The isCOBOL Compiler will generate a file named <filename>.iss for each file described in the COBOL program.
Note: c-tree SQL Server doesn’t allow identifiers whose name begins with underscore. If one of the field names in your FD begins with underscore, you should change that name for the iss dictionary by using the EFD NAME Directive.
The path where iss files are located is specified through the following property in the configuration:
iscobol.sqlserver.isspath=path_where_iss_files_are_located
After isCOBOL has read the file information from the iss file, it needs to connect to the SQL Server database. The database name and the user password are passed through the following properties in the configuration:
Between your indexed files there could be some files with the same record definition but different file name. In this case, to avoid creating an iss dictionary for each one of them, you can associate more files to the same iss by creating a mapping.
iscobol.sqlserver.iss.mapping.physical_name_pattern=iss_basename
Wildcards are supported.
For example, suppose you have a file named “customer” for each year, so on disc there are “customer2009”, “customer2008”, “customer2007”, etc. If their FD is the same, you just have to create customer.iss and then set:
Another important issue that should be considered is the sign convention. Ensure that the property iscobol.sqlserver.convention is set to the proper value depending on the data compatibility options in your compiler command line.
It’s possible to include part of the file path in the table name by setting iscobol.sqlserver.dirlevel to a value different than zero. The following table shows some examples:
physical file name: /home/user1/data/file1
It’s possible to customize the name of the table by configuring the replacement performed on the physical file name through the property iscobol.sqlserver.iss.replacement_rules. The following table shows some examples:
physical file name: /home/user1/data/f-cust.cdt
This is a sample configuration that summarizes all the above settings.
Note - iscobol.sqlserver.iss, iscobol.sqlserver.isspath and iscobol.sqlserver.database must always be set, otherwise the automatic link procedure is not performed.
Once all the properties have been correctly set in the configuration, you can create the file in c-tree SQL Server by just opening it for output in the program.
OPEN OUTPUT logical_file_name.

Copyright (c) 2017 Veryant
Contact us
Please share your comments on this manual or on any
Veryant product documentation with the email button at the top left