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