SUBROUTINE BT_TRID ( mszrpt, report, ngrps, istgrp, lenrpt, + iret ) C************************************************************************ C* BT_TRID * C* * C* This subroutine gets the ship's call sign in the TRACKOB report. * C* * C* BT_TRID ( MSZRPT, REPORT, NGRPS, ISTGRP, LENRPT, IRET ) * C* * C* Input parameters: * C* MSZRPT INTEGER Report size in bytes * C* REPORT CHAR* Report array * C* NGRPS INTEGER Total number of groups following* C* the first group in report * C* ISTGRP INTEGER Array containing the location * C* of the space before the start * C* of each group in the report * C* * C* Output parameters: * C* IDTYPE INTEGER Report ID type * C* 0 = No ID * C* 1 = Buoy ID * C* 2 = Ship ID * C* LENRPT INTEGER Length of report minus sec 3 * C* CIVALS(ICSTID) CHAR* Report ID * C* IRET INTEGER Return code * C* 0 = Normal return * C* 1 = Problems * C* * C** * C* Log: * C* R. Hollern/NCEP 3/99 * C* R. Hollern/NCEP 4/00 Cleaned up documentation * C* R. Hollern/NCEP 1/04 Increased istgrp array size from 300 * C* to 1100. * C* C. Caruso Magee/NCEP 01/06 Changed to only check last group in * C* report for callsign, as this is what * C* WMO Codes Manual states as legal. * C* J. Ator/NCEP 11/12 Increase istgrp size from 1100 to 3000 * C************************************************************************ INCLUDE 'btcmn.cmn' C* INTEGER istgrp(3000) CHARACTER*(*) report C* CHARACTER stnid*8, chrstr*1 C* LOGICAL more C------------------------------------------------------------------------ iret = 0 idtype = 0 ip = mszrpt lenrpt = mszrpt icnt = 0 more = .true. C C* The ship's call sign is located in the last C* group of the report. C stnid = ' ' C mm = istgrp(ngrps) + 1 nn = mszrpt C icnt = nn - mm + 1 C IF ( icnt .gt. 8 ) THEN ierrno = -5 CALL BT_ERRS ( ierrno, report, iret ) iret = 1 RETURN END IF C stnid(1:icnt) = report(mm:nn) C DO i = 1,icnt C C* Check if character is numeric or alpha. A ship ID C* contains at least one letter in the ID. C chrstr = stnid(i:i) C CALL ST_ALNM ( chrstr, ityp, mret ) C IF ( ityp .eq. 2 ) THEN C C* Alpha character found. C idtype = 2 ELSE IF ( ityp .eq. 0 ) THEN C C* Bad character in ID. C ierrno = -5 CALL BT_ERRS ( ierrno, report, iret ) iret = 1 RETURN END IF END DO C IF ( idtype .eq. 2 ) THEN lenrpt = mm - 1 civals (icstid ) = stnid ELSE C C* Callsign not found - last field doesn't contain any C* alpha chars (has numbers only). C ierrno = -6 CALL BT_ERRS ( ierrno, report, iret ) iret = 1 END IF C* RETURN END