Skip to main content

Problem:

It is possible to create a virtual file handler that can replace EXTFH.  This is accessed from a program via the CALLFH directive.  However, this applies globally to a program.  How can it be made to apply to only certain files?

Resolution:

As stated above, there is a restriction that means the CALLFH directive applies to all files defined within a program.  Here are a couple of suggested solutions to this issue:

1) Separate programs.  There is a need to place all the file handling that requires

   EXTFH in one program and the user defined filehandler in another.  The

   advantage is that this is easy to implement and maintain but may make the

   coding of programs more complex.

2) Add intelligence to the user defined filehandler. To add logic to your own

   filehandler to determine the file currently being used.  This will allow

   the programmer to decide what to do e.g. use EXTFH or something else.  This

   option maintains the business logic but adds complexity to the filehandler

   and a small overhead in processing.

To implement option 2 there is a need to access the filename from within the FCD.  This is achieved by using the following line in the file handler.

           set address of lsFilename to fcd-filename-address.

See the online documentation for more details of creating virtual file handlers.

Old KB# 4310

#RMCOBOL
#AcuCobol
#ServerExpress
#COBOL
#netexpress