I have a embedded sql (.ec) file and want to redirect the output of a select statement to a simple txt file.

For standalone select statement it should be like this -

output to /tmp/out
select * from emp where empno=123;

But how I can achieve the same in the .ec file? If I write the following -

exec sql output to /tmp/out.txt select * from emp where empno=123;

I am getting the error - esqlc: Syntax error on identifier or symbol '/'.
I tried to escape those "/" in different ways without any success.

So the question is - is it at all possible to write the program in this way? I know that through eSql utility we can select the values in the host variables - so is there any restriction to redirect the output in the above manner? If we have 100's of columns can't we redirect the output for our ease? Also in the same way "unload" is also not working.

I spent so much time in searching for this answer, but couldn't get any help - hence bothering you guys.

Thanks in advance for your time and considerations.....