[comp.databases] dBase IV bug?

kevin@edstip.EDS.COM (Kevin Brown) (11/16/89)

I found that I had trouble working with the @M function in dBase IV.  The
problem occurred when I used this function to limit choices for memory 
variable input.  I have not noticed this when the function is used with
database fields.  If the @M is followed by a space and then a list of choices,
all subsequent picture functions do not work at all. For example;

	@10,10 get choice picture '@M a,b,c,d'

will destroy all subsequent function templates, whenever they are used (given
that choice is a memory variable, not a database field).  It must be written
without the space:

	@10,10 get choice picture '@Ma,b,c,d'

It should be noted that, if choice were a database field and the space were
omitted, then this would not work.  The space is required for database fields.

The following code demonstrates this problem.


*BUG.PRG
*
*Problem: @M function destroys all subsequent function templates
*
*Note: Problem seems only to affect use of @M for memory variables
*
*Solution: Remove space following @M listitem,listitem
*          In other words,        @Mlistitem,listitem
*
set echo off
set talk off
char = 'abcdefghij'
imp = 'N'
one = 1
mone = -1
zero = 0
clear
@ 1,9 say '--------------------------------------------------------------'
@ 2,9 say ': Function Template : Before @M Function : After @M Function :'
@ 3,9 say '--------------------------------------------------------------'
@ 4,9 say ': @L 9999           :                    :                   :'
@ 5,9 say ': @C 9999           :                    :                   :'
@ 6,9 say ': @X 9999           :                    :                   :'
@ 7,9 say ': @Z 9999           :                    :                   :'
@ 8,9 say ': @( 9999           :                    :                   :'
@ 9,9 say ': @$ 9999           :                    :                   :'
@10,9 say ': @! XXXXXXXXXX     :                    :                   :'
@11,9 say ': @^ 9999           :                    :                   :'
@12,9 say ': @I 99999          :                    :                   :'
@13,9 say ': @B 99999          :                    :                   :'
@14,9 say ': @T 99999          :                    :                   :'
@15,9 say ': @J XXXXXXXXXXXXXX :                    :                   :'
@16,9 say ': @R X-X-X-X-XXXXXX :                    :                   :'
@17,9 say '--------------------------------------------------------------'
@ 4,31 say one picture '@L 9999'
@ 5,31 say one picture '@C 9999'
@ 6,31 say mone picture '@X 9999'
@ 7,31 say zero picture '@Z 9999'
@ 8,31 say mone picture '@( 9999'
@ 9,31 say one picture '@$ 9999'
@10,31 say char picture '@! XXXXXXXXXX'
@11,31 say one picture '@^ 9999'
@12,31 say one picture '@I 99999'
@13,31 say one picture '@B 99999'
@14,31 say one picture '@T 99999'
@15,31 say char picture '@J XXXXXXXXXXXXXX'
@16,31 say char picture '@R X-X-X-X-XXXXXX'
*
*Use the first one, then change to use the commented version
*
@ 20,40 get imp picture '@M Y,N'
*@ 20,40 get imp picture '@MY,N'
@ 4,52 say one picture '@L 9999'
@ 5,52 say one picture '@C 9999'
@ 6,52 say mone picture '@X 9999'
@ 7,52 say zero picture '@Z 9999'
@ 8,52 say mone picture '@( 9999'
@ 9,52 say one picture '@$ 9999'
@10,52 say char picture '@! XXXXXXXXXX'
@11,52 say one picture '@^ 9999'
@12,52 say one picture '@I 99999'
@13,52 say one picture '@B 99999'
@14,52 say one picture '@T 99999'
@15,52 say char picture '@J XXXXXXXXXXXXXX'
@16,52 say char picture '@R X-X-X-X-XXXXXX'
READ
set talk on
set echo on
*EOP:BUG.PRG

Try running this programs both ways, as the comment in the middle suggests.
The results are interesting.  


 Kevin Brown		    | UUCP:  ...!uunet!edsews!edstip!kevin
 Electronic Data Systems    |        kevin@edstip.EDS.COM
 1400 N. Woodward Av.	    | Voice: +1 313 645-4504
 Bloomfield Hills, MI 48013 | Fax:   +1 313 645-4824
-- 
 Kevin Brown		    | UUCP:  ...!uunet!edsews!edstip!kevin
 Electronic Data Systems    |        kevin@edstip.EDS.COM
 1400 N. Woodward Av.	    | Voice: +1 313 645-4504
 Bloomfield Hills, MI 48013 | Fax:   +1 313 645-4824