Now we will attempt to open files without the Fileshare server or the path as part of the filename.
Create a new test program:
cp rfspets01.cbl rfspets03.cbl
Modify the SELECT statement as follows:
FILE-CONTROL. SELECT pets-file ASSIGN TO “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 rfspets03.cbl anim nognt ; cobrun rfspets03
When you run the program, the following message is received:
Final file status: 47
We have not told the file handler where to locate the file this time. To correct the problem, edit your extfh.cfg file and add the following entry:
[fspets] FHREDIR=ON DATAFILE="/home/test/file_share/fspets
This tells the file handler to redirect the file access and where to find the file.
Rerun your application, and 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 rfspets03. 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 file_prefix ;/home/test/mf_data ;/home/test/sample/mfdbc/mfu_data ;.
Now from within mfsql.sh issue the command:
SQL (/? for help) ==> select * from fspets;
You will receive the error:
select * from fspets ***** ERROR: MFEXTFH: Cannot open 'fspets',File not found
We have not told the file handler where to locate the file again. This is because the name of the file we are attempting to open is ./fspets. To correct the problem, edit your extfh.cfg file and add the following entry:
[./fspets] FHREDIR=ON DATAFILE="/home/test/file_share/fspets
Rerun your application, and in the Fileshare server window, you should see the tracing information.