Commodore
Commodore
391 views

Visual COBOL, DB Connectors, and Non - Database data

Jump to solution

I have a Visual COBOL project that uses DB Connectors.  In my project, my programs ALSO read and write to files that are NOT in my SQL database. 

My question is where or how do I setup the path so the programs and find those files?

In RM/COBOL we have the RMPATH, is there something like that with Visual COBOL?

0 Likes
1 Solution

Accepted Solutions
Micro Focus Expert
Micro Focus Expert

I think that COBDATA is what you are looking for.

See the docs here:

View solution in original post

0 Likes
4 Replies
Micro Focus Expert
Micro Focus Expert

You need to exclude these files from XFD generation if you wish to have them still be used as indexed files in your programs.

You can do this by surrounding them with an IDXFORMAT or FILETYPE directive.

Example:

$SET CREATEXFD

$SET IDXFORMAT"18"      *>SQL Server file
      select db-file1 assign to "mydb"
                                     organization is indexed
                                     access is dynamic
                                     key is key-1.
$SET IDXFORMAT"0"       *> default MF ISAM file

      select if-file1 assign to "myif"
                                     organization is indexed
                                     access is dynamic
                                     key is key-2.

$SET IDXFORMAT"18"      *>SQL Server file              

      select db-file2 assign to "mydb2"
                                     organization is indexed
                                     access is dynamic
                                     key is key-3.

 

The directive is in effect until it encounters another directive which will change the default.

You can also set this in an extfh.cfg file:
See the docs here:

0 Likes
Commodore
Commodore

NO, that is not what I'm saying. 

I have files IN ADDITION to my SQL DB that I need to read as INPUT into my programs, or OUTPUT so a 3rd party can use a file.

I need to know how to tell my COBOL programs where to look to find/write the files.

In RM/COBOL we have the RMPATH, is there something like that with Visual COBOL?

 

 

 

0 Likes
Micro Focus Expert
Micro Focus Expert

I think that COBDATA is what you are looking for.

See the docs here:

View solution in original post

0 Likes
Admiral
Admiral

Do you use in this way Mysql as database?

i connect correctly as mssql and use only SQL commands!

the db-database and files are found automaticaly with the connect over ip or Name, i use here a connectstring

Example: admfirm.ini with following lines:
[SQL-Server]
ConnectString=Driver=SQL Server;server=192.168.13.63;database=admfirm;uid=adm;pwd=adm;

i read this file first and then make the connect, so i am very dynamic

For the isam-file (non db-files) i use a filename holder

01  fileholder1       pic x(255).
01  path1               pic x(255).
01  filename1        pic x(255).

then i use one cfg-file for a application and read here the path and string path and filename

adm.cfg
ADMDAT=I:\ADM\ADMFIRM\DATEN\
ADMPRT=I:\ADM\ADMFIRM\DATEN\PRT\
ADMPRG=I:\ADM\ADMFIRM\PROG\
etc.....
i read this file and string the correct path and filename, example moving Content after ADMDAT in variable path1

move ' ' to fileholder1
string path1 delimited by ' '
          filename1 delimited by ' '
          into fileholder1
end-string

           SELECT FILENAME       ASSIGN TO FILEHOLDER1

i hope this help you and you can enjoy, so you can work simply with your applications!
                

When you have better solution, i will also enjoy and i am ready to learn more!!!

 

 

 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.