Try with this script:
LET _vFileName = 'xxxx';
LET _vFileNameD = '$(_vFileName)'&'.qvd';
LET _vFileExists = if(FileSize('$(_vFileNameD)') > 0, -1, 0);
LET _vText1='stops here';
LET _vText1='why stop here??';
LET _vText='Case 2';
It's a little bit of an oddity as to how the script interpretation and execution flows.
You are triggering Case 2. The statements in Case 1 do not get executed, but they do get expanded and syntax checked.
The variable _vFileExists never get intialized (the LET doesn't get executed) so the IF statement that references it gets expanded to:
"IF =0 THEN"
which is invalid (not trapped until the ELSE).
You can fix the problem by initializing the variable before the SWITCH.
LET _vFileExists = 0;
or code the IF statement to tolerate an empty variable by including quotes.
IF '$(_vFileExists)'=0 THEN