Let's attempt to open the file without the name of Fileshare server as part of the filename.
Create a new test program:
cp rfspets01.cbl rfspets02.cbl
Modify the select as follows:
FILE-CONTROL. SELECT pets-file ASSIGN TO "/home/test/file_share/fspets" ORGANIZATION IS INDEXED ACCESS IS DYNAMIC RECORD KEY IS patient-id FILE STATUS IS pets-file-status.
Now compile and run your program:
cob rfspets02.cbl anim nognt ; cobrun rfspets02
The program should return all of the data from the file. There is a problem with this run, however. In the window from which you ran the Fileshare server, you will notice that this run did not produce any tracing messages. This is because instead of accessing the file through Fileshare, this time the program accessed the file directly. In order to have the program access the file through Fileshare, file handler must be instructed to redirect the file access.
Let's set up an EXTFH configuration file to instruct the file handler to redirect file access. First, we tell the file handler where to find the configuration file. Enter the following command:
export EXTFH=`pwd`/extfh.cfg
Edit a file in the current directory called extfh.cfg and add the following entry:
[/home/test/file_share/fspets] FHREDIR=ON
For the final step, the file handler must be instructed to use our Fileshare Server. First, specify the location of the configuration file for redirection. Enter the following command:
export FHREDIR=`pwd`/fsredir.cfg
Now create a file called fsredir.cfg and add the following entry:
-s JSRV01
This instructs the file handler to send the requests to our server. Now re-run your application with the following:
cobrun rfspets02
In the Fileshare Server window, you should see the tracing information.
Now modify the configuration file for MFXDBC to access files in the same way as rfspets02. To do this modify your mfdbc.cfg file to look like this:
#file_prefix ;/home/test/mf_data ;/home/test/sample/mfdbc/mfu_data #file_prefix ;/home/test/mf_data ;/home/test/sample/mfdbc/mfu_data ; $$JSRV01//home/test/file_share file_prefix ;/home/test/mf_data ;/home/test/sample/mfdbc/mfu_data ;/home/test/file_share
Now from within mfsql.sh issue the command:
SQL (/? for help) ==> select * from fspets;
In the Fileshare Server window, you should see the tracing information.