NCEPLIBS-bufr 11.7.1
padmsg.f
Go to the documentation of this file.
1C> @file
2C> @author ATOR @date 2005-11-29
3
4C> THIS SUBROUTINE PADS A BUFR MESSAGE WITH ZEROED-OUT BYTES
5C> FROM THE END OF THE MESSAGE UP TO THE NEXT 8-BYTE BOUNDARY.
6C>
7C> PROGRAM HISTORY LOG:
8C> 2005-11-29 J. ATOR -- ORIGINAL AUTHOR
9C>
10C> USAGE: CALL PADMSG (MESG, LMESG, NPBYT )
11C> INPUT ARGUMENT LIST:
12C> MESG - INTEGER: *-WORD PACKED BINARY ARRAY CONTAINING BUFR
13C> MESSAGE
14C> LMESG - INTEGER: DIMENSIONED SIZE (IN INTEGER WORDS) OF MESG;
15C> USED BY THE SUBROUTINE TO ENSURE THAT IT DOES NOT
16C> OVERFLOW THE MESG ARRAY
17C>
18C> OUTPUT ARGUMENT LIST:
19C> MESG - INTEGER: *-WORD PACKED BINARY ARRAY CONTAINING BUFR
20C> MESSAGE WITH NPBYT ZEROED-OUT BYTES APPENDED TO THE END
21C> NPBYT - INTEGER: NUMBER OF ZEROED-OUT BYTES APPENDED TO MESG
22C>
23C> REMARKS:
24C> THIS ROUTINE CALLS: BORT IUPBS01 NMWRD PKB
25C> THIS ROUTINE IS CALLED BY: MSGWRT
26C> Also called by application programs.
27C>
28 SUBROUTINE padmsg(MESG,LMESG,NPBYT)
29
30
31
32 COMMON /hrdwrd/ nbytw,nbitw,iord(8)
33
34 dimension mesg(*)
35
36C-----------------------------------------------------------------------
37C-----------------------------------------------------------------------
38
39C Make sure that the array is big enough to hold the additional
40C 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
45C 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
55900 CALL bort('BUFRLIB: PADMSG - CANNOT ADD PADDING TO MESSAGE '//
56 . 'ARRAY; TRY A LARGER DIMENSION FOR THIS ARRAY')
57 END
subroutine bort(STR)
This subroutine calls subroutine errwrt() to log an error message, then calls subroutine bort_exit() ...
Definition: bort.f:23
function iupbs01(MBAY, S01MNEM)
This function returns a specified value from within Section 0 or Section 1 of a BUFR message.
Definition: iupbs01.f:74
function nmwrd(MBAY)
GIVEN AN INTEGER ARRAY CONTAINING SECTION ZERO FROM A BUFR MESSAGE, THIS FUNCTION DETERMINES A COUNT ...
Definition: nmwrd.f:28
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:29
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:39