Accessing MFDBFH-Hosted Data from a Standalone COBOL Program

If you host a data file in an MFDBFH datastore, and the COBOL program used to access the data is not running through an enterprise server, the (standalone) COBOL program must use the specific sql:// syntax within a SELECT statement to access it.

The environment in which the program runs must also have the MFDBFH_CONFIG and ES_DB_FH variables correctly configured, and the program must be compiled with the INITCALL"DBFHINIT" Compiler directive (which initializes the database file handler).

The syntax of the SELECT statement is largely the same as when handling files on disk; the difference is the format of the ASSIGN clause, which must use the same sql:// syntax that is used for the MFDBFH utilities such as dbfhdeploy and dbfhview; see The Datastore URL. For example: to handle a data file called tees, which is stored in the INVENT folder of the STOCK datastore, a SELECT statement might look like this:

       select tee-stock 
         assign "sql://MYSRV/STOCK/tees?folder=INVENT"
         organization is indexed
         record key is scode
         file status is ws-fs.
Tip: To view updates made to the data file, you can create a database view (see Examples of the dbfhview Command Line Utility), or open the file directly from the Data File Editor.