Attempt to download file - no data

I am new to Webspeed development.
What I want to do is provide the user with a button that will allow them to download the results of the query that is being displayed on the screen - detailed shipping information.
I took some of the sample code I've found through this forum (CGI wrapper), and used a test file as the input data (I'm not even worrying about capturing the query data at this point). I get the file download box, and the application (Excel) kicks off nicely, but the file is totally empty. I've tried this with an input Excel file, a UNIX text file and a hard-coded string, and still blank.

****** This is in the DEFINITIONS area:

DEFINE VARIABLE vdata AS RAW NO-UNDO.
DEFINE STREAM infile.

****** This is in my MAIN block:

output-content-type("application/x-msexcel").
INPUT STREAM infile FROM P:/Testing/security.xls BINARY NO-ECHO.
LENGTH(vdata) = 1024.
REPEAT:
IMPORT STREAM infile UNFORMATTED vdata.
PUT {&WEBSTREAM} CONTROL vdata.

END.
LENGTH(vdata) = 0.
INPUT STREAM infile CLOSE.


What am I doing wrong?
I've seen some warnings on nsapi bugs, which is the messenger we're using - is this the problem?
Or could it be something in the environment setup? We're all still feeling our way through this, and we have multiple environments for development, qa, production.
We're on Progress 9.1, Webspeed 3.1.

Thanks.

- JKL
 
Top