SUBROUTINE CX_RPL1 ( mxdatv, nmdesc, expdesc, iret ) C************************************************************************ C* CX_RPL1 * C* * C* This subroutine goes through the list of descriptors in the expdesc * C* array and replaces the non-delayed replication descriptors in the * C* list with the set of replicated descriptors they expand to. * C* * C* CX_RPL1 ( MXDATV, NMDESC, EXPDESC, IRET ) * C* * C* * C* Input parameters: * C* MXDATV INTEGER Maximum number of data values * C* expected * C* * C* Input and output parameters: * C* NMDESC INTEGER On input, number of descriptors * C* in expdesc array; on output, the* C* number of descriptors in expdesc* C* after replication performed. * C* EXPDESC (MXDATV) * C* CHAR* On input, current list of * C* descriptors. On output, the list* C* after replication performed. * C* Output parameters: * 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* CHARACTER idc*6 CHARACTER iwork ( mxdatv )*6, iiwork ( mxdatv )*6 CHARACTER expdesc ( mxdatv )*6 C* LOGICAL more1 C----------------------------------------------------------------------- iret = 0 iflag = 0 numdesc = nmdesc C DO i = 1, nmdesc iwork ( i ) = expdesc ( i ) END DO C mw = 0 i = 1 more1 = .true. C DO WHILE ( more1 ) idc = iwork ( i ) C IF ( idc .eq. 'ENDDSC' ) more1 = .false. C IF ( idc (1:1) .eq. 'R' .AND. idc (4:6) .ne. '000' ) THEN C C* Get the replication parameters. C CALL CX_REPL ( idc, ixx, iyyy, iret ) IF ( iret .ne. 0 ) RETURN C DO n1 = 1,iyyy C C* Set l to point to location in iwork of current C* replication descriptor. C l = i C DO n2 = 1,ixx l = l + 1 mw = mw + 1 iiwork ( mw ) = iwork ( l ) END DO C C* Set flag to indicate a replication descriptor C* was found. C iflag = 1 C END DO C C* Skip over the replication descriptor plus the C* replicated descriptors. C i = i + ixx + 1 C ELSE C mw = mw + 1 iiwork ( mw ) = iwork ( i ) i = i + 1 C END IF C END DO C C* Update expdesc if there were replication descriptors C* in list. C IF ( iflag .eq. 1 ) THEN DO j = 1,mw expdesc ( j ) = iiwork ( j ) END DO C nmdesc = mw C END IF C* RETURN END