When you try to run the above code, why not read the warning messages too? This is what dsolve returns:
S= dsolve(eqn1, eqn2, eqn3, eqn4, eqn5)
Warning: Unable to find explicit solution.
> In dsolve (line 201)
[ empty sym ]
So of course the later assignment must fail, because dsolve failed before that step. You are trying to assign something that does not exist, at least, not in the eyes of dsolve.