/* Cgi written by Eric Reinhold */ /* Rexx to keyword search CFSAN web index */ /* expects two variables, QUERY and STYPE, passed in by GET method */ /* Revisions */ /* changed user2 to query on 1997-07-31 */ /* removed closing tags from dd and dt 1997-08-19 */ /* added EXACT search 1998-09-29 */ /* fixed potential '|' in query string 1998-09-29 */ /* added new search options 1999-NOV-09 dms */ /* added sentence to above search options 2000-MAR-10 ear */ /* retrieves search options and footer from wsearch.html - added 2001-JAN-24 */ /* updated header 2001-OCT-10 ear */ /* modified output text 2001-DEC-12 */ /* added debug code to retrieve options and footer from referer file instead of hardcoded 2001-DEC-12 */ /* changed input to use built-in server functions 2004-JUN-28 */ /* added lexicon search 2005-MAR */ /* webserver memory allocation increased to 16M 2005-FEB-17 to fix 'no results found' on large searches */ /* send headers for page, so it validates */ 'output' 'Content-Type: text/html' 'output' '' Address "COMMAND" 'GLOBALV SELECT HTTPD GET VRM' Address "COMMAND" 'GLOBALV SELECT THREAD2 GET HTTP_REFERER' reffile=substr(http_referer,lastpos('/',http_referer)+1) 'callpipe var reffile | change \.\ \ | var reffile' delimit=x2c('1b') /* use non printable characters as delimiters */ endit=x2c('2b') /* get data from form */ 'callpipe *: | ewget parms data. in.' stype = data.stype.1 if (stype='' | stype='DATA.STYPE.1') then stype='OR' /* make sure variables are defined */ if datatype(data.oquery.0,'N')=0 then do /* if stype<>'EXACT' then */ 'callpipe stem data.query. | split | stem data.oquery.' end if datatype(data.matchtype.0,'N')=0 | data.matchtype.0 <> data.oquery.0 then do 'callpipe literal 0| duplicate 'data.oquery.0-1'| stem matchtype.' loop=0 end else do 'callpipe stem data.matchtype. | stem matchtype.' loop=1 end 'callpipe (endchar $) stem data.query. | a: find ++| z: fanin | count lines | var skip', '$ a: | b: find -+| elastic | z:', '$ b: | find --| elastic | z:' if stype='EXACT' then do j='' st='' end else do st='| split' j=stype end 'callpipe (endchar $) stem data.query.', '| change \"\\ | change \''\\ | change \?\\ | change \!\\ ', st, '| stem data.query.', '| strip', '| locate 1', '| sort unique', '| stem searchwords.' if data.oquery.1='' then 'callpipe stem searchwords. | split | stem data.oquery.' call getsource call writehead if searchwords.0=0 then /* warn if there is nothing to do */ do 'output' '
' 'output' 'Nothing to search, please enter a word or phrase to search.
' call hint call include end else do /* searchwords.0=0 */ found.0=0 good=1 if skip=0 then do call searchit end call fmtquery if found.0=0 then do 'output' '
" 'output' '
' 'callpipe stem data.query. | join * | var t1' 'callpipe stem data.oquery. | join * | var t2' if skip>0 then do g=0 do r=1 to data.query.0 if left(data.query.r,2)='++' & matchtype.r=3 then g=1 end end if loop=1 & (skip=0 | t1=t2 | g=1) then call google; else call lex if l=1 then do 'output' '
' /* 'output' 'Try another word or phrase in the text box' 'output' 'or try the FDA Search which includes additional inspectional and', 'compliance references, and materials from FDA''s Public Dockets.' */ call hint call include end end else do 'output' '
Please narrow your search
' end end /* if found.0=0 */ else do /* if found.0=0 else */ 'output' "" 'output' "
\ next ', '| stem found.', '% stem mypipe.', '| elastic', '| f:' if rc=0 then good=1; else good=0 end else do /* syns.0 > 0 */ 'callpipe stem searchwords.|', 'specs /! locate anycase 'delimit'/ 1 w1-* n /'delimit'/ n|', 'literal callpipe (endchar 'endit' stagesep !) < cfsanweb index *|', 'append literal ! *:|', 'join *|', 'pipcmd|', 'chop before str /;;/|', 'sort|', ' spec \
\ next |', 'stem found.' if rc=0 then good=1; else good=0 end /* syns.0 > 0 */ end /* stype=and | exact */ when stype='OR' then do if data.usesyn.1=1 then do call wssyn /* look for synonyms */ if synful > 0 then do /* combine synonyms with original words */ 'callpipe (endchar $) stem syns.', '| split str x05', '| sort unique', '| stem searchwords.' end /* syns.0 > 0 */ end /* data.usesyn.1=1 */ /* 'specs if first() then else \'endit'\ n recno-1 nw \: !\ n endif recno nw \: locate\ n 1-* nw |', */ stange='' do t=(searchwords.0) to 2 by -1 stange=stange||endit||' a: | locate anycase 'delimit''searchwords.t''delimit' | elastic | b:' end 'callpipe (endchar 'endit') < cfsanweb index * |', ' a: fanout |', ' locate anycase 'delimit''searchwords.1''delimit' |', ' b: fanin |', ' chop before str /;;/ |', ' spec \
\ next |', ' sort |', ' uniq count |', 'sort descending |', 'specs 11-* 1 |', ' stem found. 'stange if rc=0 then good=1; else good=0 end otherwise do 'output' '
Unable to process your request
' end end /* debug start 'output' 'This page generated on "date()".
" 'output' '