Monday, 1 January 2018

%CHECKR Example

      * Program     :·CheckRR
      * Description :·%Checkr() Example
      *
      * %CheckR()
      * Input  Parm1:·String of characters to be checked (Comparator)
      *        Parm2:·String in which the characters to be scaned/searched
      *
      * Output      :·Last location of Parm2 string where char is not matched
      *               with Comparator's chars
      *
      * Note        :·0 will be returned if no exception found
      *==========================================================
      *

     D Digits          S             10    Inz('0123456789')
     D Vowals          S             10    Inz('AEIOU')

     C
      /Free
           Dsply %CheckR(Digits : '123AB56') ;  // '5'

           Dsply %CheckR(Vowals : 'AEIOU') ;    // '0'

           Dsply %CheckR(Vowals : 'AEIoU') ;    // '4' CASE SENSITIVE
      /End-Free
     C                   SetOn                                        LR

No comments:

Post a Comment