subroutine rfnams (error,nfiles) c c*********************************************************************** c* c* read and store a list of input/output file names. c* c* arguments c* name i/o description c* ---- --- ----------- c* error o error flag c* nfiles o number of file names read c* c* common /flnams/ c* fname o array to hold file names c* c* local variables c* id - list of valid file identifiers, used to assign file name c* idlen - length of substring of id to be compared with input identifier c* (the number of characters to compare to ensure a unique match) c* nids - total number of id's in id list c* c* notes: c* the file names must be specified as follows: c* id=filename c* where id is an identifier for the type of data. the identifiers c* are used to assign each file name to a specific location in the c* file-names array. valid identifiers are located in array "id". c* c* error conditions: c* 1) format of file name specification is incorrect c* 2) file identifier not valid c* 3) file identifier used for more than one file name c* c*********************************************************************** c implicit none c integer nfiles logical error c integer idlen, nids, lstart, i, lequal, lptr character*8 id(20) character*80 card dimension idlen(20) character*60 terprs, surfcat, snowice, cldpres c include 'flnams.com' include 'contrl.com' c c define key words for input file names c data id/'table','dndx','aprioz','apritmp','report', 1 'pmf','ozs','acf','const','orbcnts','cmplr', 2 'prf81','detail','itertn','coeffs','hdfdir', 2 'terprs','surfcat','snowice','cldpres'/, !zack added 3 idlen/ 5, 4, 6, 7, 6, 3*3, 5, 8, 5, 5, 4*6 3 ,6,3*7/, !zack added 4 nids/20/ c lstart=1 if (system.eq.'mvs') lstart=2 do 10 i=1,nids 10 fname(i)=' ' c c** read file names. find each file identifier by first locating the c** equal sign character "=" and then comparing the string to the left of c** the equal sign with the array of valid identifiers. copy the file c** name at right of equal sign to array slot. end of the file-names c** portion of input data is assumed when a record in which an equal sign c** can not be found is read. c nfiles = 0 20 read (5,1000) card lequal=index(card,'=') if (lequal.ne.0) then nfiles = nfiles + 1 lptr=lequal do 30 i=1,nids if (index(card(1:lequal),id(i)(1:idlen(i))).gt.0) then if (fname(i).ne.' ') then write (6,2000) card(1:lequal-1),card,fname(i) goto 900 end if 25 lptr=lptr+1 if (card(lptr:lptr).eq.' ') goto 25 if (system.eq.'mvs') fname(i)='/' fname(i)(lstart:)= card(lptr:) goto 20 end if 30 continue write (6,3000) card,card(1:lequal-1),id goto 900 end if c data id/'table','aprioz','apritmp','report', c 1 'pmf','ozs','acf','const','orbcnts','cmplr', c 2 'prf81','detail','coeffs'/, c print*,'returning from rfnams: fname' write(6,'(i4,2x,a60)') (i,fname(i),i=1,16) print*,fname c return 900 error=.true. c 1000 format(a80) 2000 format(/' ** error message from subroutine rfnams **'// 1 ' the identifier "',a,'" in the following file name ', 2 'specification:'//1x,a80//' has already been assigned the ', 3 'name: ',a/' a second assignment to this identifier ', 4 'is not allowed'/) 3000 format(/' ** error message from subroutine rfnams **'// 1 ' in the following file name specification:'//1x,a80// 2 ' identifier "',a,'" is not recognized'/' valid identifers ', 3 'are:'/1x,2(a7,', '),3(a3,', '),a5,', ',a6,2(', ',a8)/) end