SUBROUTINE CX_EXPD ( ndesc, mxndesc, datadesc, mxdatv, nmdesc, + expdesc, iret ) C************************************************************************ C* CX_EXPD * C* * C* This subroutine calls the routines to process the sequence and * C* replication descriptors in the current list. Several passes through * C* the list may be needed to accomplish this task. When finished the * C* list will have been expanded and will contain only element, operator,* C* and/or delayed replication descriptors. * C* * C* CX_EXPD ( NDESC, MXNDESC, DATADESC, MXDATV, NMDESC, EXPDESC, IRET ) * C* * C* Input parameters: * C* NDESC INTEGER Number of data descriptor(s) in * C* Section 1 of CREX message * C* MXNDESC INTEGER Maximum number of descriptors * C* expected in Section 1 of msg * C* DATADESC (MXNDESC) * C* CHAR* List of descriptor(s) in * C* Section 1 of CREX message * C* MXDATV INTEGER Maximum number of data values * C* expected * C* Output parameters: * C* NMDESC INTEGER Number of descriptors in array * C* expdesc * C* * C* EXPDESC (MXDATV) * C* CHAR* List of the expanded Section 1 * C* descriptors. The expansion * C* consists of replacing the * C* sequence and non-delayed * C* replication descriptors with the* C* list they correspond to. The * C* final list will be close to a * C* one-to-one correspondence with * C* the data values in Section 2. * 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 'cxcmn.cmn' C* INTEGER ndesc, mxndesc, iret C* CHARACTER idc*6 CHARACTER iwork (mxdatv)*6 CHARACTER datadesc ( mxndesc )*6 CHARACTER expdesc ( mxdatv )*6 C* LOGICAL more C----------------------------------------------------------------------- iret = 0 more = .true. C DO i = 1, ndesc expdesc ( i ) = datadesc ( i ) END DO C nmdesc = ndesc C DO WHILE ( more ) C C* Go through descriptor list to search for delayed C* replication descriptors. C CALL CX_CDLY ( mxdatv, nmdesc, expdesc, iret ) C IF ( iret .eq. 1 ) RETURN C C* Go through descriptor list to process all the replication C* descriptors in the current list. C CALL CX_RPL1 ( mxdatv, nmdesc, expdesc, iret ) C IF ( iret .eq. 1 ) RETURN C C* Go through descriptor list to expand the sequence C* descriptors in the current list. C CALL CX_SEQD ( mxdatv, nmdesc, expdesc, iret ) C IF ( iret .eq. 1 ) RETURN C C* Go through descriptor list to modify, if needed, the XX C* value in the RXX000 delayed replication descriptor. C CALL CX_RPL2 ( nmdesc, mxdatv, expdesc, iret ) C C* Check for more replication descriptors. C iflg = 0 jflg = 0 C DO j = 1,nmdesc idc = expdesc ( j ) C IF ( (idc(1:1) .eq. 'R' .and. idc(4:6) .ne. '000' ) .OR. + idc(1:1) .eq. 'D' ) THEN iflg = 1 ELSE IF ( idc(1:1) .eq. 'R' .and. + idc(4:6) .eq. '000' ) THEN jflg = 1 END IF END DO C IF ( jflg .eq. 1 .and. iflg .eq. 0 ) THEN C C* Check if any new delayed replication descriptors C* after expansion of sequence descriptors. C CALL CX_RPL3 ( nmdesc, mxdatv, expdesc, jflg ,iret ) END IF C IF ( jflg .eq. 0 .AND. iflg .eq. 0 ) more = .false. END DO C C* Remove the beginning and ending markers associated with C* the replication descriptors. C icnt = 0 C DO i = 1,nmdesc C IF ( .NOT.(expdesc(i)(1:3) .eq. 'STR' .or. + expdesc(i)(1:4) .eq. 'END0') )THEN icnt = icnt + 1 iwork ( icnt ) = expdesc ( i ) END IF END DO C nmdesc = icnt C DO i = 1,nmdesc expdesc ( i ) = iwork (i) END DO C* RETURN END