NCEPLIBS-bufr  11.6.0
 All Data Structures Files Functions Variables Pages
padmsg.f
Go to the documentation of this file.
1 C> @file
2 C> @author ATOR @date 2005-11-29
3 
4 C> THIS SUBROUTINE PADS A BUFR MESSAGE WITH ZEROED-OUT BYTES
5 C> FROM THE END OF THE MESSAGE UP TO THE NEXT 8-BYTE BOUNDARY.
6 C>
7 C> PROGRAM HISTORY LOG:
8 C> 2005-11-29 J. ATOR -- ORIGINAL AUTHOR
9 C>
10 C> USAGE: CALL PADMSG (MESG, LMESG, NPBYT )
11 C> INPUT ARGUMENT LIST:
12 C> MESG - INTEGER: *-WORD PACKED BINARY ARRAY CONTAINING BUFR
13 C> MESSAGE
14 C> LMESG - INTEGER: DIMENSIONED SIZE (IN INTEGER WORDS) OF MESG;
15 C> USED BY THE SUBROUTINE TO ENSURE THAT IT DOES NOT
16 C> OVERFLOW THE MESG ARRAY
17 C>
18 C> OUTPUT ARGUMENT LIST:
19 C> MESG - INTEGER: *-WORD PACKED BINARY ARRAY CONTAINING BUFR
20 C> MESSAGE WITH NPBYT ZEROED-OUT BYTES APPENDED TO THE END
21 C> NPBYT - INTEGER: NUMBER OF ZEROED-OUT BYTES APPENDED TO MESG
22 C>
23 C> REMARKS:
24 C> THIS ROUTINE CALLS: BORT IUPBS01 NMWRD PKB
25 C> THIS ROUTINE IS CALLED BY: MSGWRT
26 C> Also called by application programs.
27 C>
28  SUBROUTINE padmsg(MESG,LMESG,NPBYT)
29 
30 
31 
32  COMMON /hrdwrd/ nbytw,nbitw,iord(8)
33 
34  dimension mesg(*)
35 
36 C-----------------------------------------------------------------------
37 C-----------------------------------------------------------------------
38 
39 C Make sure that the array is big enough to hold the additional
40 C byte padding that will be appended to the end of the message.
41 
42  nmw = nmwrd(mesg)
43  IF(nmw.GT.lmesg) goto 900
44 
45 C Pad from the end of the message up to the next 8-byte boundary.
46 
47  nmb = iupbs01(mesg,'LENM')
48  ibit = nmb*8
49  npbyt = ( nmw * nbytw ) - nmb
50  DO i = 1, npbyt
51  CALL pkb(0,8,mesg,ibit)
52  ENDDO
53 
54  RETURN
55 900 CALL bort('BUFRLIB: PADMSG - CANNOT ADD PADDING TO MESSAGE '//
56  . 'ARRAY; TRY A LARGER DIMENSION FOR THIS ARRAY')
57  END
function nmwrd(MBAY)
GIVEN AN INTEGER ARRAY CONTAINING SECTION ZERO FROM A BUFR MESSAGE, THIS FUNCTION DETERMINES A COUNT ...
Definition: nmwrd.f:27
subroutine padmsg(MESG, LMESG, NPBYT)
THIS SUBROUTINE PADS A BUFR MESSAGE WITH ZEROED-OUT BYTES FROM THE END OF THE MESSAGE UP TO THE NEXT ...
Definition: padmsg.f:28
subroutine bort(STR)
This subroutine calls subroutine errwrt() to log an error message, then calls subroutine bort_exit() ...
Definition: bort.f:22
subroutine pkb(NVAL, NBITS, IBAY, IBIT)
This subroutine encodes an integer value within a specified number of bits of an integer array...
Definition: pkb.f:38
function iupbs01(MBAY, S01MNEM)
This function returns a specified value from within Section 0 or Section 1 of a BUFR message...
Definition: iupbs01.f:73