You can use "run sql" command line to retrieve the data but it only prints to the screen. You need to use AXL libraries to execute from external server in order to retrieve the data to file.
I am trying to gather much information on AXL to program it.
RameshV.