is procedure test; procedure bom_search_index; procedure bom_search; procedure bom_search(op integer,fid varchar2, stat integer); procedure search(typein varchar2,op integer,fid varchar2,stat integer); procedure all_bom_prod(fid varchar2,stat integer); procedure more_prod(total number, seed integer,stat integer,fid varchar2, capt varchar2); procedure search_button(op integer,fid varchar2, stat integer); procedure by_id(fid varchar2,p varchar2,stat integer) ; procedure more_id(total number, seed integer, p varchar2, fid varchar2, stat integer); procedure keyword(p varchar2,fid varchar2,stat integer); procedure more_key(total number, seed integer, p varchar2, fid varchar2, stat integer); procedure author(p varchar2,fid varchar2,stat integer); procedure more_author(total number, seed integer, p varchar2, fid varchar2, stat integer); procedure day(str varchar2,result out date,tag in out char) ; procedure date_search(fid varchar2,stat integer); procedure parse_date(typein varchar2) ; procedure by_date(typein varchar2,fid varchar2,stat integer); procedure more_date(total number, seed integer, day1 date, day2 date, stat integer,fid varchar2); procedure notyet; end; is cgi_bin constant varchar2(60) := sccs.cgi_bin; username constant varchar2(10) := sccs.username; password constant varchar2(10) := sccs.password; client varchar2(30) := sccs.client; time_out number(8,5) := sccs.time_out; USER_II constant integer := sccs.USER_II; USER_III constant integer := sccs.USER_III; ROOT constant integer := sccs.ROOT; help_page constant varchar2(100) := sccs.help_page; h_caption varchar2(600); total number(8); two bom%ROWTYPE; TYPE wordstype IS TABLE OF varchar2(50) INDEX BY BINARY_INTEGER; word_tab wordstype; w_count BINARY_INTEGER; date_tag char(1); function td(name varchar2) return varchar2 is begin return (''||name||''); end; function th(name varchar2) return varchar2 is begin return (''||name||''); end; function tr(name varchar2) return varchar2 is begin return (''||name||''); end; procedure test is begin htp.p('Content-type: text/html\n\n'); htp.p('OK'); end; procedure bom_search_index is begin /* htp.p('

SCCS Document Search Page

'); htp.p(''); htp.p(''); htp.p(''); wow.sig;*/ --bom_search(6,0,0); bom_search(0,0,0); end; procedure bom_search is begin -- bom_search(6,0,1); bom_search(0,0,1); end; procedure search_button(op integer,fid varchar2, stat integer) is cursor cfolder(tat integer) is select distinct type from bom where status = tat order by type; cat varchar2(100); total number(8); begin -- htp.p('Content-type: text/html\n\n'); htp.p(''); -- htp.p(''); htp.p('
'); htp.p(''); htp.p(''); htp.p(htf.formClose); htp.p('
'); htp.formOpen(cgi_bin||'sccs1.search'); htp.p(htf.url_top('http://www.npac.syr.edu/','')); htp.p(' '); htp.p(' '); htp.p(help_page); --htp.p(''); htp.p('
By: '); htp.formSelectOpen('op'); if (op = 0) then htp.p('Category:'); select count(*) into total from bom where status=stat; if (total > 20) then htp.p(''); end if; if (fid = '0') then htp.p('
'); end; procedure bom_search(op integer,fid varchar2, stat integer) is begin search_button(op,fid, stat); all_bom_prod(fid,stat); end; procedure search(typein varchar2,op integer,fid varchar2, stat integer) is begin if ((op = 6 ) and fid='0') then if (stat = 1) then bom_search; else bom_search_index; end if; return; end if; if (op=6) then bom_search(6,fid,stat); -- by_id(fid,NULL,stat); return; end if; if (op=1) then by_id(fid,lower(typein), stat); return; end if; if (op=0) then keyword(lower(typein),fid,stat); return; end if; if (op=2) then by_date(typein,fid, stat); return; end if; if (op=3) then author(lower(typein),fid, stat); return; end if; if (op=4) then sccs3.by_project(lower(typein),fid, stat); return; end if; notyet; wow.sig; end; procedure keyword(p varchar2,fid varchar2,stat integer) is cursor fcuser(p varchar2,tat integer,f_id varchar2) is select * from bom where status=tat and type=f_id --and (lower(title||abs) like '%'||p||'%') order by id desc; and (lower(title) like '%'||p||'%') order by id desc; cursor cuser(p varchar2,tat integer) is select * from bom where status=tat and (lower(title) like '%'||p||'%') order by id desc; num integer := 0; n integer; iseed integer; next number(8); prev number(8); next_str varchar2(20):=NULL; prev_str varchar2(20):=NULL; curr_str varchar2(20):=NULL; begin search_button(0,fid,stat); htp.p('
'); if (fid=0) then open cuser(p,stat); else open fcuser(p,stat,fid); end if; h_caption := ' containing keyword '||htf.bold(p); htp.p('
SCCS Production Documents'); htp.p(h_caption||'
'); htp.p('
'); loop if (fid=0) then fetch cuser into two; exit when cuser%NOTFOUND; else fetch fcuser into two; exit when fcuser%NOTFOUND; end if; num := num + 1; end loop; if ( num =0 ) then htp.p('
'); htp.p(''); htp.p('

The document '||h_caption||' dose not exist!'); return; end if; total := num; -- total := cuser%ROWCOUNT; if (fid=0) then close cuser; else close fcuser; end if; if (total > 0 ) then next := 21; if ( next<=total) then if ((next+20)<=total) then next_str := (next+19); else next_str := total; end if; next_str := next||'-'||next_str; curr_str := next - 1; else curr_str := total; end if; htp.p('

'); htp.p('
Total: '||total||' | '); htp.p('Current: '||'1 -'||curr_str||' '); if (next_str IS NOT NULL) then htp.p(' | '); htp.p(htf.url(cgi_bin||'sccs1.more_key?total='||total|| '&seed='||next||'&p='||p||'&fid='||fid||'&stat='|| stat,'Next '||next_str)); end if; htp.p('
'); if (fid=0) then open cuser(p,stat); else open fcuser(p,stat,fid); end if; num := 0; loop if (fid=0) then fetch cuser into two; exit when cuser%NOTFOUND; else fetch fcuser into two; exit when fcuser%NOTFOUND; end if; num := num + 1; htp.p('

SCCS-'||two.id||':'); if (two.url IS NOT NULL) then htp.ap(''||htf.url(two.url,two.title)||''); else htp.bp(''||two.title||''); end if; htp.p('
'); if (two.furl IS NOT NULL) then htp.p(htf.url(two.furl,'Full HTML')); htp.p('       '); end if; if (two.psurl IS NOT NULL) then htp.p(htf.url(two.psurl,'PostScript')); htp.p('       '); end if; if (two.pdfurl IS NOT NULL) then htp.p(htf.url(two.pdfurl,'PDF')); htp.p('       '); end if; if (two.rawurl IS NOT NULL) then htp.p(htf.url(two.rawurl,'Raw Text')); end if; htp.ap('
'||two.author); htp.p('; '||to_char(two.pub_date,'mm-dd-yy')||''); if (not ( two.type = 1)) then htp.p('
'); htp.p(htf.url(cgi_bin||'sccs2.show_info?docid='||two.id ||'&doctype='||two.type,'Addition Information')); end if; /* if (two.abs IS NOT NULL) then htp.p('
'); htp.ap(two.abs); end if; */ if ( num = 20 ) then exit; end if; end loop; htp.p('
'); --htp.p('Total: '||htf.bold(cuser%ROWCOUNT)); htp.p(''); htp.p('
'); htp.p(' p.'); n := ceil(total/20); if (n > 20) then n := 20; end if; for i in 1..n loop iseed := (i-1)*20 + 1; if (iseed = 0 ) then htp.p(' '||i); else htp.p(' '||htf.url(cgi_bin||'sccs1.more_key?total='|| total||'&seed='||iseed||'&p='||p||'&fid='|| fid||'&stat='||stat,i)); end if; end loop; if (next_str IS NOT NULL) then htp.p('['||htf.url(cgi_bin||'sccs1.more_key?total='||total|| '&seed='||next||'&p='||p||'&fid='||fid|| '&stat='||stat,'Next')||']'); end if; htp.p('
'); else htp.p('No SCCS Production Document Found'); end if; if (fid=0) then close cuser; else close fcuser; end if; wow.sig; end; procedure more_key(total number, seed integer, p varchar2, fid varchar2, stat integer) is cursor cuser(p varchar2,tat integer) is select * from bom where status=tat --and (lower(title||abs) like '%'||p||'%') order by id desc; and (lower(title) like '%'||p||'%') order by id desc; cursor fcuser(p varchar2,tat integer,f_id varchar2) is select * from bom where status=tat and type=f_id --and (lower(title||abs) like '%'||p||'%') order by id desc; and (lower(title) like '%'||p||'%') order by id desc; num integer; n integer; iseed integer; next number(8); prev number(8); next_str varchar2(20):=NULL; prev_str varchar2(20):=NULL; curr_str varchar2(20):=NULL; begin search_button(0,fid,stat); htp.p('
'); -- open cuser(p); h_caption := ' containing keyword '||htf.bold(p); htp.p('
SCCS Production Documents'); htp.p(h_caption||'
'); htp.p('
'); next := seed + 20; if (next<=total) then if ((next+20)<=total) then next_str := (next+19); else next_str := total; end if; next_str := next||'-'||next_str; curr_str := next - 1; else curr_str := total; end if; prev := seed - 20; if (prev >= 1) then prev_str := prev||'-'||(seed-1); elsif (seed > 1) then prev := 1; prev_str := '1-'|| 20; end if; htp.p('
'); htp.p('
Total: '||total||' | '); htp.p('Current: '||seed||'-'||curr_str||' '); if (next_str IS NOT NULL) then htp.p(' | '); htp.p(htf.url(cgi_bin||'sccs1.more_key?total='||total|| '&seed='||next||'&p='||p||'&fid='||fid|| '&stat='||stat,'Next '||next_str)); end if; if (prev_str IS NOT NULL) then htp.p(' |'); htp.p(htf.url(cgi_bin||'sccs1.more_key?total='||total|| '&seed='||prev||'&p='||p||'&fid='||fid||'&stat='||stat, 'Prev '||prev_str)); end if; htp.p('
'); if (fid=0) then open cuser(p,stat); else open fcuser(p,stat,fid); end if; num := 0; loop if (fid=0) then fetch cuser into two; exit when cuser%NOTFOUND; else fetch fcuser into two; exit when fcuser%NOTFOUND; end if; num := num + 1; if (num >= seed) then htp.p('

SCCS-'||two.id||':'); if (two.url IS NOT NULL) then htp.ap(''||htf.url(two.url,two.title)||''); else htp.bp(''||two.title||''); end if; htp.p('
'); if (two.furl IS NOT NULL) then htp.p(htf.url(two.furl,'Full HTML')); htp.p('       '); end if; if (two.psurl IS NOT NULL) then htp.p(htf.url(two.psurl,'PostScript')); htp.p('       '); end if; if (two.pdfurl IS NOT NULL) then htp.p(htf.url(two.pdfurl,'PDF')); htp.p('       '); end if; if (two.rawurl IS NOT NULL) then htp.p(htf.url(two.rawurl,'Raw Text')); end if; htp.ap('
'||two.author); htp.p('; '||to_char(two.pub_date,'mm-dd-yy')||''); if (not ( two.type = 1)) then htp.p('
'); htp.p(htf.url(cgi_bin||'sccs2.show_info?docid=' ||two.id||'&doctype='|| two.type,'Addition Information')); end if; /* if (two.abs IS NOT NULL) then htp.p('
'); htp.ap(two.abs); htp.p(''); end if; */ end if; if ( num >= (seed + 19) ) then exit; end if; end loop; if (fid=0) then close cuser; else close fcuser; end if; htp.p('
'); htp.p(''); htp.p('
'); htp.p(' p.'); n := ceil(total/20); if (n > 20) then n := 20; end if; for i in 1..n loop iseed := (i-1)*20 + 1; if (iseed = 0 ) then htp.p(' '||i); else htp.p(' '||htf.url(cgi_bin||'sccs1.more_key?total='|| total||'&seed='||iseed||'&p='||p||'&fid='||fid ||'&stat='||stat,i)); end if; end loop; if (next_str IS NOT NULL) then htp.p('['||htf.url(cgi_bin||'sccs1.more_key?total='||total|| '&seed='||next||'&p='||p||'&fid='||fid ||'&stat='||stat,'Next')||']'); end if; htp.p('
'); wow.sig; end; procedure author(p varchar2,fid varchar2,stat integer) is cursor cuser(p varchar2,tat integer) is select * from bom where status=tat and (lower(author) like '%'||p||'%') order by id desc; cursor fcuser(p varchar2,tat integer,f_id varchar2) is select * from bom where status=tat and type=f_id and (lower(author) like '%'||p||'%') order by id desc; num integer := 0; n integer; iseed integer; next number(8); prev number(8); next_str varchar2(20):=NULL; prev_str varchar2(20):=NULL; curr_str varchar2(20):=NULL; begin search_button(3,fid,stat); htp.p('
'); if (fid=0) then open cuser(p,stat); else open fcuser(p,stat,fid); end if; h_caption := ' authored by *'||htf.bold(p)||'*'; htp.p('
SCCS Production Documents'); htp.p(h_caption||'
'); htp.p('
'); loop if (fid=0) then fetch cuser into two; exit when cuser%NOTFOUND; else fetch fcuser into two; exit when fcuser%NOTFOUND; end if; num := num + 1; end loop; if ( num =0 ) then htp.p('
'); htp.p(''); htp.p('

The document '||h_caption||' dose not exist!'); return; end if; total := num; -- total := cuser%ROWCOUNT; if (fid=0) then close cuser; else close fcuser; end if; if (total > 0 ) then next := 21; if ( next<=total) then if ((next+20)<=total) then next_str := (next+19); else next_str := total; end if; next_str := next||'-'||next_str; curr_str := next - 1; else curr_str := total; end if; htp.p('

'); htp.p('
Total: '||total||' | '); htp.p('Current: '||'1 -'||curr_str||' '); if (next_str IS NOT NULL) then htp.p(' | '); htp.p(htf.url(cgi_bin||'sccs1.more_author?total='||total|| '&seed='||next||'&p='||p||'&fid='||fid||'&stat='||stat, 'Next '||next_str)); end if; htp.p('
'); if (fid=0) then open cuser(p,stat); else open fcuser(p,stat,fid); end if; num := 0; loop if (fid=0) then fetch cuser into two; exit when cuser%NOTFOUND; else fetch fcuser into two; exit when fcuser%NOTFOUND; end if; num := num + 1; htp.p('

SCCS-'||two.id||':'); if (two.url IS NOT NULL) then htp.ap(''||htf.url(two.url,two.title)||''); else htp.bp(''||two.title||''); end if; htp.p('
'); if (two.furl IS NOT NULL) then htp.p(htf.url(two.furl,'Full HTML')); htp.p('       '); end if; if (two.psurl IS NOT NULL) then htp.p(htf.url(two.psurl,'PostScript')); htp.p('       '); end if; if (two.pdfurl IS NOT NULL) then htp.p(htf.url(two.pdfurl,'PDF')); htp.p('       '); end if; if (two.rawurl IS NOT NULL) then htp.p(htf.url(two.rawurl,'Raw Text')); end if; htp.ap('
'||two.author); htp.p('; '||to_char(two.pub_date,'mm-dd-yy')||''); if (not ( two.type = 1)) then htp.p('
'); htp.p(htf.url(cgi_bin||'sccs2.show_info?docid='||two.id ||'&doctype='||two.type,'Addition Information')); end if; /* if (two.abs IS NOT NULL) then htp.p('
'); htp.ap(two.abs); end if; */ if ( num = 20 ) then exit; end if; end loop; htp.p('
'); htp.p(''); htp.p('
'); htp.p(' p.'); n := ceil(total/20); if (n > 20) then n := 20; end if; for i in 1..n loop iseed := (i-1)*20 + 1; if (iseed = 0 ) then htp.p(' '||i); else htp.p(' '||htf.url(cgi_bin||'sccs1.more_author?total=' ||total||'&seed='||iseed||'&p='||p||'&fid='|| fid||'&stat='||stat,i)); end if; end loop; if (next_str IS NOT NULL) then htp.p('['||htf.url(cgi_bin||'sccs1.more_author?total='|| total||'&seed='||next||'&p='||p||'&fid='||fid ||'&stat='||stat,'Next')||']'); end if; htp.p('
'); else htp.p('No SCCS Production Document Found'); end if; if (fid=0) then close cuser; else close fcuser; end if; wow.sig; end; procedure more_author(total number, seed integer, p varchar2, fid varchar2, stat integer) is cursor cuser(p varchar2,tat integer) is select * from bom where status=tat and (lower(author) like '%'||p||'%') order by id desc; cursor fcuser(p varchar2,tat integer,f_id varchar2) is select * from bom where status=tat and type=f_id and (lower(author) like '%'||p||'%') order by id desc; num integer; n integer; iseed integer; next number(8); prev number(8); next_str varchar2(20):=NULL; prev_str varchar2(20):=NULL; curr_str varchar2(20):=NULL; begin search_button(3,fid,stat); htp.p('
'); -- open cuser(p); h_caption := ' authored by '||htf.bold(p); htp.p('
SCCS Production Documents'); htp.p(h_caption||'
'); htp.p('
'); next := seed + 20; if (next<=total) then if ((next+20)<=total) then next_str := (next+19); else next_str := total; end if; next_str := next||'-'||next_str; curr_str := next - 1; else curr_str := total; end if; prev := seed - 20; if (prev >= 1) then prev_str := prev||'-'||(seed-1); elsif (seed > 1) then prev := 1; prev_str := '1-'|| 20; end if; htp.p('
'); htp.p('
Total: '||total||' | '); htp.p('Current: '||seed||'-'||curr_str||' '); if (next_str IS NOT NULL) then htp.p(' | '); htp.p(htf.url(cgi_bin||'sccs1.more_author?total='||total|| '&seed='||next||'&p='||p||'&fid='||fid ||'&stat='||stat,'Next '||next_str)); end if; if (prev_str IS NOT NULL) then htp.p(' |'); htp.p(htf.url(cgi_bin||'sccs1.more_author?total='||total|| '&seed='||prev||'&p='||p||'&fid='||fid||'&stat='||stat, 'Prev '||prev_str)); end if; htp.p('
'); if (fid=0) then open cuser(p,stat); else open fcuser(p,stat,fid); end if; num := 0; loop if (fid=0) then fetch cuser into two; exit when cuser%NOTFOUND; else fetch fcuser into two; exit when fcuser%NOTFOUND; end if; num := num + 1; if (num >= seed) then htp.p('

SCCS-'||two.id||':'); if (two.url IS NOT NULL) then htp.ap(''||htf.url(two.url,two.title)||''); else htp.bp(''||two.title||''); end if; htp.p('
'); if (two.furl IS NOT NULL) then htp.p(htf.url(two.furl,'Full HTML')); htp.p('       '); end if; if (two.psurl IS NOT NULL) then htp.p(htf.url(two.psurl,'PostScript')); htp.p('       '); end if; if (two.pdfurl IS NOT NULL) then htp.p(htf.url(two.pdfurl,'PDF')); htp.p('       '); end if; if (two.rawurl IS NOT NULL) then htp.p(htf.url(two.rawurl,'Raw Text')); end if; htp.ap('
'||two.author); htp.p('; '||to_char(two.pub_date,'mm-dd-yy')||''); if (not ( two.type = 1)) then htp.p('
'); htp.p(htf.url(cgi_bin||'sccs2.show_info?docid=' ||two.id||'&doctype='|| two.type,'Addition Information')); end if; /* if (two.abs IS NOT NULL) then htp.p('
'); htp.ap(two.abs); htp.p(''); end if; */ end if; if ( num >= (seed + 19) ) then exit; end if; end loop; if (fid=0) then close cuser; else close fcuser; end if; htp.p('
'); htp.p(''); htp.p('
'); htp.p(' p.'); n := ceil(total/20); if (n > 20) then n := 20; end if; for i in 1..n loop iseed := (i-1)*20 + 1; if (iseed = 0 ) then htp.p(' '||i); else htp.p(' '||htf.url(cgi_bin||'sccs1.more_author?total='|| total||'&seed='||iseed||'&p='||p||'&fid='||fid ||'&stat='||stat,i)); end if; end loop; if (next_str IS NOT NULL) then htp.p('['||htf.url(cgi_bin||'sccs1.more_author?total='||total|| '&seed='||next||'&p='||p||'&fid='||fid|| '&stat='||stat,'Next')||']'); end if; htp.p('
'); wow.sig; end; procedure by_id(fid varchar2, stat integer) is begin by_id(fid,NULL,stat); end; procedure by_id(fid varchar2,p varchar2, stat integer) is cursor cuser(docid varchar2, tat integer) is select * from bom where status=tat and (lower(id) like '%'||docid||'%') order by id desc; cursor fcuser(docid varchar2, tat integer,f_id varchar2) is select * from bom where status=tat and type=f_id and (lower(id) like '%'||docid||'%') order by id desc; num integer := 0; n integer; iseed integer; next number(8); prev number(8); next_str varchar2(20):=NULL; prev_str varchar2(20):=NULL; curr_str varchar2(20):=NULL; begin search_button(1,fid,stat); if p IS NULL then if (fid = '0') then all_bom_prod(fid,stat); return; end if; end if; if (fid=0) then open cuser(p,stat); else open fcuser(p,stat,fid); end if; h_caption := 'with SCCS ID ='||htf.bold(p); htp.p('
'); htp.p('
'); htp.p('SCCS Documents '||h_caption||'
'); htp.p('
'); loop if (fid=0) then fetch cuser into two; exit when cuser%NOTFOUND; else fetch fcuser into two; exit when fcuser%NOTFOUND; end if; num := num + 1; end loop; if ( num =0 ) then htp.p('
'); htp.p(''); htp.p('

The document '||h_caption||' does not exist!'); return; end if; total := num; if (fid=0) then close cuser; else close fcuser; end if; if (total > 0 ) then next := 21; if ( next<=total) then if ((next+20)<=total) then next_str := (next+19); else next_str := total; end if; next_str := next||'-'||next_str; curr_str := next - 1; else curr_str := total; end if; htp.p('

'); htp.p('
Total: '||total||' | '); htp.p('Current: '||'1 -'||curr_str||' '); if (next_str IS NOT NULL) then htp.p(' | '); htp.p(htf.url(cgi_bin||'sccs1.more_id?total='||total|| '&seed='||next||'&p='||p||'&fid='||fid||'&stat='||stat, 'Next '||next_str)); end if; htp.p('
'); if (fid=0) then open cuser(p,stat); else open fcuser(p,stat,fid); end if; num := 0; loop if (fid=0) then fetch cuser into two; exit when cuser%NOTFOUND; else fetch fcuser into two; exit when fcuser%NOTFOUND; end if; num := num + 1; htp.p('

SCCS-'||two.id||':'); if (two.url IS NOT NULL) then htp.ap(''||htf.url(two.url,two.title)||''); else htp.bp(''||two.title||''); end if; htp.p('
'); if (two.furl IS NOT NULL) then htp.p(htf.url(two.furl,'Full HTML')); htp.p('       '); end if; if (two.psurl IS NOT NULL) then htp.p(htf.url(two.psurl,'PostScript')); htp.p('       '); end if; if (two.pdfurl IS NOT NULL) then htp.p(htf.url(two.pdfurl,'PDF')); htp.p('       '); end if; if (two.rawurl IS NOT NULL) then htp.p(htf.url(two.rawurl,'Raw Text')); end if; htp.ap('
'||two.author); htp.p('; '||to_char(two.pub_date,'mm-dd-yy')||''); if (not ( two.type = 1)) then htp.p('
'); htp.p(htf.url(cgi_bin||'sccs2.show_info?docid='||two.id ||'&doctype='||two.type,'Addition Information')); end if; /* if (two.abs IS NOT NULL) then htp.p('
'); htp.ap(two.abs); end if; */ if ( num = 20 ) then exit; end if; end loop; htp.p('
'); htp.p(''); htp.p('
'); htp.p(' p.'); n := ceil(total/20); if (n > 20) then n := 20; end if; for i in 1..n loop iseed := (i-1)*20 + 1; if (iseed = 0 ) then htp.p(' '||i); else htp.p(' '||htf.url(cgi_bin||'sccs1.more_id?total='|| total||'&seed='||iseed||'&p='||p||'&fid='|| fid||'&stat='||stat,i)); end if; end loop; if (next_str IS NOT NULL) then htp.p('['||htf.url(cgi_bin||'sccs1.more_id?total='||total|| '&seed='||next||'&p='||p||'&fid='||fid ||'&stat='||stat,'Next')||']'); end if; htp.p('
'); else htp.p('No SCCS Production Document Found'); end if; if (fid=0) then close cuser; else close fcuser; end if; wow.sig; end; procedure more_id(total number, seed integer, p varchar2, fid varchar2, stat integer) is cursor cuser(p varchar2,tat integer) is select * from bom where status=tat and (lower(id) like '%'||p||'%') order by id desc; cursor fcuser(p varchar2,tat integer,f_id varchar2) is select * from bom where status=tat and type=fid and (lower(id) like '%'||p||'%') order by id desc; num integer; n integer; iseed integer; next number(8); prev number(8); next_str varchar2(20):=NULL; prev_str varchar2(20):=NULL; curr_str varchar2(20):=NULL; begin search_button(1,fid, stat); htp.p('
'); h_caption := ' with SCCS ID = '||htf.bold(p); htp.p('
SCCS Production Documents'); htp.p(h_caption||'
'); htp.p('
'); next := seed + 20; if (next<=total) then if ((next+20)<=total) then next_str := (next+19); else next_str := total; end if; next_str := next||'-'||next_str; curr_str := next - 1; else curr_str := total; end if; prev := seed - 20; if (prev >= 1) then prev_str := prev||'-'||(seed-1); elsif (seed > 1) then prev := 1; prev_str := '1-'|| 20; end if; htp.p('
'); htp.p('
Total: '||total||' | '); htp.p('Current: '||seed||'-'||curr_str||' '); if (next_str IS NOT NULL) then htp.p(' | '); htp.p(htf.url(cgi_bin||'sccs1.more_id?total='||total|| '&seed='||next||'&p='||p||'&fid='||fid|| '&stat='||stat,'Next '||next_str)); end if; if (prev_str IS NOT NULL) then htp.p(' |'); htp.p(htf.url(cgi_bin||'sccs1.more_id?total='||total|| '&seed='||prev||'&p='||p||'&fid='||fid||'&stat='||stat, 'Prev '||prev_str)); end if; htp.p('
'); if (fid=0) then open cuser(p,stat); else open fcuser(p,stat,fid); end if; num := 0; loop if (fid=0) then fetch cuser into two; exit when cuser%NOTFOUND; else fetch fcuser into two; exit when fcuser%NOTFOUND; end if; num := num + 1; if (num >= seed) then htp.p('

SCCS-'||two.id||':'); if (two.url IS NOT NULL) then htp.ap(''||htf.url(two.url,two.title)||''); else htp.bp(''||two.title||''); end if; htp.p('
'); if (two.furl IS NOT NULL) then htp.p(htf.url(two.furl,'Full HTML')); htp.p('       '); end if; if (two.psurl IS NOT NULL) then htp.p(htf.url(two.psurl,'PostScript')); htp.p('       '); end if; if (two.pdfurl IS NOT NULL) then htp.p(htf.url(two.pdfurl,'PDF')); htp.p('       '); end if; if (two.rawurl IS NOT NULL) then htp.p(htf.url(two.rawurl,'Raw Text')); end if; htp.ap('
'||two.author); htp.p('; '||to_char(two.pub_date,'mm-dd-yy')||''); if (not ( two.type = 1)) then htp.p('
'); htp.p(htf.url(cgi_bin||'sccs2.show_info?docid=' ||two.id||'&doctype='|| two.type,'Addition Information')); end if; /* if (two.abs IS NOT NULL) then htp.p('
'); htp.ap(two.abs); htp.p(''); end if; */ end if; if ( num >= (seed + 19) ) then exit; end if; end loop; if (fid=0) then close cuser; else close fcuser; end if; htp.p('
'); htp.p(''); htp.p('
'); htp.p(' p.'); n := ceil(total/20); if (n > 20) then n := 20; end if; for i in 1..n loop iseed := (i-1)*20 + 1; if (iseed = 0 ) then htp.p(' '||i); else htp.p(' '||htf.url(cgi_bin||'sccs1.more_id?total='|| total||'&seed='||iseed||'&p='||p||'&fid='||fid ||'&stat='||stat,i)); end if; end loop; if (next_str IS NOT NULL) then htp.p('['||htf.url(cgi_bin||'sccs1.more_id?total='||total|| '&seed='||next||'&p='||p||'&fid='||fid|| '&stat='||stat,'Next')||']'); end if; htp.p('
'); wow.sig; end; procedure all_bom_prod(fid varchar2,stat integer) is cursor cuser(tat integer) is select * from bom where status=tat order by id desc; cursor fcuser(tat integer,fid varchar2) is select * from bom where status=tat and type=fid order by id desc; h_time varchar2(50) := '
'; h_desc varchar2(2000); h_status varchar2(30):= 'Production'; capt varchar2(50) := 'Documents'; num integer; n integer; iseed integer; next number(8); prev number(8); next_str varchar2(20):=NULL; prev_str varchar2(20):=NULL; curr_str varchar2(20):=NULL; begin htp.p('
'); if (fid=0) then select count(*) into total from bom where status=stat; else select count(*) into total from bom where status=stat and type=fid; if (fid=1) then capt := 'Technical Papers'; elsif (fid=2) then capt := 'Conference Papers'; elsif (fid=3) then capt := 'Technical & Conference'; elsif (fid=4) then capt := 'Journal Papers'; elsif (fid=5) then capt := 'Internal Proposal'; elsif (fid=6) then capt := 'Books'; else capt := 'Phd Thesis'; end if; end if; if (total > 0 ) then htp.p('

List of NPAC SCCS All '||capt|| '

'); htp.p(htf.url('/sccs/cgi-bin/create_list','Non database list all production documents')||'
'); htp.p('
'); next := 21; if ( next<=total) then if ((next+20)<=total) then next_str := (next+19); else next_str := total; end if; next_str := next||'-'||next_str; curr_str := next - 1; else curr_str := total; end if; htp.p('
'); htp.p('
Total: '||total||' | '); htp.p('Current: '||'1 -'||curr_str||' '); if (next_str IS NOT NULL) then htp.p(' | '); htp.p(htf.url(cgi_bin||'sccs1.more_prod?total='||total|| '&seed='||next||'&stat='||stat||'&fid='||fid ||'&capt='||capt, 'Next '||next_str)); end if; htp.p('
'); if (fid=0) then open cuser(stat); else open fcuser(stat,fid); end if; num := 0; loop if (fid=0) then fetch cuser into two; exit when cuser%NOTFOUND; else fetch fcuser into two; exit when fcuser%NOTFOUND; end if; num := num + 1; htp.p('

SCCS-'||two.id||':'); if (two.url IS NOT NULL) then htp.ap(''||htf.url(two.url,two.title)||''); else htp.bp(''||two.title||''); end if; htp.p('
'); if (two.furl IS NOT NULL) then htp.p(htf.url(two.furl,'Full HTML')); htp.p('       '); end if; if (two.psurl IS NOT NULL) then htp.p(htf.url(two.psurl,'PostScript')); htp.p('       '); end if; if (two.pdfurl IS NOT NULL) then htp.p(htf.url(two.pdfurl,'PDF')); htp.p('       '); end if; if (two.rawurl IS NOT NULL) then htp.p(htf.url(two.rawurl,'Raw Text')); end if; htp.p('
'||two.author); htp.p('; '||to_char(two.pub_date,'mm-dd-yy')||''); if (not ( two.type = 1)) then htp.p('
'); htp.p(htf.url(cgi_bin||'sccs2.show_info?docid=' ||two.id||'&doctype='|| two.type,'Addition Information')); end if; /* if (two.abs IS NOT NULL) then htp.p('
'); htp.ap(two.abs); end if; */ if ( num = 20 ) then exit; end if; end loop; if (fid=0) then close cuser; else close fcuser; end if; htp.p('
'); htp.p(''); htp.p('
'); htp.p(' p.'); n := ceil(total/20); if (n > 20) then n := 20; end if; for i in 1..n loop iseed := (i-1)*20 + 1; if (iseed = 0 ) then htp.p(' '||i); else htp.p(' '||htf.url(cgi_bin||'sccs1.more_prod?total='|| total||'&seed='||iseed||'&stat='||stat ||'&fid='||fid||'&capt='||capt,i)); end if; end loop; if (next_str IS NOT NULL) then htp.p('['||htf.url(cgi_bin||'sccs1.more_prod?total='||total ||'&seed='||next||'&stat='||stat||'&fid='||fid|| '&capt='||capt,'Next')||']'); end if; htp.p('
'); else htp.p('No SCCS Production document yet.'); end if; end; procedure more_prod(total number, seed integer,stat integer,fid varchar2, capt varchar2) is cursor cuser(tat integer) is select * from bom where status=tat order by id desc; cursor fcuser(tat integer,fid varchar2) is select * from bom where status=tat and type=fid order by id desc; h_time varchar2(50) := '
'; h_desc varchar2(2000); h_status varchar2(30):= 'Production'; num integer; n integer; iseed integer; next number(8); prev number(8); next_str varchar2(20):=NULL; prev_str varchar2(20):=NULL; curr_str varchar2(20):=NULL; begin search_button(6,fid,stat); htp.p('
'); htp.p('

List of NPAC SCCS All '||capt||'

'); htp.p(htf.url('/sccs/cgi-bin/create_list','Non database list all production documents')||'
'); htp.p('
'); next := seed + 20; if (next<=total) then if ((next+20)<=total) then next_str := (next+19); else next_str := total; end if; next_str := next||'-'||next_str; curr_str := next - 1; else curr_str := total; end if; prev := seed - 20; if (prev >= 1) then prev_str := prev||'-'||(seed-1); elsif (seed > 1) then prev := 1; prev_str := '1-'|| 20; end if; htp.p('
'); htp.p('
Total: '||total||' | '); htp.p('Current: '||seed||'-'||curr_str||' '); if (next_str IS NOT NULL) then htp.p(' | '); htp.p(htf.url(cgi_bin||'sccs1.more_prod?total='||total|| '&seed='||next||'&stat='||stat||'&fid='||fid|| '&capt='||capt,'Next '||next_str)); end if; if (prev_str IS NOT NULL) then htp.p(' |'); htp.p(htf.url(cgi_bin||'sccs1.more_prod?total='||total|| '&seed='||prev||'&stat='||stat||'&fid='||fid|| '&capt='||capt,'Prev '||prev_str)); end if; htp.p('
'); if (fid=0) then open cuser(stat); else open fcuser(stat,fid); end if; num := 0; loop if (fid=0) then fetch cuser into two; exit when cuser%NOTFOUND; else fetch fcuser into two; exit when fcuser%NOTFOUND; end if; num := num + 1; if (num >= seed) then htp.p('

SCCS-'||two.id||':'); if (two.url IS NOT NULL) then htp.ap(''||htf.url(two.url,two.title)||''); else htp.bp(''||two.title||''); end if; htp.p('
'); if (two.furl IS NOT NULL) then htp.p(htf.url(two.furl,'Full HTML')); htp.p('       '); end if; if (two.psurl IS NOT NULL) then htp.p(htf.url(two.psurl,'PostScript')); htp.p('       '); end if; if (two.pdfurl IS NOT NULL) then htp.p(htf.url(two.pdfurl,'PDF')); htp.p('       '); end if; if (two.rawurl IS NOT NULL) then htp.p(htf.url(two.rawurl,'Raw Text')); end if; htp.ap('
'||two.author); htp.p('; '||to_char(two.pub_date,'mm-dd-yy')||''); if (not ( two.type = 1)) then htp.p('
'); htp.p(htf.url(cgi_bin||'sccs2.show_info?docid=' ||two.id||'&doctype='|| two.type,'Addition Information')); end if; /* if (two.abs IS NOT NULL) then htp.p('
'); htp.ap(two.abs); htp.p(''); end if; */ end if; if ( num >= (seed + 19) ) then exit; end if; end loop; if (fid=0) then close cuser; else close fcuser; end if; htp.p('
'); htp.p(''); htp.p('
'); htp.p(' p.'); n := ceil(total/20); if (n > 20) then n := 20; end if; for i in 1..n loop iseed := (i-1)*20 + 1; if (iseed = 0 ) then htp.p(' '||i); else htp.p(' '||htf.url(cgi_bin||'sccs1.more_prod?total='|| total||'&seed='||iseed||'&stat='||stat||'&fid='||fid ||'&capt='||capt,i)); end if; end loop; if (next_str IS NOT NULL) then htp.p('['||htf.url(cgi_bin||'sccs1.more_prod?total='||total|| '&seed='||next||'&stat='||stat||'&fid='||fid ||'&capt='||capt,'Next')||']'); end if; htp.p('
'); end; procedure notyet is begin search_button(6,0,1); htp.p('
Sorry, this function has not implemented yet in the demo. Stay tuned!'); end; procedure by_date(typein varchar2,fid varchar2,stat integer) is begin parse_date(typein); if (w_count = 0) then bom_search; else search_button(2,fid,stat); htp.p('
'); date_search(fid,stat); end if; end; procedure parse_date(typein varchar2) is words varchar2(300); i integer := 1; j integer; n integer; begin w_count := 0; words := typein; while ((words IS NOT NULL) and (substr(words,1,1) = ' ')) loop words := substr(words,2); end loop; if (words IS NULL) then return; end if; n := length(words); -- 47 = '/'; 48-57 = '0'-'9' while (i<=n and (ascii(substr(words,i,1)) between 47 and 57)) loop i := i + 1; end loop; if (i = 1) then words := substr(words,2); while ((words IS NOT NULL) and not (ascii(substr(words,1,1)) between 47 and 57)) loop words := substr(words,2); end loop; -- when i>n w_count=0 is used to indicate the null typein if (words IS NOT NULL) then date_tag := '<'; -- before one date n := length(words); i := 1; while (i<=n and (ascii(substr(words,i,1)) between 47 and 57)) loop i := i + 1; end loop; w_count := w_count + 1; word_tab(w_count) := substr(words,1,i-1); end if; elsif (i > n) then date_tag := 'o'; -- one date item only w_count := w_count + 1; word_tab(w_count) := words; else w_count := w_count + 1; word_tab(w_count) := substr(words,1,i-1); words := substr(words,i); n := length(words); i := 1; while (i<=n and not (ascii(substr(words,i,1)) between 47 and 57)) loop i := i + 1; end loop; if (i > n) then date_tag := '>'; -- after one date else date_tag := 'b'; -- between two date items words := substr(words,i); n := length(words); i := 1; while (i<=n and (ascii(substr(words,i,1)) between 47 and 57)) loop i := i + 1; end loop; w_count := w_count + 1; word_tab(w_count) := substr(words,1,i-1); end if; end if; end; procedure date_search(fid varchar2,stat integer) is cursor cdate(date1 date,date2 date,tat integer) is select * from bom where status = tat and (pub_date between date1 and date2) order by id desc; cursor fcdate(date1 date,date2 date,tat integer,f_id varchar2) is select * from bom where status = tat and (pub_date between date1 and date2) and type=f_id order by id desc; day1 date; day2 date; tag char(1); num integer := 0; n integer; iseed integer; next number(8); prev number(8); next_str varchar2(20):=NULL; prev_str varchar2(20):=NULL; curr_str varchar2(20):=NULL; words varchar2(100); begin day(word_tab(1),day1,tag); if (day1 = NULL) then return; end if; if (date_tag = 'b') then day(word_tab(2),day2,tag); if (day2 = NULL) then return; end if; if (tag = 'y') then day2 := to_date('3112'||to_char(day2,'yy'),'ddmmyy'); elsif (tag = 'm') then day2 := to_date(to_char(last_day(day2),'dd')||to_char(day2,'mmyy'),'ddmmyy'); end if; words := 'Between '||to_char(day1,'mm/dd/yy')||' And '|| to_char(day2,'mm/dd/yy')||''; elsif (date_tag = 'o') then if (tag = 'y') then day2 := to_date('3112'||to_char(day1,'yy'),'ddmmyy'); words := 'in '||to_char(day1,'yyyy')||''; elsif (tag = 'm') then day2 := to_date(to_char(last_day(day1),'dd')||to_char(day1,'mmyy'),'ddmmyy'); words := 'in '||to_char(day1,'Month yy')||''; else day2 := day1 + 1; words := 'on '||to_char(day1,'mm/dd/yy')||''; end if; elsif (date_tag = '>') then -- day2 := to_date('2050','yyyy'); day2 := to_date(to_char(sysdate,'ddmmyyyy'),'ddmmyyyy'); words := 'After '||to_char(day1,'mm/dd/yy')||''; else day2 := day1; day1 := to_date('01011985','ddmmyyyy'); words := 'Before '||to_char(day2,'mm/dd/yy')||''; end if; if (fid=0) then open cdate(day1,day2,stat); else open fcdate(day1,day2,stat,fid); end if; h_caption := 'publicated between '||htf.bold(day1)||' and '|| htf.bold(day2); htp.p('
'); -- htp.p('day1='||day1||'day2='||day2||'
'); htp.p('SCCS Documents '||h_caption||'
'); htp.p('
'); loop if (fid=0) then fetch cdate into two; exit when cdate%NOTFOUND; else fetch fcdate into two; exit when fcdate%NOTFOUND; end if; num := num + 1; end loop; if ( num =0 ) then htp.p('
'); htp.p(''); htp.p('

The document '||h_caption||' dose not exist!'); return; end if; total := num; -- total := cdate%ROWCOUNT; if (fid=0) then close cdate; else close fcdate; end if; if (total > 0 ) then next := 21; if ( next<=total) then if ((next+20)<=total) then next_str := (next+19); else next_str := total; end if; next_str := next||'-'||next_str; curr_str := next - 1; else curr_str := total; end if; htp.p('

'); htp.p('
Total: '||total||' | '); htp.p('Current: '||'1 -'||curr_str||' '); if (next_str IS NOT NULL) then htp.p(' | '); htp.p(htf.url(cgi_bin||'sccs1.more_date?total='||total|| '&seed='||next||'&day1='||day1||'&day2='||day2|| '&stat='||stat||'&fid='||fid,'Next '||next_str)); end if; htp.p('
'); if (fid=0) then open cdate(day1,day2,stat); else open fcdate(day1,day2,stat,fid); end if; num := 0; loop if (fid=0) then fetch cdate into two; exit when cdate%NOTFOUND; else fetch fcdate into two; exit when fcdate%NOTFOUND; end if; num := num + 1; htp.p('

SCCS-'||two.id||':'); if (two.url IS NOT NULL) then htp.ap(''||htf.url(two.url,two.title)||''); else htp.bp(''||two.title||''); end if; htp.p('
'); if (two.furl IS NOT NULL) then htp.p(htf.url(two.furl,'Full HTML')); htp.p('       '); end if; if (two.psurl IS NOT NULL) then htp.p(htf.url(two.psurl,'PostScript')); htp.p('       '); end if; if (two.pdfurl IS NOT NULL) then htp.p(htf.url(two.pdfurl,'PDF')); htp.p('       '); end if; if (two.rawurl IS NOT NULL) then htp.p(htf.url(two.rawurl,'Raw Text')); end if; htp.ap('
'||two.author); htp.p('; '||to_char(two.pub_date,'mm-dd-yy')||''); if (not ( two.type = 1)) then htp.p('
'); htp.p(htf.url(cgi_bin||'sccs2.show_info?docid='||two.id ||'&doctype='||two.type,'Addition Information')); end if; /* if (two.abs IS NOT NULL) then htp.p('
'); htp.ap(two.abs); end if; */ if ( num = 20 ) then exit; end if; end loop; htp.p('
'); htp.p(''); htp.p('
'); htp.p(' p.'); n := ceil(total/20); if (n > 20) then n := 20; end if; for i in 1..n loop iseed := (i-1)*20 + 1; if (iseed = 0 ) then htp.p(' '||i); else htp.p(' '||htf.url(cgi_bin||'sccs1.more_date?total='|| total||'&seed='||iseed||'&day1='||day1|| '&day2='||day2||'&stat='||stat|| '&fid='||fid,i)); end if; end loop; if (next_str IS NOT NULL) then htp.p('['||htf.url(cgi_bin||'sccs1.more_date?total='||total ||'&seed='||next||'&day1='||day1||'&day2='||day2|| '&stat='||stat||'&fid='||fid,'Next')||']'); end if; htp.p('
'); else htp.p('No SCCS Production Document Found'); end if; if (fid=0) then close cdate; else close fcdate; end if; wow.sig; end; procedure more_date(total number,seed integer,day1 date, day2 date, stat integer,fid varchar2) is cursor cdate(date1 date,date2 date,tat integer) is select * from bom where status = tat and (pub_date between date1 and date2) order by id desc; cursor fcdate(date1 date,date2 date,tat integer,f_id varchar2) is select * from bom where status = tat and (pub_date between date1 and date2) and type=f_id order by id desc; num integer; n integer; iseed integer; next number(8); prev number(8); next_str varchar2(20):=NULL; prev_str varchar2(20):=NULL; curr_str varchar2(20):=NULL; begin search_button(2,fid,stat); h_caption := 'publicated between '||htf.bold(day1)||' and '|| htf.bold(day2); htp.p('
'); htp.p('
'); htp.p('SCCS Documents '||h_caption||'
'); htp.p('
'); next := seed + 20; if (next<=total) then if ((next+20)<=total) then next_str := (next+19); else next_str := total; end if; next_str := next||'-'||next_str; curr_str := next - 1; else curr_str := total; end if; prev := seed - 20; if (prev >= 1) then prev_str := prev||'-'||(seed-1); elsif (seed > 1) then prev := 1; prev_str := '1-'|| 20; end if; htp.p('
'); htp.p('
Total: '||total||' | '); htp.p('Current: '||seed||'-'||curr_str||' '); if (next_str IS NOT NULL) then htp.p(' | '); htp.p(htf.url(cgi_bin||'sccs1.more_date?total='||total|| '&seed='||next||'&day1='||day1||'&day2='||day2|| '&stat='||stat||'&fid='||fid,'Next '||next_str)); end if; if (prev_str IS NOT NULL) then htp.p(' |'); htp.p(htf.url(cgi_bin||'sccs1.more_date?total='||total|| '&seed='||prev||'&day1='||day1||'&day2='||day2|| '&stat='||stat||'&fid='||fid,'Prev '||prev_str)); end if; htp.p('
'); if (fid=0) then open cdate(day1,day2,stat); else open fcdate(day1,day2,stat,fid); end if; num := 0; loop if (fid=0) then fetch cdate into two; exit when cdate%NOTFOUND; else fetch fcdate into two; exit when fcdate%NOTFOUND; end if; num := num + 1; if (num >= seed) then htp.p('

SCCS-'||two.id||':'); if (two.url IS NOT NULL) then htp.ap(''||htf.url(two.url,two.title)||''); else htp.bp(''||two.title||''); end if; htp.p('
'); if (two.furl IS NOT NULL) then htp.p(htf.url(two.furl,'Full HTML')); htp.p('       '); end if; if (two.psurl IS NOT NULL) then htp.p(htf.url(two.psurl,'PostScript')); htp.p('       '); end if; if (two.pdfurl IS NOT NULL) then htp.p(htf.url(two.pdfurl,'PDF')); htp.p('       '); end if; if (two.rawurl IS NOT NULL) then htp.p(htf.url(two.rawurl,'Raw Text')); end if; htp.ap('
'||two.author); htp.p('; '||to_char(two.pub_date,'mm-dd-yy')||''); if (not ( two.type = 1)) then htp.p('
'); htp.p(htf.url(cgi_bin||'sccs2.show_info?docid=' ||two.id||'&doctype='|| two.type,'Addition Information')); end if; /* if (two.abs IS NOT NULL) then htp.p('
'); htp.ap(two.abs); htp.p(''); end if; */ end if; if ( num >= (seed + 19) ) then exit; end if; end loop; if (fid=0) then close cdate; else close fcdate; end if; htp.p('
'); htp.p(''); htp.p('
'); htp.p(' p.'); n := ceil(total/20); if (n > 20) then n := 20; end if; for i in 1..n loop iseed := (i-1)*20 + 1; if (iseed = 0 ) then htp.p(' '||i); else htp.p(' '||htf.url(cgi_bin||'sccs1.more_date?total='|| total||'&seed='||iseed||'&day1='||day1||'&day2='|| day2||'&stat='||stat||'&fid='||fid,i)); end if; end loop; if (next_str IS NOT NULL) then htp.p('['||htf.url(cgi_bin||'sccs1.more_date?total='||total|| '&seed='||next||'&day1='||day1||'&day2='||day2|| '&stat='||stat||'&fid='||fid,'Next')||']'); end if; htp.p('
'); wow.sig; end; procedure day(str varchar2,result out date,tag in out char) is i integer := 1; one varchar2(8) := null; two varchar2(8) := null; three varchar2(8) := null; n integer; j integer := 1; string varchar2(100); begin string := str; while ( string IS NOT NULL and (substr(string,1,1) = '/')) loop string := substr(string,2); end loop; n := length(string); while ((i <= n) and (substr(string,i,1) != '/')) loop i := i + 1; end loop; one := substr(string,1,i-1); if (i > n) then tag := 'y'; else string := substr(string,i+1); n := length(string); i := 1; while (i <= n and (substr(string,i,1) != '/')) loop i := i + 1; end loop; two := substr(string,1,i-1); if (i > n) then tag := 'm'; else string := substr(string,i+1); n := length(string); i := 1; while (i <= n and (substr(string,i,1) != '/')) loop i := i + 1; end loop; three := substr(string,1,i-1); tag := 'd'; end if; end if; -- check the validated date format if (tag = 'y') then i := length(one); one := substr(one,-2,2); result := to_date('0101'||one,'ddmmyy'); else one := lpad(one,2,'0'); if ((to_number(one) < 1) or (to_number(one) > 12)) then htp.p('
Date format error2: '||str||'

'); result := NULL; else if (tag = 'm') then two := substr(two,-2,2); result := to_date(one||two,'FXFMmmyy'); else two := lpad(two,2,'0'); if (to_number(two) > to_char(last_day(to_date(one,'mm')),'dd')) then htp.p('

Date format error2: '||str||'

'); result := NULL; return; end if; i := length(three); if (i <= 4) then three := substr(three,-2,2); result := to_date(one||two||three,'FXFMmmddyy'); end if; end if; end if; end if; end; end sccs1;