SUBROUTINE ADDOLDMASK(mname,nmask,i,iprobe,iparameter,inew) C ADDOLDMASK ADDS A USER SPECIFIED MASK TO THOSE MASKS ALREADY C LISTED. THIS MASK WILL BE TREATED THE SAME AS C ANY MASK OPENED FROM INFORMATION IN MASKCHOICE.D c************************************************************** c c Passed Variables: c c mname - mask name c nmask - number of each type of mask c 1. number of inclusive sequential masks to be read c 2. number of inclusive + exclusive sequential to be read c 3. nmask(2) + number of depth exclusion masks to be read c 4. nmask(3) + number of sequential masks to be written c 5. nmask(4) + number of depth exclusion masks to be written c c i - which mask type the mask will be c iprobe - the probe type represented by this mask c iparameter - the parameter represented by this mask c inew - 0 for old mask, 1 for new c c************************************************************** c************************************************************** c c Parameters: c c maxprobe - maximum number of probe types c maxmask - maximum number of masks c ibasefile - starting number for masks in ifn c c************************************************************** parameter (maxprobe=100,maxmask=100) character*(*) mname character*80 filename dimension nmask(5) c******************************************************************** c c Common Blocks: c c parm2 - contains ipar2, which stores parameter codes for c mask files, file identifier numbers, and probe c codes for each maskfile. c c******************************************************************** common /parm2/ ipar2(maxprobe),ifn(maxmask),ipro2(maxmask) c*************************************************************** c c Add one to all mask numbers of masks appearing after the c mask to be added. The mask variables must have their c values transfered to those corresponding to the new c mask number. This is done in reverse order so as not c to overwrite any information. c c*************************************************************** do 40 n=nmask(5),nmask(i)+1,-1 ifn(n+1) = ifn(n) ipro2(n+1)=ipro2(n) ipar2(n+1)=ipar2(n) 40 continue c*************************************************************** c c Add one to each mask type occurring at or later than the c mask type of the new mask. c c*************************************************************** do 50 n=i,5 nmask(n)=nmask(n)+1 50 continue c***************************************************************** c c Set the file identification number to the next available c number. Set the probe type and parameter type according c to user specifications. c c***************************************************************** ifn(nmask(i))=-1 ipro2(nmask(i))=abs(iprobe) if ( iprobe .eq. -1000 ) ipro2(nmask(i))=0 ipar2(nmask(i))=iparameter c***************************************************************** c c Open mask c c***************************************************************** call clearstring(filename,80) call maskname(mname,iparameter,filename,ipro2(nmask(i))) if ( inew.eq.1 ) then call fileopen(filename,'w+'//CHAR(0),ifn(nmask(i))) else call fileopen(filename,'rb+'//CHAR(0),ifn(nmask(i))) endif c************************************************************** c c Switch unique station numbers to order numbers if necessary c c************************************************************** call ucheck(ipro2(nmask(i)),iuniqn) if ( iprobe .lt. 0 .and. iuniqn .ne. 0) then itemp=-1 call tempfile(itemp) idone=0 icount=0 do 55 nn=1,20000000 if ( nmask(i) .le. nmask(2) ) then call readmask(ju,ifn(nmask(i)),idone) else call readmask2(ju,ifn(nmask(i)),idone,isecond) endif if ( idone .gt. 0 ) then call onefilecloseft(ifn(nmask(i))) ifn(nmask(i))=itemp idone=0 call filerewind(itemp) return endif call uorderfind(jj,ju,ipro2(nmask(i))) if ( jj .gt. -1 ) then if ( nmask(i) .le. nmask(2) ) then call writetomask(jj,icount,itemp) else call writetomask2(jj,icount,itemp,isecond) endif endif 55 continue endif return end