SUBROUTINE CG_GRPT( lenb, bulltn, jpos, mszrpt, cgrpt, iret ) C************************************************************************ C* CG_GRPT * C* * C* This subroutine gets the next report in bulletin. The length of the * C* report must be within the range limits; otherwise, the report is * C* rejected. When there are no more reports in the bulletin, IRET will * C* be set to 2. * C* * C* CG_GRPT ( LENB, BULLTN, JPOS, MSZRPT, CGRPT, IRET ) * C* * C* Input parameters: * C* LENB INTEGER Length of bulletin in bytes * C* BULLTN CHAR* Raw bulletin to process * C* * C* Input and output parameters: * C* JPOS INTEGER Points to start of report on * C* input, to next report on output * C* * C* Output parameters: * C* MSZRPT INTEGER Length of report * C* CGRPT CHAR* Report to process * C* IRET INTEGER Return code * C* 0 = normal return * C* 1 = report rejected * C* 2 = no more reports * C* * C** * C* Log: * C* R. Hollern/NCEP 6/96 * C* K. Tyle/GSC 4/97 Cleaned up * C* R. Hollern/NCEP 10/97 Added test to reject 'NIL' reports * C* D. Kidwell/NCEP 10/97 Cleaned up and improved logging * C* R. Hollern/NCEP 12/97 Removed code to write report to LOG file* C* C. Caruso Magee/NCEP 04/00 Modifying for Coast Guard data. * C************************************************************************ INCLUDE 'GEMPRM.PRM' INCLUDE 'cgcmn.cmn' C* CHARACTER*(*) bulltn, cgrpt C* CHARACTER carrtn, clinfed LOGICAL more C----------------------------------------------------------------------- iret = 0 more = .true. carrtn = CHAR(13) clinfed = CHAR(21) cgrpt = ' ' C mszrpt = 0 kst = jpos more = .true. C DO WHILE ( more ) jpos = jpos + 1 mszrpt = mszrpt + 1 C C* read until you hit a cr-lf C IF ( bulltn(jpos-1:jpos-1) .eq. carrtn .and. * bulltn(jpos:jpos) .eq. carrtn ) THEN C C* subtract 1 off of report size. don't want cr-lf included. C mszrpt = mszrpt - 1 more = .false. END IF IF ( jpos .ge. lenb ) THEN C C* Reached end of bulletin. C more = .false. iret = 2 RETURN END IF END DO C C* Check that length of report is neither too long nor too short. C IF ( mszrpt .lt. 23 .or. mszrpt .gt. 400 ) THEN loglvl = 4 CALL DC_WLOG( loglvl, 'CG', -1, bulltn(kst:kst+10), ierwlg ) iret = 1 RETURN END IF C C* Store report in cgrpt. C cgrpt ( 1:mszrpt ) = bulltn ( kst:jpos ) C* RETURN END