I've got a problem where DM behaves quite strange. What I'm trying to do is to create a generic proc to handle selection values from a HTML page. Single values work fine and multiple (up to 2) work fine but when I get to the 3rd value it populates the string with ********, and when I come to the 4th it gives me arror.
Below is the trace from the loop. Does anone have a clue what's going on?
-REPEAT :inner_loop 4 TIMES -SET &val4 = '&' || Fixer || 1 ; -SET &str = '''' | ANDYBIRD | ''''; -SET &sel_string = IF 1 EQ 1 THEN '''' | ANDYBIRD | '''' - ELSE IF 1 LE 4 THEN '''' | ' ' | '''' | - ' OR ' | '''' | ANDYBIRD | ''''; -TYPE sel_string 'ANDYBIRD' sel_string 'ANDYBIRD' -TYPE sel_string length 10 sel_string length 10 -SET &Fixer_Sel = 'ANDYBIRD'; -SET &y = 1 + 1; -REPEAT :inner_loop 4 TIMES -SET &val4 = '&' || Fixer || 2 ; -SET &str = '''' | CHRISADAMS | ''''; -SET &sel_string = IF 2 EQ 1 THEN '''' | CHRISADAMS | '''' - ELSE IF 2 LE 4 THEN '''' | 'ANDYBIRD' | '''' | - ' OR ' | '''' | CHRISADAMS | ''''; -TYPE sel_string 'ANDYBIRD' OR 'CHRISADAMS' sel_string 'ANDYBIRD' OR 'CHRISADAMS' -TYPE sel_string length 26 sel_string length 26 -SET &Fixer_Sel = 'ANDYBIRD' OR 'CHRISADAMS'; -SET &y = 2 + 1; -REPEAT :inner_loop 4 TIMES -SET &val4 = '&' || Fixer || 3 ; -SET &str = '''' | CHRISBLEVINS | ''''; -SET &sel_string = IF 3 EQ 1 THEN '''' | CHRISBLEVINS | '''' - ELSE IF 3 LE 4 THEN '''' | 'ANDYBIRD' OR 'CHRISADAMS' | '''' | - ' OR ' | '''' | CHRISBLEVINS | ''''; -TYPE sel_string ******** sel_string ******** -TYPE sel_string length 08 sel_string length 08 -SET &sql_string = ********; -SET &Fixer_Sel = ********; -SET &y = 3 + 1; -REPEAT :inner_loop 4 TIMES -SET &val4 = '&' || Fixer || 4 ; -SET &str = '''' | CHRISMITCHELL | ''''; -SET &sel_string = IF 4 EQ 1 THEN '''' | CHRISMITCHELL | '''' - ELSE IF 4 LE 4 THEN '''' | ******** | '''' | - ' OR ' | '''' | CHRISMITCHELL | ''''; 0 ERROR AT OR NEAR LINE 5 IN PROCEDURE mrheaderFOCEXEC * (FOC260) AN OPERATION IS MISSING AN ARGUMENTThis message has been edited. Last edited by: Håkan,
-SET &sel_string = IF &y EQ 1 THEN '''' | &val4.EVAL | '''' - ELSE IF &y LE &z.EVAL THEN '''' | &sel_string.EVAL | '''' | ' OR ' | '''' | &val4.EVAL | '''';
The .EVAL in &sel_string.EVAL is extraneous, and tripped you up.
Without .EVAL, the content of the referenced amper variable is used only after the right-hand-side expression has been parsed; with .EVAL the the contents of the amper var is treated as if it were in the original content of the line of code.
So, with .EVAL, when the value contained in &sel_string included an operator (such as " OR " or "*"), it got treated as such.
In iteration 2 of the loop, " OR " was introduced. In iteration 3, the presence of OR caused the interpreter to store a numeric result; since the expression was malformed, the result was a number that overflowed (rather than the 0 or 1 that OR should yield), and asterisks were stored. In iteration 4, .EVAL caused those asterisks to be treated as a numeric operator, and the music stopped with "(FOC260) AN OPERATION IS MISSING AN ARGUMENT"