1 SUBROUTINE ATRCPT
(MSGIN
,LMSGOT
,MSGOT
)
3 C$$$ SUBPROGRAM DOCUMENTATION BLOCK
6 C PRGMMR: ATOR ORG: NP12 DATE: 2009-03-23
8 C ABSTRACT: THIS SUBROUTINE READS AN INPUT BUFR MESSAGE, APPENDS THE
9 C TANK RECEIPT TIME TO SECTION 1, AND WRITES THE RESULT TO A NEW BUFR
10 C MESSAGE FOR OUTPUT. THE TANK RECEIPT TIME MUST HAVE BEEN SPECIFIED
11 C VIA A PREVIOUS CALL TO BUFR ARCHIVE LIBRARY SUBROUTINE STRCPT. THE
12 C OUTPUT MESSAGE WILL BE SLIGHTLY LONGER THAN THE INPUT MESSAGE, SO
13 C THE USER MUST ALLOW FOR ENOUGH SPACE WITHIN THE OUTPUT ARRAY.
15 C PROGRAM HISTORY LOG:
16 C 2009-03-23 J. ATOR -- ORIGINAL AUTHOR
18 C USAGE: CALL ATRCPT (MSGIN, LMSGOT, MSGOT)
19 C INPUT ARGUMENT LIST:
20 C MSGIN - INTEGER: *-WORD ARRAY CONTAINING BUFR MESSAGE
21 C LMSGOT - INTEGER: DIMENSIONED SIZE (IN INTEGER WORDS) OF MSGOT;
22 C USED BY THE SUBROUTINE TO ENSURE THAT IT DOES NOT
23 C OVERFLOW THE MSGOT ARRAY
25 C OUTPUT ARGUMENT LIST:
26 C MSGOT - INTEGER: *-WORD ARRAY CONTAINING INPUT BUFR MESSAGE
27 C WITH TANK RECEIPT TIME APPENDED TO SECTION 1
30 C MSGIN AND MSGOT MUST BE SEPARATE ARRAYS.
32 C THIS ROUTINE CALLS: BORT GETLENS IUPBS01 MVB
34 C THIS ROUTINE IS CALLED BY: MSGWRT
35 C Also called by application programs.
38 C LANGUAGE: FORTRAN 77
39 C MACHINE: PORTABLE TO ALL PLATFORMS
43 DIMENSION MSGIN
(*), MSGOT
(*)
45 COMMON /HRDWRD
/ NBYTW
,NBITW
,IORD
(8)
46 COMMON /TNKRCP
/ ITRYR
,ITRMO
,ITRDY
,ITRHR
,ITRMI
,CTRT
50 C-----------------------------------------------------------------------
51 C-----------------------------------------------------------------------
53 C Get some section lengths and addresses from the input message.
55 CALL GETLENS
(MSGIN
,1,LEN0
,LEN1
,L2
,L3
,L4
,L5
)
60 LENM
= IUPBS01
(MSGIN
,'LENM')
62 C Check for overflow of the output array. Note that the new
63 C message will be 6 bytes longer than the input message.
66 IF(LENMOT
.GT
.(LMSGOT*NBYTW
)) GOTO 900
70 C Write Section 0 of the new message into the output array.
72 CALL MVB
( MSGIN
, 1, MSGOT
, 1, 4 )
74 CALL PKB
( LENMOT
, 24, MSGOT
, IBIT
)
75 CALL MVB
( MSGIN
, 8, MSGOT
, 8, 1 )
77 C Store the length of the new Section 1.
80 CALL PKB
( LEN1OT
, 24, MSGOT
, IBIT
)
82 C Copy the remainder of Section 1 from the input array to the
85 CALL MVB
( MSGIN
, IAD1
+4, MSGOT
, (IBIT
/8)+1, LEN1
-3 )
87 C Append the tank receipt time data to the new Section 1.
90 CALL PKB
( ITRYR
, 16, MSGOT
, IBIT
)
91 CALL PKB
( ITRMO
, 8, MSGOT
, IBIT
)
92 CALL PKB
( ITRDY
, 8, MSGOT
, IBIT
)
93 CALL PKB
( ITRHR
, 8, MSGOT
, IBIT
)
94 CALL PKB
( ITRMI
, 8, MSGOT
, IBIT
)
96 C Copy Sections 2, 3, 4 and 5 from the input array to the
99 CALL MVB
( MSGIN
, IAD2
+1, MSGOT
, (IBIT
/8)+1, LENM
-IAD2
)
102 900 CALL BORT
('BUFRLIB: ATRCPT - OVERFLOW OF OUTPUT MESSAGE '//
103 . 'ARRAY; TRY A LARGER DIMENSION FOR THIS ARRAY')