NCEPLIBS-bufr 11.7.1
ufbcpy.f
Go to the documentation of this file.
1C> @file
2C> @author WOOLLEN @date 1994-01-06
3
4C> THIS SUBROUTINE COPIES A COMPLETE SUBSET BUFFER, UNPACKED
5C> INTO INTERNAL MEMORY FROM LOGICAL UNIT LUBIN BY A PREVIOUS CALL
6C> TO BUFR ARCHIVE LIBRARY SUBROUTINE READSB OR READNS, TO
7C> LOGICAL UNIT LUBOT. BUFR ARCHIVE LIBRARY SUBROUTINE OPENMG OR
8C> OPENMB MUST HAVE BEEN PREVIOUSLY CALLED TO OPEN AND INITIALIZE A
9C> BUFR MESSAGE WITHIN MEMORY FOR LOGICAL UNIT LUBOT. BOTH FILES MUST
10C> HAVE BEEN OPENED TO THE INTERFACE (VIA A CALL TO BUFR ARCHIVE
11C> LIBRARY SUBROUTINE OPENBF) WITH IDENTICAL BUFR TABLES.
12C>
13C> PROGRAM HISTORY LOG:
14C> 1994-01-06 J. WOOLLEN -- ORIGINAL AUTHOR
15C> 1998-07-08 J. WOOLLEN -- REPLACED CALL TO CRAY LIBRARY ROUTINE
16C> "ABORT" WITH CALL TO NEW INTERNAL BUFRLIB
17C> ROUTINE "BORT"
18C> 1999-11-18 J. WOOLLEN -- THE NUMBER OF BUFR FILES WHICH CAN BE
19C> OPENED AT ONE TIME INCREASED FROM 10 TO 32
20C> (NECESSARY IN ORDER TO PROCESS MULTIPLE
21C> BUFR FILES UNDER THE MPI)
22C> 2003-11-04 S. BENDER -- ADDED REMARKS/BUFRLIB ROUTINE
23C> INTERDEPENDENCIES
24C> 2003-11-04 D. KEYSER -- MAXJL (MAXIMUM NUMBER OF JUMP/LINK ENTRIES)
25C> INCREASED FROM 15000 TO 16000 (WAS IN
26C> VERIFICATION VERSION); UNIFIED/PORTABLE FOR
27C> WRF; ADDED DOCUMENTATION (INCLUDING
28C> HISTORY); OUTPUTS MORE COMPLETE DIAGNOSTIC
29C> INFO WHEN ROUTINE TERMINATES ABNORMALLY
30C> 2009-06-26 J. ATOR -- USE IOK2CPY
31C> 2009-08-11 J. WOOLLEN -- ADD COMMON UFBCPL TO REMEMBER WHICH UNIT
32C> IS COPIED TO WHAT SUBSET BUFFER IN ORDER TO
33C> TRANSFER LONG STRINGS VIA UFBCPY AND WRTREE
34C> 2014-12-10 J. ATOR -- USE MODULES INSTEAD OF COMMON BLOCKS
35C>
36C> USAGE: CALL UFBCPY (LUBIN, LUBOT)
37C> INPUT ARGUMENT LIST:
38C> LUBIT - INTEGER: FORTRAN LOGICAL UNIT NUMBER FOR INPUT BUFR
39C> FILE
40C> LUBOT - INTEGER: FORTRAN LOGICAL UNIT NUMBER FOR OUTPUT BUFR
41C> FILE
42C>
43C> REMARKS:
44C> THIS ROUTINE CALLS: BORT IOK2CPY STATUS
45C> THIS ROUTINE IS CALLED BY: COPYSB
46C> Also called by application programs.
47C>
48 SUBROUTINE ufbcpy(LUBIN,LUBOT)
49
50 USE moda_usrint
51 USE moda_msgcwd
52 USE moda_ufbcpl
53 USE moda_tables
54
55C----------------------------------------------------------------------
56C----------------------------------------------------------------------
57
58C CHECK THE FILE STATUSES AND I-NODE
59C ----------------------------------
60
61 CALL status(lubin,lui,il,im)
62 IF(il.EQ.0) GOTO 900
63 IF(il.GT.0) GOTO 901
64 IF(im.EQ.0) GOTO 902
65 IF(inode(lui).NE.inv(1,lui)) GOTO 903
66
67 CALL status(lubot,luo,il,im)
68 IF(il.EQ.0) GOTO 904
69 IF(il.LT.0) GOTO 905
70 IF(im.EQ.0) GOTO 906
71
72 IF(inode(lui).NE.inode(luo)) THEN
73 IF( (tag(inode(lui)).NE.tag(inode(luo))) .OR.
74 . (iok2cpy(lui,luo).NE.1) ) GOTO 907
75 ENDIF
76
77C EVERYTHING OKAY COPY USER ARRAY FROM LUI TO LUO
78C -----------------------------------------------
79
80 nval(luo) = nval(lui)
81
82 DO n=1,nval(lui)
83 inv(n,luo) = inv(n,lui)
84 nrfelm(n,luo) = nrfelm(n,lui)
85 val(n,luo) = val(n,lui)
86 ENDDO
87
88 luncpy(luo)=lubin
89
90C EXITS
91C -----
92
93 RETURN
94900 CALL bort('BUFRLIB: UFBCPY - INPUT BUFR FILE IS CLOSED, IT MUST'//
95 . ' BE OPEN FOR INPUT')
96901 CALL bort('BUFRLIB: UFBCPY - INPUT BUFR FILE IS OPEN FOR '//
97 . 'OUTPUT, IT MUST BE OPEN FOR INPUT')
98902 CALL bort('BUFRLIB: UFBCPY - A MESSAGE MUST BE OPEN IN INPUT '//
99 . 'BUFR FILE, NONE ARE')
100903 CALL bort('BUFRLIB: UFBCPY - LOCATION OF INTERNAL TABLE FOR '//
101 . 'INPUT BUFR FILE DOES NOT AGREE WITH EXPECTED LOCATION IN '//
102 . 'INTERNAL SUBSET ARRAY')
103904 CALL bort('BUFRLIB: UFBCPY - OUTPUT BUFR FILE IS CLOSED, IT '//
104 . 'MUST BE OPEN FOR OUTPUT')
105905 CALL bort('BUFRLIB: UFBCPY - OUTPUT BUFR FILE IS OPEN FOR '//
106 . 'INPUT, IT MUST BE OPEN FOR OUTPUT')
107906 CALL bort('BUFRLIB: UFBCPY - A MESSAGE MUST BE OPEN IN OUTPUT '//
108 . 'BUFR FILE, NONE ARE')
109907 CALL bort('BUFRLIB: UFBCPY - INPUT AND OUTPUT BUFR FILES MUST '//
110 . 'HAVE THE SAME INTERNAL TABLES, THEY ARE DIFFERENT HERE')
111 END
subroutine bort(STR)
This subroutine calls subroutine errwrt() to log an error message, then calls subroutine bort_exit() ...
Definition: bort.f:23
integer function iok2cpy(LUI, LUO)
This function determines whether a BUFR message, or a data subset from within a BUFR message,...
Definition: iok2cpy.f:38
This module contains array and variable declarations used to store the internal jump/link table.
Definition: moda_tables.F:13
character *10, dimension(:), allocatable tag
Mnemonics in the jump/link table.
Definition: moda_tables.F:132
subroutine status(LUNIT, LUN, IL, IM)
This subroutine checks whether a specified Fortran logical unit number is currently connected to the ...
Definition: status.f:56
subroutine ufbcpy(LUBIN, LUBOT)
THIS SUBROUTINE COPIES A COMPLETE SUBSET BUFFER, UNPACKED INTO INTERNAL MEMORY FROM LOGICAL UNIT LUBI...
Definition: ufbcpy.f:49