NCEPLIBS-w3emc 2.12.0
Loading...
Searching...
No Matches
mkfldsep.f
Go to the documentation of this file.
1C> @file
2C> @brief Makes TOC Flag Field Separator Block
3C> @author Stephen Gilbert @date 2002-09-16
4
5C> Generates a TOC Flag Field Separator Block used to separate WMO
6C> Bulletins within a transmission file to be ingested in TOC's FTP Input
7C> Service, which can be used to disseminate WMO buletins. See [File
8C> Transfer Input Service Guide - Input examples and how to FTP files to
9C> the Gateway] (https://www.weather.gov/tg/ftpingest).
10C>
11C> This routine can generate different flag field separator blocks
12C> depending on the value of variable iopt. For details see [GATEWAY File
13C> Standards & Content Structures] (https://www.weather.gov/tg/fstandrd).
14C>
15C> Bulletin "Flag Field Separator" block - OPTION 1 (old)
16C> - bytes:
17C> - 1 - 4 Marker string (####).
18C> - 5 - 7 Block length [018 fixed value].
19C> - 8 - 13 Total length of bulletin in bytes [octets]
20C> (not including the flag field block).
21C> - 14 - 17 Marker string (####).
22C> - 18 Line Feed (ASCII "0A").
23C>
24C> Bulletin "Flag Field Separator" block - OPTION 1a (new)
25C> - bytes:
26C> - 1 - 4 Marker string (####).
27C> - 5 - 7 Block length (nnn) - value always greater than 018.
28C> - 8 - 18 Total length of bulletin in bytes [octets]
29C> (not including the flag field block).
30C> - 19 - nnn-5 Reserved for future use.
31C> - nnn-4 - nnn-1 Marker string (####).
32C> - nnn Line Feed (ASCII "0A").
33C>
34C> Bulletin "Flag Field Separator" block - OPTION 2 (limited)
35C> - bytes:
36C> - 1 - 4 Marker string (****).
37C> - 5 - 14 Total length of bulletin in bytes [octets]
38C> (not including the flag field block).
39C> - 15 - 18 Marker string (****).
40C> - 19 Line Feed (ASCII "0A").
41C>
42C> @param[in] iopt Flag Field Separator block option:
43C> = 1: Separator block for use with alphanumeric bulletins.
44C> if lenin <= 18 and lenbull <= 999999, OPTION 1 block will be generated.
45C> if lenin > 18 or lenbull > 999999, OPTION 1a block will be generated.
46C> = 2: Separator block for use with GRIB/BUFR bulletins.
47C> @param[in] lenin Desired length of the flag field separator block.
48C> ignored, if iopt=2.
49C> @param[in] lenbull Integer length of the bulletin (in bytes) that will follow
50C> this separator block.
51C> @param[out] csep*(*) Character array containing the flag field separator.
52C> @param[out] lenout Integer length of the flag field separator block.
53C>
54C> @author Stephen Gilbert @date 2002-09-16
55 subroutine mkfldsep(csep,iopt,lenin,lenbull,lenout)
56C
57 character*(*),intent(out) :: csep
58 integer,intent(in) :: iopt,lenin,lenbull
59 integer,intent(out) :: lenout
60C
61 character(len=4),parameter :: cstar='****',clb='####'
62C
63 if (iopt.eq.1) then
64 if ( lenin .le. 18 .and. lenbull .le. 999999 ) then
65C Create OPTION 1 separator block
66 csep(1:4)=clb
67 csep(5:7)='018'
68 write(csep(8:13),fmt='(I6.6)') lenbull
69 csep(14:17)=clb
70 csep(18:18)=char(10)
71 lenout=18
72 else ! Create OPTION 1a separator block
73 nnn=lenin
74 if ( nnn.lt.23 ) nnn=23
75 csep(1:4)=clb
76 write(csep(5:7),fmt='(I3.3)') nnn
77 write(csep(8:18),fmt='(I11.11)') lenbull
78 ! In docs, these bytes are "reserved for future use".
79 csep(19:nnn-5)='0'
80 csep(nnn-4:nnn-1)=clb
81 csep(nnn:nnn)=char(10)
82 lenout=nnn
83 endif
84 elseif (iopt.eq.2) then ! Create OPTION 2 separator block
85 csep(1:4)=cstar
86 write(csep(5:14),fmt='(I10.10)') lenbull
87 csep(15:18)=cstar
88 csep(19:19)=char(10)
89 lenout=19
90 else
91 print *,"mkfldsep: Option ",iopt," not recognized."
92 csep(1:lenin)=' '
93 endif
94C
95 return
96 end
subroutine mkfldsep(csep, iopt, lenin, lenbull, lenout)
Generates a TOC Flag Field Separator Block used to separate WMO Bulletins within a transmission file ...
Definition mkfldsep.f:56