Rational Developer for System z
PL/I for Windows, Version 7.6, Programming Guide

Customizing the compiler user exit

As was mentioned earlier, you can write your own compiler user exit or simply modify IBMUEXIT.PLI. In either case, the name of the executable file for the compiler user exit must be IBMUEXIT.DLL.

This section describes how to:

Modifying IBMUEXIT.INF

Rather than spending the time to write a completely new compiler user exit, you can modify the sample program, IBMUEXIT.INF.

Edit the INF file to indicate which message numbers you want to suppress, and which message number severity levels you would like changed. A sample IBMUEXIT.INF file is shown in Figure 28.

Figure 28. Example of an IBMUEXIT.INF file
  Fac Id   Msg No   Severity   Suppress   Comment
+--------+--------+----------+----------+--------------------------------
  'IBM'     1041       -1          1      Comment spans multiple lines
  'IBM'     1044       -1          1      FIXED BIN 7 mapped to 1 byte
  'IBM'     1172        0          0      Select without OTHERWISE
  'IBM'     1052       -1          1      Nodescriptor with * extent args
  'IBM'     1047       12          0      Reorder inhibits optimization
  'IBM'     8009       -1          1      Semicolon in string constant
  'IBM'     1107       12          0      Undeclared ENTRY
  'IBM'     1169        0          1      Precision of result determined by arg

The first two lines are header lines and are ignored by IBMUEXIT. The remaining lines contain input separated by a variable number of blanks.

Each column of the file is relevant to the compiler user exit:

Writing your own compiler exit

To write your own user exit, you can use IBMUEXIT (provided as one of the sample programs with the product) as a model. As you write the exit, make sure it covers the areas of initialization, message filtering, and termination.

Structure of global control blocks

The global control block is passed to each of the three user exit procedures (initialization, filtering, and termination) whenever they are invoked. The following code and accompanying explanations describe the contents of each field in the global control block.

  Dcl
    1 Uex_UIB           native based( null() ),
      2 Uex_UIB_Length         fixed bin(31),

      2 Uex_UIB_Exit_token     pointer,        /* for user exit's use */

      2 Uex_UIB_User_char_str  pointer,        /* to exit option str  */
      2 Uex_UIB_User_char_len  fixed bin(31),

      2 Uex_UIB_Filename_str   pointer,        /* to source filename  */
      2 Uex_UIB_Filename_len   fixed bin(31),

      2 Uex_UIB_return_code fixed bin(31),     /* set by exit procs   */
      2 Uex_UIB_reason_code fixed bin(31),     /* set by exit procs   */

      2 Uex_UIB_Exit_Routs,                    /* exit entries set at
                                                  initialization      */
        3 ( Uex_UIB_Termination,
            Uex_UIB_Message_Filter,            /* call for each msg   */
            *, *, *, * )
          limited entry (
               *,                               /* to Uex_UIB          */
               *,                               /* to a request area   */
           );

Data Entry Fields

Writing the initialization procedure

Your initialization procedure should perform any initialization required by the exit, such as opening files and allocating storage. The initialization procedure-specific control block is coded as follows:

  Dcl 1 Uex_ISA native based( null() ),
      2 Uex_ISA_Length_fixed bin(31);   /* storage(Uex_IS    A) */

The global control block syntax for the initialization procedure is discussed in the section Structure of global control blocks.

Upon completion of the initialization procedure, you should set the return/reason codes to the following:

0/0
Continue compilation
4/n
Reserved for future use
8/n
Reserved for future use
12/n
Reserved for future use
16/n
Abort compilation

Writing the message filtering procedure

The message filtering procedure permits you to either suppress messages or alter the severity of messages. You can increase the severity of any of the messages but you can decrease the severity only of ERROR (severity code 8) or WARNING (severity code 4) messages.

The procedure-specific control block contains information about the messages. It is used to pass information back to the compiler indicating how a particular message should be handled.

The following is an example of a procedure-specific message filter control block:

Dcl 1 Uex_MFX native based( null() ),
      2 Uex_MFX_Length   fixed bin(31),

      2 Uex_MFX_Facility_Id  char(3),        /* of component writing
                                                message             */
      2 *                    char(1),
      2 Uex_MFX_Message_no   fixed bin(31),
      2 Uex_MFX_Severity     fixed bin(15),
      2 Uex_MFX_New_Severity fixed bin(15),  /* set by exit proc    */
      2 Uex_MFX_Inserts                fixed bin(15),
      2 Uex_MFX_Inserts_Data( 6 refer(Uex_MFX_Inserts) ),
        3 Uex_MFX_Ins_Type             fixed bin(7),
        3 Uex_MFX_Ins_Type_Data union unaligned,
          4 *                          char(8),
          4 Uex_MFX_Ins_Bin            fixed bin(31),
          4 Uex_MFX_Ins_Str,
            5 Uex_MFX_Ins_Str_Len      fixed bin(15),
            5 Uex_MFX_Ins_Str_Addr     pointer,
          4 Uex_MFX_Ins_Series,
            5 Uex_MFX_Ins_Series_Sep   char(1),
            5 Uex_MFX_Ins_Series_Addr  pointer;

Data Entry Fields

Upon completion of the message filtering procedure, set the return/reason codes to one of the following:

0/0
Continue compilation, output message
0/1
Continue compilation, do not output message
4/n
Reserved for future use
8/n
Reserved for future use
16/n
Abort compilation

Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)