NCEPLIBS-bufr  12.0.0
lcmgdf.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Check for the existence of any long character strings
3 C> (greater than 8 bytes) within a data subset definition.
4 C>
5 C> @author J. Ator @date 2009-07-09
6 
7 C> This function checks whether the subset definition for a given
8 C> message type contains any long character strings (greater
9 C> than 8 bytes).
10 C>
11 C> @param[in] LUNIT - integer: Fortran logical unit number for
12 C> BUFR file.
13 C> @param[in] SUBSET - character*8: Table A mnemonic of message
14 C> type to be checked.
15 C> @returns lcmgdf - integer:
16 C> - 0 = SUBSET does not contain any long character strings
17 C> - 1 = SUBSET contains at least one long character string
18 C>
19 C> @remarks
20 C> - LUNIT may be open for either input or output operations via a
21 C> previous call to subroutine openbf(). However, in either case,
22 C> SUBSET must already be defined within the BUFR tables that are
23 C> associated with LUNIT, typically as [DX BUFR tables](@ref dfbftab)
24 C> information supplied via argument LUNDX when openbf() was called,
25 C> or, if openbf() was called with IO = 'SEC3', then as
26 C> [master BUFR table](@ref dfbfmstab) information during a previous
27 C> call to one of the [message-reading subroutines](@ref hierarchy).
28 C> - Note that this function does not return mnemonic(s) associated
29 C> with any long character string(s) found within SUBSET; rather,
30 C> it only checks whether at least one such mnemonic exists. If any
31 C> are found, the application program can process them via a
32 C> separate call to subroutine readlc() (when reading BUFR data
33 C> subsets) or subroutine writlc() (when writing BUFR data subsets).
34 C>
35 C> @author J. Ator @date 2009-07-09
36  RECURSIVE FUNCTION lcmgdf(LUNIT,SUBSET) RESULT(IRET)
37 
38  USE modv_im8b
39 
40  USE moda_tables
41 
42  CHARACTER*8 subset
43 
44 C-----------------------------------------------------------------------
45 C-----------------------------------------------------------------------
46 
47 C Check for I8 integers.
48 
49  IF(im8b) THEN
50  im8b=.false.
51 
52  CALL x84(lunit,my_lunit,1)
53  iret=lcmgdf(my_lunit,subset)
54 
55  im8b=.true.
56  RETURN
57  ENDIF
58 
59  iret = 0
60 
61 C Get LUN from LUNIT.
62 
63  CALL status(lunit,lun,il,im)
64  IF (il.EQ.0) GOTO 900
65 
66 C Confirm that SUBSET is defined for this logical unit.
67 
68  CALL nemtba(lun,subset,mtyp,msbt,inod)
69 
70 C Check if there's a long character string in the definition.
71 
72  nte = isc(inod)-inod
73 
74  DO i = 1, nte
75  IF ( (typ(inod+i).EQ.'CHR') .AND. (ibt(inod+i).GT.64) ) THEN
76  iret = 1
77  RETURN
78  ENDIF
79  ENDDO
80 
81  iret = 0
82 
83  RETURN
84 900 CALL bort('BUFRLIB: LCMGDF - INPUT BUFR FILE IS CLOSED, IT MUST'//
85  . ' BE OPEN')
86  END
subroutine bort(STR)
Log one error message and abort application program.
Definition: bort.f:18
recursive function lcmgdf(LUNIT, SUBSET)
This function checks whether the subset definition for a given message type contains any long charact...
Definition: lcmgdf.f:37
This module contains array and variable declarations used to store the internal jump/link table.
integer, dimension(:), allocatable isc
Scale factors corresponding to tag and typ:
integer, dimension(:), allocatable ibt
Bit widths corresponding to tag and typ:
character *3, dimension(:), allocatable typ
Type indicators corresponding to tag:
This module declares and initializes the IM8B variable.
logical, public im8b
Status indicator to keep track of whether all future calls to BUFRLIB subroutines and functions from ...
subroutine nemtba(LUN, NEMO, MTYP, MSBT, INOD)
This subroutine searches for a descriptor within Table A of the internal DX BUFR tables.
Definition: nemtba.f:25
recursive subroutine status(LUNIT, LUN, IL, IM)
Check whether a specified Fortran logical unit number is currently connected to the NCEPLIBS-bufr sof...
Definition: status.f:36
subroutine x84(IIN8, IOUT4, NVAL)
Encode one or more 8-byte integer values as 4-byte integer values.
Definition: x84.F:19