ANOMALIES UPLOADED ON 5-31-89 ANOMALY11.TXT The following listing addresses two known anomalies when using dBASE IV. Use of these techniques will aid you in avoiding anomalies that have been reported to our Software Support Center. There are also two Usage-Tips that may be used in order to avoid further problems or misunderstandings when using the dBASE IV product. This report will be supplemented as new information is received. ******************************************************************* ANOMALIES Network install rules out Hardware setup options Setting Multi-user installation to YES dims Hardware setup options which, therefore, become unavailable. Page 2-4 of Network Installation, under the heading "Hardware Setup" erroneously instructs the user to Downarrow to the next option, Display mode. The rationale for making these options unavailable during a network installation is simple. On a multi-user system each workstation can have unique hardware requirements. Therefore, each workstation should have its own customized CONFIG.DB file. This requirement is documented later on page 2-13 of Network Installation. ==================================================================== SET FIELDS TO has no ADDITIVE clause The third line in the third example of the "Processing: Relating and Restricting Data" section, page 13-11 of Programming with dBASE IV uses an unavailable option with the SET FIELDS statement. The ADDITIVE clause after SET FIELDS TO Qty_onhand is not a recognized option. USAGE-TIPS How dBASE compares strings and null values Character comparisons: In dBASE IV when comparing two values to see if they are the same, you may encounter some confusing results. This is due to the way that dBASE IV compares the two values. Take the following examples with EXACT set Off: "xxx" = "xx" will be true, but "xx" = "xxx" will be false. Aren't these two expressions the same ? Well, as far as dBASE is concerned, these are two very different expressions. This is due to the way that dBASE performs the comparison, when EXACT has been turned OFF. Let's look at the expression "xxx"="xx": The way dBASE performs the string comparison is on a character by character basis. In other words, dBASE will look at the first character of the value on the right and compare it to the first character of the left value. If these characters match, dBASE will check the second characters and so on until all of the characters from the right hand string have been checked. If each character matched the character in the same position of the string on the left, then as far as dBASE is concerned, the two values are equal when EXACT has been set off. If we look at the other example: "xx" = "xxx" we can see that we will reach the end of the left string before the end of the right string. Which means that dBASE will consider these two values to be different. You can think of it in the sense of how the $ operator works. The example "xxx"="xx" is similar to "xx"$"xxx" where the $ operator means that the string on the left of the $ is contained in the string on the right. The only difference being that the $ operator will search the entire string, where as the = operator will match position 1 of the right hand string to position 1 of the left hand string until all of the characters from the right hand string have been checked. NULL Comparisons: A NULL character is simply an ASCII character with the decimal value 0. On an ASCII chart, the NULL is the very first character. How does dBASE IV compare variables if one of the strings contain only a NULL value? Consider the following examples: ""=VAR1 && "" is a NULL. This example will only be true if VAR1 actually contains a NULL value. Remember how dBASE will begin to compare these two strings. If VAR1 is not a NULL then these two strings will not be equal. A NULL on the left of the equal sign is equal only to a NULL on the right. Here's what this whole thing has been leading up to. In the example VAR1 = "" && Where VAR1 = "Mark" dBASE will consider this expression to be true. Yes, that's right. If a NULL is on the right of the = operator the expression will ALWAYS be true. When dBASE begins to match character for character, it will treat the NULL character as anything. So, when dBASE compares the NULL to the 'M' in Mark, the two strings are considered to be equivalent. The rule is, when a NULL is on the right hand side of a string comparison, it will always evaluate as true because NULL is the universal match character. Dates and NULLS: Another topic to discuss with regard to NULLS is how to check for dates that are blank. In dBASE an empty date field or variable contain a NULL value. So, how do you check for a NULL or empty date ? The following will LIST all records where DATE1 is blank: LIST FOR DATE1={} && {} is an empty or NULL date value When comparing dates it is not necessary to worry about on which side of the = the NULL date should be placed. Suppose you want to LIST records where the DATE1 field contained a date. It would seem that the following would be sufficient: LIST FOR DATE1<>{} You will quickly notice that there are no records returned. In order to check for an empty date you need to use the = operator. We should use the following command instead: LIST FOR .NOT. DATE1={} This will indeed give us a list of all records that contain a date in the DATE1 field. ====================================================================== Command line arguments In all versions of dBASE you have the capability of passing a start-up program name to dBASE from the DOS command line. The syntax is DBASE <.prg name>. In dBASE III and above, the software allowed the setting of configuration options in the CONFIG.DB file. One option in the CONFIG.DB file is the COMMAND = option, which can be set to initiate any command in dBASE when the software is run. This became an alterative to the passing of a program name as a command line argument. However, in dBASE III PLUS, if a COMMAND = option existed in the CONFIG.DB, any command line argument passed from DOS would be ignored and only the command specified in the CONFIG file would be performed. dBASE IV now "restores" the functionality to command line arguments even though a COMMAND = is set in CONFIG.DB. In dBASE IV, if DBASE is called by itself from DOS without a command line argument, by simply typing DBASE, the command specified in the CONFIG file is performed. If a program name is passed from the DOS command line during the start-up of dBASE, that program will be run and the command in CONFIG.DB will be bypassed.