************************** Web Server Port Rule ***************************** JANUS WEB SSLWEB ON /WSWT/UT.JOBLIST/*.PDF OPEN FILE WEBTEST CMD 'I WEBSEND_TSOPDF' ************************** proc WEBSEND_TSOPDF ***************************** B variables are undefined %Daemon is object Daemon %DaemonCommands is object stringlist %DaemonResult is object stringlist %DDName is string len 8 %PDFDataset is object dataset %PDFDsn is string len 100 %PDFRecord is longstring %x is fixed *strip all but PDF name from URL to get DSN %PDFDsn = $upcase($web_HDR_parm('URL')) %x = $INDEX(%PDFDsn, '/') repeat while %x > 0 %PDFDsn = $SUBSTR(%PDFDsn,%x + 1) %x = $INDEX(%PDFDsn, '/') end repeat *create a unique DD name %DDName = 'OUTD' with $SUBSTR($EDITN($USER,'99999'),3,3) *audit 'PDF name=' with %PDFDsn *audit 'ddname =' with %DDName $setg('OUT',%DDName) *use Daemon object to Free DD and Allocate DD to DSN %Daemon = new %DaemonCommands = new %DaemonCommands:add('FREE ' with %DDName) %DaemonCommands:add('ALLOCATE ' with %DDName WITH ' WITH SCOPE=USER DSN=' with %PDFDsn WITH ' OLD SEQUENTIAL') %DaemonResult = %Daemon:run(%DaemonCommands) *audit 'free and allocate Daemon results = ' with %DaemonResult:print %Daemon:discard %DaemonResult:discard *assign Dataset object to DD and open %PDFDataset = new(%DDName) %PDFDataset:open *set up web output $web_on $web_type('APPLICATION/PDF') *loop thru 'binary' PDF records and put in output buffer repeat forever %PDFRecord = %PDFDataset:readRecord if %PDFDataset:state eq afterEnd then loop end end if $web_put_bin(%PDFRecord) end repeat $web_done %PDFDataset:close END FREE ?&OUT=