Redefining User Exits
If you wish, you can redefine a User Exit to call either a DataBasic subroutine or a different user exit. There are two reasons why you might want to do this:
-
To enhance the functionality of a user exit. Applications that use this user exit would then be able to use the new features without modification.
-
For compatibility with other MultiValue systems. Each user exit is unique to the system for which it was written; Reality may not provide a user exit with the same functionality, and even if it does, it will probably have a different address.
Replacing a User Exit with a DataBasic Subroutine
To replace a User Exit with a DataBasic subroutine, simply write a dictionary subroutine and give it the same name as the user exit it will replace (that is, Uxxxx, where x represents a single hexadecimal digit; use leading zeros if necessary). Alternatively, you can give the subroutine a meaningful name and create a Command Synonym Definition item to point to it. The subroutine name will be looked up in the Master Dictionary of the current account and in the user's alternate verbs file. If (after following any synonym items) a cataloged subroutine is found, this will be used; otherwise, the specified user exit will run.
When a user exit subroutine is called, any data following the user exit name, up to the next value mark or the end of the attribute, is treated as "unprocessed data" and can be accessed within the subroutine by calling the ACCESS(31) function. Note that, unlike the CALL conversion code, no subvalue mark is required following the user exit name - if included, this will be treated as part of the unprocessed data and will be returned by ACCESS(31).
Example
The following is a dictionary subroutine for use as a user exit:
SUBROUTINE UAAAA(P) P = P:",":ACCESS(31):",Done" RETURN
When called from within a CALL conversion code, the P parameter will contain the data passed to it by the conversion processor, while the call to the ACCESS(31) function obtains any parameters that follow the user exit name. The subroutine modifies the value of P and, on exit, this modified value is used as the output of the conversion code.
This subroutine could be called using the following conversion code:
A;0vmUAAAAFred
where vm is a value mark. Typical output would be as follows:
DISTANCE,Fred,Done
Where DISTANCE is the id of an item in the listed file (generated by the A conversion code).
Using a Different User Exit
To replace one User Exit with another, create a user exit substitution item in the account's Master Dictionary. This is similar to a Command Synonym Definition item, but contains the letter U in its first attribute, as follows:
Item-id |
User Exit synonym name. |
001 |
U |
002 |
User exit address. |
For example:
U1234
001 U
002 5678
This master dictionary item runs user exit U5678 whenever user exit U1234 is called.