NCEPLIBS-bufr 11.7.1
ichkstr.f
Go to the documentation of this file.
1C> @file
2C> @author ATOR @date 2005-11-29
3
4C> THIS FUNCTION COMPARES A SPECIFIED NUMBER OF CHARACTERS
5C> FROM AN INPUT CHARACTER ARRAY AGAINST THE SAME NUMBER OF CHARACTERS
6C> FROM AN INPUT CHARACTER STRING AND DETERMINES WHETHER THE TWO ARE
7C> EQUIVALENT. THE CHARACTER ARRAY IS ASSUMED TO BE IN ASCII, WHEREAS
8C> THE CHARACTER STRING IS ASSUMED TO BE IN THE NATIVE CHARACTER SET
9C> (I.E. ASCII OR EBCDIC) OF THE LOCAL MACHINE.
10C>
11C> PROGRAM HISTORY LOG:
12C> 2005-11-29 J. ATOR -- ORIGINAL AUTHOR
13C>
14C> USAGE: ICHKSTR (STR, CHR, N)
15C> INPUT ARGUMENT LIST:
16C> STR - CHARACTER*(*): N-CHARACTER STRING IN ASCII OR EBCDIC,
17C> DEPENDING ON THE NATIVE MACHINE
18C> CHR - CHARACTER*1: ARRAY OF N CHARACTERS IN ASCII
19C> N - INTEGER: NUMBER OF CHARACTERS TO BE COMPARED
20C>
21C> OUTPUT ARGUMENT LIST:
22C> ICHKSTR - INTEGER: RETURN VALUE:
23C> 0 = STR(1:N) AND (CHR(I),I=1,N) ARE EQUIVALENT
24C> 1 = STR(1:N) AND (CHR(I),I=1,N) ARE NOT EQUIVALENT
25C>
26C> REMARKS:
27C> THIS ROUTINE CALLS: CHRTRNA
28C> THIS ROUTINE IS CALLED BY: CRBMG READERME
29C> Normally not called by any application
30C> programs.
31C>
32 FUNCTION ichkstr(STR,CHR,N)
33
34
35
36 CHARACTER*(*) str
37
38 CHARACTER*80 cstr
39 CHARACTER*1 chr(n)
40
41C-----------------------------------------------------------------------
42C-----------------------------------------------------------------------
43
44C Copy CHR into CSTR and, if necessary, convert the latter
45C to EBCDIC (i.e. if the local machine uses EBCDIC) so that
46C the subsequent comparison will always be valid.
47
48 CALL chrtrna(cstr,chr,n)
49
50C Compare CSTR to STR.
51
52 IF(cstr(1:n).EQ.str(1:n)) THEN
53 ichkstr = 0
54 ELSE
55 ichkstr = 1
56 ENDIF
57
58 RETURN
59 END
subroutine chrtrna(STR, CHR, N)
This subroutine copies a specified number of characters from an array of characters into a character ...
Definition: chrtrna.f:34
function ichkstr(STR, CHR, N)
THIS FUNCTION COMPARES A SPECIFIED NUMBER OF CHARACTERS FROM AN INPUT CHARACTER ARRAY AGAINST THE SAM...
Definition: ichkstr.f:33