procedure(cell_id,chem,test_type);
/* preocedure to determine initial conditions for tracer tests
created July 1998 CGE */
/*
connect to data base
*/
tst=exd$open(connect2,"SERDP",empty,'');
/*
create table list
*/
tbl_lst[1]='tblTest_phase';
/*
create a column list
*/
f_lst=exd$list(connect2,"cols",tbl_lst[1],c_list);
allocate table(col_lst) 7 rows by 3 cols;
col_lst[1,0]=cat(tbl_lst[1],'.tblkey');
col_lst[2,0]=cat(tbl_lst[1],'.test_type');
col_lst[3,0]=cat(tbl_lst[1],'.chemical_injected');
col_lst[4,0]=cat(tbl_lst[1],'.design_concentration');
col_lst[5,0]=cat(tbl_lst[1],'.start_date_time');
col_lst[6,0]=cat(tbl_lst[1],'.end_date_time');
DO l=1 TO lastrow (col_lst);
leng=chars(col_lst[l,0]);
locp=loc(".",col_lst[l,0]);
set col_lst[l,1] to ext(locp+1,leng,col_lst[l,0]);
test_val= col_lst[l,1];
array1 = table(c_list) where col 1 = test_val;
value = $tpfetch(array1,false,1,2);
r_num=tbl$rowindex(c_list,0,col_lst[l,0]);
set col_lst[l,2] to c_list[r_num,2];
end;
/*
create where statement for data select
*/
tblkey_v=cat("u12",cell_id,'41');
type tblkey_v;
where_cl=cat("where ",col_lst[2]." like '",test_type,"' and ",
col_lst[3], " like '",chem,"' and ", col_lst[1]," like '",tblkey_v,"'");
type where_cl;
/*
read data
*/
r_flag=exd$read(connect2,sdata,tbl_lst,col_lst,where_cl);
type r_flag;
display table(sdata);
exd$close(connect2);
return sdata;
end;