Creating Your Own File Handler

You can create your own, customised, file handler and use this in place of the File Handler supplied with your COBOL system.

To force programs to use your file handler for processing COBOL I/O syntax, use the CALLFH Compiler directive. For example, if you have a file handler called USERFH, compile your programs with the directive:


This causes all COBOL I/O operations to be compiled into calls to USERFH.

Alternatively, you can create a custom file handler that is dynamically loaded and invoked at run time by the Micro Focus File Handler. This removes the need to recompile the COBOL program performing the file I/O. For more information, see the section Dynamic Redirection to a Custom File Handler.

  • You must specify the NOCANCEL directive to stop your handler being canceled at STOP RUN before all the user programs have been canceled.
  • If you use CBL_EXIT_PROC, you must set the priority to 200, so that when the application calling your file handler terminates, your file handler shuts down properly.