Joined: 10 Mar 2005 Posts: 432 Location: Milan, Italy
This statement will not work or will work without the needed result.
To use the Substring Search you must define each include separately like this:
Code:
INCLUDE COND=(15,1,SS,EQ,C'A,B,C')
SS = is the Sub-string Search.
Try to visit the manual:
Quote:
Suppose you want to select only the books for the Biology, History, Business and Psychology departments. Based on what you learned earlier, you can select those books using this INCLUDE statement:
INCLUDE COND=(106,5,CH,EQ,C'BIOL',OR,
106,5,CH,EQ,C'HIST',OR,
106,5,CH,EQ,C'BUSIN',OR,
106,5,CH,EQ,C'PSYCH')
But the more departments you want to include, the more typing you have to do. Instead, you can use one of the substring search capabilities of INCLUDE and OMIT to write the statement in a simpler form as:
INCLUDE COND=(106,5,SS,EQ,C'BIOL ,HIST ,BUSIN,PSYCH')
With substring search (SS format), you only write the field once and write the character constant so it includes all of the strings you want to search for. If the value in the field matches any of the strings (for example, "BUSIN"), the record is included. If the value in the field does not match any of the strings, the record is omitted.
The length of each string must match the length of the field. Because the Department field is 5 characters, you must add a blank at the end of "BIOL" and "HIST", which are each four characters, but not for "BUSIN" and "PSYCH", which are each five characters.
The other way to use substring search is by searching for a constant within a field. For example, if you wanted to select only the books with "INTRODUCTION" in their Title, you could use the following INCLUDE statement:
INCLUDE COND=(1,75,SS,EQ,C'INTRODUCTION')
The books selected for output would be:
COMPUTERS: AN INTRODUCTION
INTRODUCTION TO PSYCHOLOGY
INTRODUCTION TO BIOLOGY
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Quote:
This statement will not work or will work without the needed result.
That's NOT true. In this case, C'ABC' is MORE correct then C'A,B,C'.
Code:
INCLUDE COND=(15,1,SS,EQ,C'ABC')
will check for 'A' in 15, then 'B' in 15, then 'C' in 15.
Code:
INCLUDE COND=(15,1,SS,EQ,C'A,B,C')
will check for 'A' in 15, then ',' (comma) in 15, then 'B' in 15, then ',' in 15, then 'C' in 15. So if there's a comma in 15, the record will be included which is probably NOT what's wanted. Of course, in most cases, there isn't a comma in 15, so using the comma as a separator does not cause a problem. But for a 1-byte field with SS, it's best NOT to use a separator between the elements.
For larger fields with SS, you normally want the separator to indicate which contiguous characters you're searching for. For example:
Code:
INCLUDE COND=(15,2,SS,EQ,C'ABCDEF')
will look for 'AB' in 15-16, then 'BC' in 15-16, then 'CD' in 15-16, then 'DE', then 'EF' in 15-16. If you only want a "hit" on 'AB' or 'CD' or 'EF' and not on 'BC' or 'DE', then you need to use:
Code:
INCLUDE COND=(15,2,SS,EQ,C'AB,CD,EF')
which will look for 'AB' in 15-16, then 'B,' in 15-16, then ',C' in 15-16, then 'CD' in 15-16, then 'D,' in 15-16, then ',E' in 15-16, then 'EF' in 15-16. Be sure to use a separator that will NOT be found (e.g. if 15-16 could contain ',E' but can't contain '-E', use C'AB-CD-EF').
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
No apology necessary. Since the the separator character is generally needed, leaving it out for 1-byte fields is not actually covered in the doc, so I understand how you drew the conclusion you did. Of course, since I developed the code, I know how it actually works.