The following subroutines can be called from a program to create or update a database. Link with LOCUSLIB, $link yrprogram,locuslib/lib. Parameters that are returned from the subroutines are shown in uppercase. To create a database:
call dbcrea(lbase,filbas, IOS) lbase integer unit number (>70) filbas character file name of type .DBC ios integer error from OPENTo open a database:
call dbopen(lbase,filbas,readon, IOS) lbase integer unit number (>70) filbas character file name of type .DBC readon logical .false. to read and write .true. to read only ios integer error from OPENTo write labels:
call dbwlab(lbase,plabel,np) lbase integer unit number (as above) plabel character*12 an array of parameter names np integer # of parameter names in plabelTo write values:
call dbwval(lbase,pvalue,np) lbase integer unit number (as above) pvalue character*12 parameter values; `NODATA' is the missing data value np # of parameter values in pvalueTo read labels:
call dbrlab(lbase, PLABEL,NP,ELABEL,NE,IOS) lbase integer unit number (as above) plabel character*12 an array of parameter names np integer # of parameter names in plabel elabel character*12 an array of expression names ne integer # of expression names in elabel ios integer if not 0, an error occurredTo read values:
call dbrval(lbase,lrec,np, PVALUE,IOS) lbase integer unit number (as above) lrec integer record number (1...nrecpv) np # of parameter values in pvalue pvalue character*12 parameter values (expression values are not included) ios integer if not 0, an error occurredTo read the total number of records:
call dbnrec(lbase, NRECEX,NRECPV) lbase integer unit number (as above) nrecex integer # of expression records nrecpv integer # of records of values, includes deleted recordsTo delete the scratch file:
call dbdscr(lscr,filbas) lscr integer unit number to open scratch file filbas character*13 database file name (as above)Example:
character*13 filbas character*12 plabel(4) character*12 pvalue(4) real value(4) data filbas/`TEST.dbc'/ data plabel/`A', `B', `C', `D'/ data lbase/71/, lsrc/72/ c Delete the scratch file any time a modification is made c to the database call dbdscr(lscr,filbas) c Try to open the file. If the file does not exist (ios=29) c then create it and write the labels into it. call dbopen(lbase,filbas,.false., ios) if (ios.eq.29) then call dbcrea(lbase,filbas, ios) call dbwlab(lbase,plabel,4) end if do nrecs=1,10 (put values of A, B, C and D for this record into real array value) write(pvalue,`(4(1pg12.5))')(value(i),i=1,4) call dbwval(lbase,pvalue,4) end do call exit end