SUBROUTINE CX_TBLD ( lutbld, iret ) C************************************************************************ C* CX_TBLD * C* * C* This subroutine reads CREX Table D which contains the sequence * C* descriptors. The first entry in each record of Table D is a sequence * C* descriptor and it is followed by a list of element descriptors, * C* replication descriptors, operator descriptors and/or sequence * C* descriptors which it defines. The last descriptor in each list is * c* followed by a # character. * C* * C* CX_TBLD ( LUTBLD, IRET ) * C* * C* Input parameters: * C* LUTBLD INTEGER CREX Table D logical unit number* C* * C* Output parameters: * C* ITBLDSZ INTEGER Maximum number of unique * C* sequence descriptors in Table D * C* NTBLDRC (ITBLDSZ) * C* INTEGER Number of descriptors in each * C* Table D record * C* ITBLD (ITBLDSZ,50) * C* INTEGER Table D sequence descriptors * C* * C* IRET INTEGER Return code * C* 0 = normal return * C* 1 = fatal error * C* * C** * C* Log: * C* R. Hollern/NCEP 8/03 * C************************************************************************ INCLUDE 'GEMPRM.PRM' INCLUDE 'cxcmn.cmn' C* CHARACTER IHOLD*300 C* LOGICAL more C----------------------------------------------------------------------- iret = 0 more = .true. ntbldrc = 0 c DO WHILE ( more ) C READ ( lutbld, 100, IOSTAT=iostat ) ihold 100 FORMAT ( A ) C IF ( iostat .lt. 0 ) THEN C C* No more records in table. Close the file. C CALL FL_CLOS ( lutbld, iercls ) RETURN ELSE IF ( iostat .gt. 0 ) THEN C C* I/O Error reading table. C iret = 1 loglvl = 2 logmsg = ' ' logmsg(1:33) = 'I/O error reading CREX Table D --' logmsg(34:45) = ' FATAL ERROR' CALL DC_WLOG( loglvl, 'CX', 2, logmsg, ierwlg ) RETURN ELSE ntbldrc = ntbldrc + 1 C IF ( ntbldrc .gt. ITBLDSZ ) THEN loglvl = 2 logmsg = ' ' logmsg(1:30) = 'CREX Table D size exceeded -- ' logmsg(31:41) = 'FATAL ERROR' CALL DC_WLOG( loglvl, 'CX', 2, logmsg, ierwlg ) iret = 1 RETURN END IF END IF C C* The last descriptor in each record ends with '#'. C lc = INDEX ( ihold, '#' ) C IF ( lc .gt. 0 ) THEN C C* Get the number of descriptors in record. C nds = lc / 7 ELSE iret = 1 logmsg = ' ' logmsg(1:36) = 'Last sequence descriptor in Table D ' CALL DC_WLOG( loglvl, 'CX', 2, logmsg, ierwlg ) logmsg = ' ' logmsg(1:36) = 'record does not end with # character' logmsg(37:51) = ' -- FATAL ERROR' CALL DC_WLOG( loglvl, 'CX', 2, logmsg, ierwlg ) RETURN END IF C na = 1 nb = 6 ntbld(ntbldrc) = nds C C* List of sequence descriptors. C jseqd(ntbldrc) = ihold(na:nb) C DO j = 1, nds itbld(ntbldrc,j) = ihold(na:nb) na = na + 7 nb = nb + 7 END DO C END DO C* RETURN END