NCEPLIBS-bufr  12.0.0
posapx.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Position an output BUFR file for appending.
3 C>
4 C> @author Woollen @date 1994-01-06
5 
6 C> Reads to the end of the file pointed to by
7 C> abs(LUNXX) and positions it for appending. The file must have
8 C> already been opened for output operations.
9 C>
10 C< If LUNXX > 0, then the file is backspaced before being positioned for append.
11 C> If LUNXX < 0, then the file is not backspaced before being positioned for append.
12 C>
13 C> @param[in] LUNXX - integer: absolute value is fortran logical unit number
14 C> for BUFR file
15 C>
16 C> @author Woollen @date 1994-01-06
17  SUBROUTINE posapx(LUNXX)
18 
19  use bufrlib
20 
21  USE moda_mgwa
22 
23 C-----------------------------------------------------------------------
24 C-----------------------------------------------------------------------
25 
26  lunit = abs(lunxx)
27 
28  CALL status(lunit,lun,il,im)
29  IF(il.EQ.0) GOTO 901
30  IF(il.LT.0) GOTO 902
31 
32 C TRY TO READ TO THE END OF THE FILE
33 C ----------------------------------
34 
35 1 CALL rdmsgw(lunit,mgwa,ier)
36  IF(ier.LT.0) RETURN
37  IF(idxmsg(mgwa).EQ.1) THEN
38 
39 C This is an internal dictionary message that was generated by the
40 C NCEPLIBS-bufr software. Backspace the file pointer and
41 C then read and store all such dictionary messages (they should be
42 C stored consecutively!) and reset the internal tables.
43 
44  CALL backbufr_c(lun) !BACKSPACE LUNIT
45  CALL rdbfdx(lunit,lun)
46 
47  ENDIF
48  GOTO 1
49 
50 C ERROR EXITS
51 C -----------
52 
53 901 CALL bort('BUFRLIB: POSAPX - INPUT BUFR FILE IS CLOSED, IT MUST'//
54  . ' BE OPEN FOR OUTPUT')
55 902 CALL bort('BUFRLIB: POSAPX - INPUT BUFR FILE IS OPEN FOR INPUT'//
56  . ', IT MUST BE OPEN FOR OUTPUT')
57  END
subroutine bort(STR)
Log one error message and abort application program.
Definition: bort.f:18
recursive function idxmsg(MESG)
Check whether a BUFR message contains DX BUFR tables information.
Definition: idxmsg.f:23
Wrap C NCEPLIBS-bufr functions so they can be called from within the Fortran part of the library.
Definition: bufrlib.F90:11
This module contains a declaration for an array used by various subroutines and functions to hold a t...
integer, dimension(:), allocatable mgwa
Temporary working copy of BUFR message.
subroutine posapx(LUNXX)
Reads to the end of the file pointed to by abs(LUNXX) and positions it for appending.
Definition: posapx.f:18
subroutine rdbfdx(LUNIT, LUN)
Beginning at the current file pointer location within LUNIT, this subroutine reads a complete DX BUFR...
Definition: rdbfdx.f:28
subroutine rdmsgw(lunit, mesg, iret)
Read the next BUFR message from logical unit lunit as an array of integer words.
Definition: rdmsgw.F90:16
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