How to Write an Embedded Basic Subroutine

A Embedded Basic routine must be written as an external subroutine that accepts a single parameter. When the routine is called by the system, the value of this parameter depends on the way in which it is called:

Pre-write triggers
The parameter contains the item that is to be written. You can change the data written to the item by changing the value of this parameter. To prevent the item being written, call the INPUTERROR statement.
Post-write triggers
The parameter contains the data that was written to the item.
Pre-delete and Post-delete triggers
The parameter always contains a null string.
File and data definition items
The parameter contains the data passed to the conversion code by the English definition item processor. The subroutine can modify the parameter if required; on exit, the modified value will be used as the output of the conversion code.

Within the Embedded Basic subroutine, you can access other information about the file and the item by calling the ACCESS function. In particular, if you are writing a Dictionary Subroutine, you can use ACCESS(31) to return any unprocessed data remaining after the current conversion code has been parsed - in this way, you can pass parameters into the subroutine.

If you need to pass data between Embedded Basic routines, use variables in a named COMMON area.

See Also

Embedded Basic Subroutines
Embedded Basic Examples
Debugging Embedded Basic Subroutines
How to Associate a Trigger with a File
Triggers Dos and Don'ts