There would be several ways that this can be accomplished. An IMOD would be one of them. In the exception definition, one of the exception actions is to invoke a user IMOD when an exception occurs. There is a sample exception user IMOD that is loaded as SAMP_XC_IMOD in the IMOD file during the install. The source is in highlevel.SPFSLIB(IMODSAMP).
If you have OPS/MVS, then another way to do this would be to define the exception to be logged as a WTO (again, this is defined in the exception action). OPS/MVS could intercept the WTO and look at the text of the WTO to determine which exception has occurred.
The interface to the Imod/REXX routines from the Exception is defined in the Insight Writing Requests Reference Guide, Chapter 7, the section under Output Specification of R19 Guide.
For complete details on the GSS REXX extensions, and creating GSS Imods, please refer to the CA Common Services documentation: Administration Guide, Chapter 9