Sunday, 17 September 2017

%CHECK Example

      * Program     :·CheckR
      * Description :·%Check() Example
      *
      * %Check()
      * Input  Parm1:·String of characters to be checked (Comparator)
      *        Parm2:·String in which the characters to be scaned/searched
      *
      * Output      :·First 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 %Check(Digits : '123A456') ;  // '4'

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

           Dsply %Check(Vowals : 'AEiOU') ;    // '3' CASE SENSITIVE
      /End-Free
     C                   SetOn                                        LR

No comments:

Post a Comment