SUBROUTINE CX_CDGE ( ist, cxrpt, ckdigt, iret ) C************************************************************************ C* CX_CDGE * C* * C* This subroutine gets the ckeck digit preceding the current data * C* value. A check is done to see if this ckeck digit number is the * C* correct one. The check digits increase from 0 to 9 cyclically. If * C* this check digit does not follow in order the previous one, then a * C* data group is apparently missing and decoding of this subset/report * C* will stop. * C* * C* CX_CDGE ( IST, CXRPT, CKDIGT, IRET ) * C* * C* Input parameters: * C* CXRPT CHAR* Current CREX report * C* * C* Input and Output parameters: * C* IST INTEGER Pointer to location in cxrpt. * C* On input, points to current data* C* group check digit. On output, * C* points to start of data value. * C* CKDIGT INTEGER Flag set to -1 when ist points * C* to the first check digit in * C* Section 2; otherwise, set to 0. * C* * C* Output parameters: * C* IRET INTEGER Return code * C* 0 = normal return * C* 4 = Missing data group * C* * C** * C* Log: * C* R. Hollern/NCEP 8/03 * C************************************************************************ INTEGER ckdigt C* CHARACTER*(*) cxrpt CHARACTER ckdgts (10)*1, fld1*1 C* DATA ckdgts / '0', '1', '2', '3', '4', '5', '6', + '7', '8', '9'/ C* SAVE ij C----------------------------------------------------------------------- iret = 0 C C IF ( ckdigt .eq. -1 ) THEN ckdigt = 0 ij = 1 ELSE ij = ij + 1 IF ( ij .gt. 10 ) ij = 1 END IF C IF ( cxrpt(ist:ist) .eq. ckdgts(ij) ) THEN ist = ist + 1 ELSE iret = 4 END IF C* RETURN END