Test du code MONITOR/ENDMON et de ON-ERROR.

BoTTom |
      **********************************************************************
      * test sur la fonction MONITOR                                       *
      **********************************************************************
     Dchaine           S             50    inz('ceci est un test')
     Ddebut            s             10i 0
     Dok               s              3
      /free
       monitor;
       debut = 51;
       // ici, le pgm détecte une erreur (pos contient 51, chaine fait 50) 
       ok = %subst(chaine : debut : 1);
       if ok >  ' ';
          ok = 'oui';
       endif;
       on-error *program;
       // on débranche bien ici automatiquement 
          ok =' non';
       endmon;
       // on ne remonte pas à l'instruction qui suit l'instruction en
       //  erreur, en fin de pgm, OK contient bien 'non' !!
       *inlr=*on;
      /end-free




©AF400