Hi,
I need to know if there is a way to use eztrieve to search for the '?' character in a given field name. i see in an eztrieve manual there is a utility macro STRSRCH, however i do not know how to use it. then, if that invalid character is found, i want to replace that character into a space. Any ideas? thanks and more power!
I just noticed that CA allows the ditribution of this macro's documentation, so here it is:
Code:
STRSRCH Macro
The STRSRCH macro provides a rapid string search that returns the
position of the search pattern within the target string, or returns
a zero if the search pattern does not occur in the target string.
pattern This alpha field or literal is the value for which to search.
pattern-length This numeric field or literal is the length of the pattern for
which to search. It does not necessarily have to specify the
entire defined length of the pattern field. It may be less
than that length, and only the specified number of characters
will be considered.
target This alpha field or literal is the target string that is to be
searched.
target-length This numeric field or literal is the length of the target
string. As with the pattern-length, it does not necessarily
have to specify the entire defined length of the target field.
If it is less than that length, only the specified number of
characters will be considered.
position This numeric field is where the result of the search is
returned. A zero indicates that the pattern was not found in
the target string. Any other value indicates the position in
the target string where the first character of the pattern
occurs.
MAXPAT integer This keyword parameter specifies the maximum possible size in
(Optional) characters of the search pattern. Its default is 64.
MAXTRG integer This keyword parameter specifies the maximum possible size in
(Optional) characters of the target string. Its default is 4096.
MAXPAT and MAXTRG are used to define storage and need not be
changed unless the maximum possible field sizes are greater
than the defaults.
Operation - STRSRCH generates no output and can be used alone or in
INLINE conjunction with other routines and/or EASYTRIEVE PLUS logic.
Operation - No changes in the specification of parameters are required to
Data Base use STRSRCH with data base files. For files with variable
length records, the EASYTRIEVE PLUS defined field RECORD-LENGTH
may be used for the "target-length" parameter, unless you do
not wish to search the entire input record.
1Reference This macro uses an algorithm developed by Robert S. Boyer and
J. Strother Moore and discussed in their article "A Fast String
Searching Algorithm" in Communications of the ACM, Volume 20,
+ _________________________
Number 10 (October, 1977), pages 762-772. The Boyer-Moore
algorithm is further discussed by Richard Wiggins and Paul
Wolberg in "Searching for Strings with Boyer-Moore," Computer
+ ________
Language, Volume 3, Number 11 (November, 1986), Pages 28-42.
+ ________
Copyright The STRSRCH macro and all documentation were written and are
Information copyright (c) 1987 by:
J. Russell Jones
HCA/Wesley Medical Center
550 N. Hillside
Wichita, KS 67212
and are hereby placed in the public domain and may be used and
distributed freely as desired provided that full credit be
given to both the author and HCA/Wesley Medical Center in any
documenation accompanying such use.