/* 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' '

Search CFSAN''s Food and Cosmetic Documents

' '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' '

CFSAN Web Search Results

' if good=1 then do if skip=0 then 'output' "No results found for "fmtquery".

" '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' "

CFSAN Web Search Results for "fmtquery"

" 'output' '
(If the item you are looking for is not listed below, try the subject index or use the "Search all FDA web sites" below.)
' 'output' "

" 'output' "

" 'callpipe stem found. | *:' 'output' "
" call include end /* if found.0=0 else */ end /* searchwords.0=0 else */ call writebottom call dropsource exit searchit: /* debug start time('E') 'output' '
Start result code:' rc end debug */ select when stype='AND'|stype='EXACT' then do if data.usesyn.1=1 then do call wssyn end /* data.usesyn.1 */ if synful > 0 then do mypipe.0=0 toppipe.0=1 toppipe.1='callpipe (endchar $ stagesep !) $ < cfsanweb index * !1-0: fanout' do q=1 to syns.0 nextq=toppipe.0+1 toppipe.0=nextq toppipe.nextq='$ 'q'-z: fanin ! 'q+1'-0: fanout' 'callpipe var syns.'q' | split str x05 | stem subwords.' do p=1 to subwords.0 next=mypipe.0 + 1 mypipe.next='$ 'q'-'p-1': ! 'q'-'p': locate anycase \'subwords.p'\! elastic ! 'q'-z:' mypipe.0=next end end 'callpipe (endchar %) stem toppipe.', '| split before str \!\', '| drop last 1', '| append literal ! *:|', ' f: fanin', '| join * ', '| pipcmd ', '| chop before str /;;/', '|sort', '| spec \
\ next word2-* next \\ next \
\ next word1 next \

\ 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 word2-* next \\ next \
\ next word1 next \

\ 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 word2-* next \\ next \
\ next word1 next \

\ 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' '
End result code:' rc 'output' '
Elapsed time:' time("E") end debug */ return wssyn: 'callpipe stem searchwords.', '| specs recno 1 \: locate anycase /\ n x05 n 1-* n x05 n \/ ! append literal \ n', '1-* n \! take 1 !a:\ n', ' write \$\ nw recno nw \: ! \ n', '| literal callpipe (stagesep ! endchar $) a: faninany ! *: $ b: < cfsan thessyn * !', '| drop last 1', '| join *', '| pipcmd ', '| strip x05', '| stem syns.', '| locate x05', '| count lines', '| var synful' return writebottom: 'callpipe < wsearch html * | inside \\ \\ ', '| nlocate anycase \hypertext updated by\ | *:' 'output' "

This page generated on "date()".

" 'output' '

' return writehead: 'output' '' 'output' '' 'callpipe < wsearch html * | inside \\ \\ | *:' return include: /* use 'reffile' instead of wsearch html below to use refering file */ 'callpipe < wsearch html * | inside \\ \\ ', '| *:' return dropsource: address command release nmode return getsource: address command makebuf address command GETFMADR pull . nmode addr zdsk address command dropbuf 'set filepool vmsysu:' address command access dms.webshare nmode return hint: 'output' '


' 'output' '

If a search gave no results, you may also try a new search using the boxes below.' 'output' 'Try using a partial or variation' 'output' 'of the word, such as infant instead of infants,' 'output' 'women instead of woman, folic instead of folate, or' 'output' 'use the search type Any rather than All or Exact Word Phrase.' 'output' '

' return lex: l=1 'callpipe stem data.query. | split | strip | xlate lower | stem lex.' found = 0 do q=1 to lex.0 neednext=0 do while neednext = 0 & matchtype.q <= 3 if skip>0 then do jump=left(lex.q,2) select when jump='++' then do matchtype.q=matchtype.q+1 lex.q=data.oquery.q end when jump='-+' then do lex.q=substr(lex.q,3) end when jump='--' then do lex.q=substr(lex.q,3) end otherwise lex.q=data.oquery.q end end 'callpipe rexx wslex 'matchtype.q lex.0 lex.q'| stem matches'q'. | count lines | var neednext' if rc=0 then good=1; else good=0 if (value('matches'q'.0') > 0 ) then found=1; else matchtype.q=matchtype.q+1 if (found=1 & lex.0>1 & value('matches'q'.0')=1 & value('matches'q'.1')=lex.q & matchtype.q>0) then do found=0 neednext=0 matchtype.q=matchtype.q+1 end if (found=1 & lex.0=1 & matchtype.q=0) then do found=0 /* matchtype.q=4 neednext=0 */ neednext=1 end end end 'callpipe stem matchtype. | join * | var match' if found = 1 & match>0 then do 'output' '
' 'output' '
Did you mean' 'output' '' do q=1 to lex.0 'output' '' 'output' '' if matchtype.q=3 then 'output' '' if matchtype.q=3 then 'output' '' if skip > 0 & matchtype.q <> 3 then do 'callpipe stem matches'q'.', '| specs a: w1 . \\ n', '| *:' end else do 'callpipe stem matches'q'.', '| specs \\ n', '| *:' end if matchtype.q=3 then 'output' '' 'output' '' 'output' '' if lex.0 > 1 & q <> lex.0 & stype <> 'EXACT' & data.query.0 > 1 then 'output 'stype end 'output' '? ' if (stype <> 'EXACT') then do if (data.usesyn.1=1) then qs=' checked' 'output' '
', '' end 'output' '
(Choose a word from the drop down box or select "Show more choices.")' 'output' '
' 'output' '
' end else call google return google: l=0 'callpipe stem data.query. | change \+\\ | split | strip | join * / / | var query' select when stype='OR' then 'callpipe var query | split | join * / OR / | var googlequery' when stype='AND' then googlequery = query when stype='EXACT' then googlequery = '"'||query||'"' otherwise nop end 'output' '
' 'output' 'Search full text of the CFSAN web site and also the FDA/ORA (Office of Regulatory Affairs) and FDA/Dockets sites using the FDA Google Search Appliance:' 'output' '
' 'output' '', '', '', '', '', '', '', '', '', '' 'output' '' 'output' '
' 'output' '
' return fmtquery: if synful > 0 then words='syns.' else words='searchwords.' 'callpipe stem 'words, '| change x05 \ OR \', '| change \--\\', '| change \-+\\', '| change \++\\', '| specs \\ 1 1-* next \\ next', '| join * / 'j' /', '| var fmtquery' return