VSAM files and flat files can be accessed directly by stored procedures, as long as the files are made available to the SPAS with appropriate JCL DD statements. In such cases, the userid associated with the SPAS address space is used to check authorizations.
Thanks for your response.
I was actually refering to SQL Stored procedure in DB2 UDB 7.2 .
I called up IBM tech support and this is what they suggest.
In order to write the output into a flat file, the store procedure needs to be coded in C, Java etc.
The SQL Stored procedure for DB2 UDB does not support writing or reading from a flat file.