Declaring User-Written Filters

Instead of using GenFormat to define your filters, you can also write your own ALGOL filter (refer to the DATABridge Programmer’s Reference for information about user-written filters), you must specify it when you declare the filter in the GenFormat parameter file.

There are three ways to declare user-written filters:

  • INTERNAL FILTER
  • EXTERNAL FILTER
  • $ INCLUDE

When you declare an INTERNAL, EXTERNAL, or $ INCLUDE filter, you cannot use any other filter options with that filter.

INTERNAL FILTER

Use the INTERNAL FILTER statement to include you user-written filter as a patch file when the Support Library is compiled. In an INTERNAL FILTER, you can declare a procedure name, a procedure heading, and global data. Using INTERNAL FILTER rather than the $ INCLUDE type of filter is preferred because it allows you to declare data global to the filter procedure and the procedure heading is in the patch file.

Use the following syntax to declare an INTERNAL FILTER:

INTERNAL FILTER filtername IN "patchfiletitle"

where patchfiletitle is the title of an ALGOL source file containing a patch for the Support Library that declares a filter whose name is filtername. Note that if you have Accessories running under a different usercode from where the DATABridge software is installed and you want to use the automatic recompilation of the Support Library feature, you must include the usercode and pack name where the patch file resides in patchfiletitle.

EXTERNAL FILTER

Use the EXTERNAL FILTER statement to indicate that your user-written filter is an entry point in a library.

Use the following syntax to declare an EXTERNAL FILTER:

EXTERNAL FILTER filtername IN "librarytitle"

where filtername is the name you have given to the filter and librarytitle is the file title of your compiled ALGOL library code.

$ INCLUDE

Use the $ INCLUDE statement to include your user-written filter as a patch file when the Support Library is compiled. The included file must contain ALGOL for the body of the filter. GenFormat will automatically declare the procedure heading and the outer BEGIN and END.

Use the following syntax to declare an $ INCLUDE:

FILTER filtername

$ INCLUDE "patchfiletitle"

where patchfiletitle is the title of an ALGOL source file containing a patch for the Support Library that defines a filter whose name is filtername. If you have accessories running under a different usercode from where the DATABridge software is installed and you want to use the automatic recompilation of the Support Library feature, you must include the usercode and pack name where the patch file resides in patchfiletitle.