RPGIV @ Work

A unique site for RPG and System i Lovers

Welcome!

Hi, this site will provide all what you need in System i and RPG developments.

My Name is Chamara Withanachchi, System i Expert and RPG Developer. And in the field for last 11 years.

I hope you will find lot of valuable information from this site

Is Debug Active Print E-mail
User Rating: / 0
PoorBest 
Written by Chamara Withanachchi   

Extracted from RPG Cafe


Do you ever want some code to run only when the debugger is active? Here's a procedure you can call to find out:


Test program


 /copy indebug
 
 /free
    if inDebug();
       dsply ('The debugger is active');
    else;
       dsply ('The debugger is not active');
    endif;
    return;

Member INDEBUG_PR containing the prototype


   /if not defined INDEBUG_INCLUDED
 D inDebug         pr              n   extproc('inDebug')
  /define INDEBUG_INCLUDED
  /endif
 

Member INDEBUG containing the procedure


 H nomain
  /copy indebug
 P inDebug         b                   export
 D inDebug         pi              n
 D QteRetrieveDebugAttribute...
 D                 pr                  extproc(
 D                                      'QteRetrieveDebugAttribute')
 D   attribute                   10a   const
 D   value                       10a   const
 D   errorcode                         likeds(qusec)
 D dummy           s             10a
  /copy qsysinc/qrpglesrc,qusec
  /free
         QUSBPRV = %size(QUSEC);
         QteRetrieveDebugAttribute ('*UPDPROD'  // pick any attribute
                                  : dummy
                                  : qusec);
         if  QUSBAVL > 0
         and QUSEI = 'CPF9541';
            return '0';  // job is not in debug mode
         else;
            return '1';  // job is in debug mode
         endif;
  /end-free
 P inDebug         e
<Previous   Next>