Is this the Error39 you are referring to?
sketch_aug18a:39: error: 'TNCVAL' was not declared in this scope
If so, the 39 refers to the line the compiler found the error. Note that this isn't likely to be the line number in your program because of the preprocessing the IDE does.
That error is telling you you're using TNCVAL as a variable, but you haven't declared it anywhere. A simple way to remedy that is:
int TNCVAL = analogRead(0);
There are a number of other compilation errors you'll need to fix after that one though