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