Documentation Comments
Use this form to comment on this topic. You can also provide any general observations about the Online Documentation, or request that additional information be added in a future release.
RealityV15.1Online Documentation (MoTW) Revision 7
Redefining User Exits (DataBasic) (m6187+userexits.htm)
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 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).
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).
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.