In order for this site to work correctly, and for us to improve the site, we need to store a small file (called a cookie) on your computer.
By continuing to use this website, you agree to our cookies and privacy policy.
  
Home page Home page Home page Home page
Pixel
Pixel Header R1 C1 Pixel
Pixel Header R2 C1 Pixel
Pixel Header R3 C1 Pixel
Pixel

Trapping Message Calls

Sean Leyne from Michael D. Atkin & Associates Ltd wrote to us recently, commenting as follows

"I was very interested/impressed with your solution to the message B234 problem. However, I thought that a more general solution could be created to handle trapping of all unwanted messages."

"The code (MSG) that follows can accomplish this goal without modifying object code. Another benefit of this routine is for the handling of multi-lingual applications by allowing for multiple versions of a message to be stored in the messages file, displayed depending on the language preferred. The enclosed routine could be modified, keeping the following in mind

         1)   Labelled Common Variables
                 - Language Prefix (ie F - French)
                 - Message File Variable (for READ statement)

         2)   A Pre-Display check for message existing where TEMP.ID =
                PARM1:PREFIX

                READ TEMP FROM MESSAGE.FILE,TEMP.ID THEN
                     PARM1 := PREFIX
                END

"The benefit of such a routine is that it prevents the messages from being overwritten by RTI upgrades." With Sean's permission I reproduce below his code listing.


0001  SUBROUTINE MSG(PARM1,PARM2,PARM3,PARM4)
0002  *
0003  * Copyright Michael D Atkin & Associates Ltd 1989, permission
0004  *           granted for REVMEDIA subscribers to use this program
0005  *           for any purpose.
0006  *
0007  *           No liability is accepted for use
0008  *
0009  * Author    Sean J. Leyne
0010  *
0011  * Purpose   This subroutine traps all calls to the system MSG
0012  *           (renamed MSG.RTI). The routine compares the message
0013  *           number against a list to be excluded, if found a
0014  *           defined label is assigned to PARM3 (IMAGE) for later
0015  *           evaluation and the call to MSG.RTI is ignored.
0016  *
0017  *           Remember, with each upgrade there is a possibility of
0018  *           $MSG being overwritten. Therefore care must be taken
0019  *           to check after each upgrade
0020  *
0021  *           Finally, for speed and code overhead purposes, compile
0022  *           the code using the (CL) option
0023  *
0024  
0025  DECLARE FUNCTION UNASSIGNED
0026  
0027  * Check if parameters assigned, important for later evaluation
0028  
0029  IF UNASSIGNED(PARM1) THEN PARM1 = ""
0030  IF UNASSIGNED(PARM2) THEN PARM2 = ""
0031  
0032  EXCLUDE.LIST = "B234"
0033  FOUND = 0
0034  
0035  IF PARM1 THEN
0036    LOCATE PARM1 IN EXCLUDE.LIST USING "," SETTING POS THEN
0037       FOUND = 1
0038    END ELSE
0039       FOUND = 0
0040    END
0041  END
0042  
0043  BEGIN CASE
0044    CASE FOUND
0045       * Message was found in exclude list, load PARM3, ignore call
0046       PARM3 = "NO SHOW"
0047    CASE PARM3 = "NO SHOW"
0048       * Being asked to remove message never displayed. Ignore call
0049       PARM3 = ""
0050    CASE 1
0051       CALL MSG.RTI(PARM1,PARM2,PARM3,PARM4)
0052  END CASE
0053  
0054  RETURN

(Volume 1, Issue 8, Pages 10,11)
Pixel
Pixel Footer R1 C1 Pixel
Pixel
Pixel
Pixel