You can't use the unload-statement directly in
a stored procedure because it is not an SQL
So you might call a dbaccess batch-script which does
the unload thru 'system' inside the stored procedure.
However this is not very reliable way because of
the poor error handling capabilities of stored
procedures for such things.
I would recommend that you use a scripting language like
Perl or Python for doing this. These languages are both
available on NT and provide excellent features for
dealing with directories and files.
The stored procedure approach will also work, but maybe
not as reliable as needed.