Thanks, Andy. At least I won't go on a wild goose chase.
n_i: Unfortunately, I haven't written that stored procedure and am not in a position to modify it.
I'm trying to find an alternate way. Connecting to DB2 from within is easy using the IBM_DB module provided by ruby. If I can get call the procedure and fetch the rows from within the script, I can then write it to file easily.
UPDATE: Yeah, it works. If someone is looking to do the above, it might be worth your time to invest a little in interfacing your favorite scripting language to DB2.