× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hello all,

 I need to enhance our web-based document retrieval system. It seems that a
cgi program would do the trick but I'm having a dickens of a time getting
things to behave. If this is not too off-topic perhaps someone could point
me in the right direction?

 The following code (swiped from Scott K's recent article, thanks Scott) has
two problems:
1) The browser (both IE6 and Firefox) wants to save the file as
'sendfile.pgm' instead of 'report.csv'. I've tried various permutations of
the Content-Disposition and filename params but nothing convinces the
browser that it should do anything differently. See:
http://www.faqs.org/rfcs/rfc2183

2) The data written to the PC is hieroglyphic gibberish. I assume the text
needs to be translated from EBCDIC to ASCII before calling QtmhWrStout? 

D QtmhWrStout     PR                  extproc('QtmhWrStout')
D   DtaVar                   32767A   options(*varsize) const
D   DtaVarLen                   10I 0 const
D   ErrorCode                 8000A   options(*varsize)
D ErrCode         ds                  qualified
D   BytesProv                   10I 0 inz(0)
D   BytesAvail                  10I 0
D CRLF            c                   x'0d25'
D data            s           1000A   varying
/free
    data = 'Content-type: application/x-download' +
           'Content-Disposition:attachment;filename="report.csv"' +
           CRLF + CRLF;
    QtmhWrStout(data: %len(data): ErrCode);
    data = 'This is the first record' + CRLF;
    QtmhWrStout(data: %len(data): ErrCode);                          
    data = 'This is the 2nd record' + CRLF;
    QtmhWrStout(data: %len(data): ErrCode);
    return;
 /end-free

Many thanks, JK


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.