I'm using notepad as the editor. It seems the problem is with
 Code:
If LEFT(@WKSTA,7) = 'mtscapp'


should mtscapp be in quotes or apostrophes?