Provides an additional search mode for all AT functions

     SETATLIKE([<nNewMode>,[<cCharacter>]]) --> nOldMode


     <nNewMode>  Designates which mode the AT functions and STRDIFF()
     should use during searches.  At this time, the 0 and 1 modes are
     permitted.  The default value is 0.

     <cCharacter>  Designates optional wildcard characters only.  The
     default value is "?".

     ()  When called without parameters, the function returns the current


     When a parameter is passed, the function returns the previous mode.  If
     no parameter is passed, the function returns the current mode.


     Generally speaking, all AT functions like ATNUM(), AFTERATNUM(), and the
     function STRDIFF(), operate to find an exact match during the execution
     of the search sequence.  When you use SETATLIKE(1), an additional mode
     can be selected which permits the use of wildcard characters.  For every
     position containing a wildcard character within the search expression,
     any character can occur in the character string that is searched.  The
     first character of the search expression cannot be a wildcard, and the
     entire expression cannot consist of wildcards.  These restrictions
     simultaneously avoid unwanted recursions with ATREPL().

     The customary "?" has been used as the default wildcard character.
     However, it can be replaced by using the optional <cCharacter>
     parameter.  Any character you choose can be set as a wildcard character,
     increasing the flexibility of this group of functions.


     .  The DOS supported "*" wildcard character is not available for
        this function.

     .  The <nNewMode> parameter was selected to be a numeric value to
        allow future implementation of additional modes.


     .  Set the SETATLIKE(1) wildcard mode to on:


     .  Determine the beginning position at the start of the last
        search expression:

        cTextsequence  := "ABCDEABC123AXCK"
        ? ATNUM("ABC", cTextsequence)                 // 6
        ? ATNUM("A?C", cTextsequence)                 // 12

     .  Determine if the search expression occurs with the text

        cTextsequence  := "ABCDEABC123AXCK"
        ? NUMAT("ABC", cTextsequence)                 // 2
        ? NUMAT("A?C", cTextsequence)                 // 3

     .  Determine the portion of the text sequence behind the last
        occurrence in the search expression:

        cTextsequence  := "ABCDEABC123AXCK"
        ? AFTERATNUM("ABC", cTextsequence)            // 123AXCK
        ? AFTERATNUM("A?C", cTextsequence)            // K

     .  Determine the portion of the text sequence before the last
        occurrence in the search expression:

        cTextsequence  := "ABCDEABC123AXCK"
        ? BEFOREATNUM("ABC", cTextsequence)           // ABCDE
        ? BEFOREATNUM("A?C", cTextsequence)           // ABCDEABC123

     .  Determine the portion of the text sequence from the last
        occurrence aligned at position 15:

        cTextsequence  := "ABCDEABC123AXCK"
        ? ATADJUST("ABC", cTextsequence, 15)          // ABCDE   ABC123AXCK
        ? ATADJUST("A?C", cTextsequence, 15)          // ABCDEABC123   AXCK

     .  ATREPL() poses an unusual situation.  If a search expression
        containing wildcard characters (like the one in the following
        example) is exchanged for a sequence where you only find other
        characters at the wildcard positions, a recursion occurs internally
        if CSETATMUPA() is on:

        cTextsequence  := "ABCDEABC123AXCK"
        ? ATREPL("D?", cTextsequence, "DX")           // ABCDXXXXXXXXXXXX

     .  Wildcard characters reduce the valence with the STRDIFF()

        ? STRDIFF("ABC", "AXC")                       // Valence 3
        ? STRDIFF("A?C", "AXC")                       // Valence 0



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.