SUBROUTINE CG_CKLN ( cgrpt, mszrpt, jpos, jret ) C************************************************************************ C* CG_CKLN * C* * C* This subroutine checks the given report for strings which indicate * C* that it's either devoid of valid data or is not actually a report * C* line. If any of the listed strings are found in the current report, * C* the return is set to 0. If none of the listed strings are found, * C* the header line is assumed to be missing, so don't decode any of * C* the reports in the bulletin. * C* * C* CG_CKLN ( CGRPT, MSZRPT, JPOS, JRET ) * C* * C* Input parameters: * C* CGRPT CHAR* Report to process * C* MSZRPT INTEGER Length of report * C* * C* Input parameters passed via common: * C* IWXVSB LOGICAL indicates presence of wx/vis * C* IWIND LOGICAL indicates presence of wind * C* IWAVE LOGICAL indicates presence of wave data * C* ISEA LOGICAL indicates presence of sst data * C* IAIR LOGICAL indicates presence of air temp. * C* IPRES LOGICAL indicates presence of slp data * C* IRMK LOGICAL indicates presence of remarks * C* ISTNAM LOGICAL indicates presence of stat. name* C* * C* Input and output parameters: * C* JPOS INTEGER Points to start of report on * C* input, to next report on output * C* Output parameters: * C* JRET INTEGER Return code * C* 0 = normal return, i.e. * C* report line * C* 1 = header line * C* -1 = no header line found * C* * C** * C* Log: * C* C. Caruso Magee/NCEP 04/00 New subroutine for Coast Guard data. * C************************************************************************ INCLUDE 'GEMPRM.PRM' INCLUDE 'BRIDGE.PRM' INCLUDE 'cgcmn.cmn' character*(*) cgrpt character*(DCMXBF) cgrpto integer mszrpt integer jpos integer jret, kret integer length C C* check to see if gothdr was set to true previously in this s/r. C* If so, we've already found the header line, so no need to search C* for it again. If gothdr isn't true, check to see if the current C* line is a valid header line or a line in a non-report bulletin. C* When checking to see if header line, only assume it's the header C* line if 4 or more of the header string were found in the line C* currently being checked. C kret = 0 IF ( gothdr ) THEN jret = 0 RETURN ELSE jret = -1 loopend1 = mszrpt C C* look for header line. Remove leading and extra blanks before checking, C* but don't pass this back to main. Only doing this so we know where C* the WIND slash is if the header has no excess blanks, since we'll be C* removing excess blanks from each subsequent report line. C CALL ST_RXBL ( cgrpt, cgrpto, length, iretrx ) loopend2 = length DO j = 1, loopend2 IF ( j .le. loopend2 - 6 ) THEN IF ( index(cgrpto(j:j+6),'/REMARK') .ne. 0) THEN irmk = .true. kret = kret + 1 END IF END IF IF ( j .le. loopend2 - 4 ) THEN IF ( index(cgrpto(j:j+4),'WXVSB') .ne. 0) THEN iwxvsb = .true. kret = kret + 1 END IF END IF IF ( j .le. loopend2 - 3 ) THEN IF ( index(cgrpto(j:j+4),'/WIND') .ne. 0) THEN iwind = .true. iwindslsh = j kret = kret + 1 END IF IF ( index(cgrpto(j:j+4),'/PRES') .ne. 0) THEN ipres = .true. kret = kret + 1 END IF END IF IF ( j .le. loopend2 - 2 ) THEN IF ( index(cgrpto(j:j+3),'/WAV') .ne. 0) THEN iwave = .true. kret = kret + 1 END IF IF ( index(cgrpto(j:j+3),'/SEA') .ne. 0) THEN isea = .true. kret = kret + 1 END IF IF ( index(cgrpto(j:j+3),'/AIR') .ne. 0) THEN iair = .true. kret = kret + 1 END IF END IF END DO C C* Assume it's the header line if 4 or more of the header strings C* were found in the line currently being checked. If 3 or less of C* the strings were found, reset the logicals to false to prevent C* code from thinking it's found a header in a future call (e.g. if C* the current bulletin is a warning/restriction type bulletin, it's C* possible we could find 4 of the strings in the whole bulletin, so C* resetting the logicals to false if 3 or less were found will C* prevent this s/r from falsely thinking it's found a header line). C IF ( kret .gt. 3 ) THEN gothdr = .true. jret = 1 ELSE iwxvsb = .false. iwind = .false. iwave = .false. isea = .false. iair = .false. ipres = .false. irmk = .false. END IF END IF RETURN END