NCEPLIBS-w3emc  2.11.0
w3fi62.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Build 80-char on295 queue descriptor.
3 C> @author Bill Cavanaugh @date 1991-06-21
4 
5 C> Build 80 character queue descriptor using information
6 C> supplied by user, placing the completed queue descriptor in the
7 C> location specified by the user. (based on office note 295).
8 C>
9 C> PROGRAM HISTORY LOG:
10 C> - Bill Cavanaugh 1991-06-21
11 C> - Bill Cavanaugh 1994-03-08 Modified to allow for bulletin sizes that
12 C> exceed 20000 bytes
13 C> - Ralph Jones 1994-04-28 Change for cray 64 bit word size and
14 C> for ASCII character set computers
15 C> - Ralph Jones 1996-01-29 Preset IERR to zero
16 C> - Boi Vuong 2002-10-15 Replaced function ichar with mova2i
17 C>
18 C> @param[in] TTAAII First 6 characters of WMO header
19 C> @param[inout] KARY Integer array containing user information
20 C> - (1) = Day of month
21 C> - (2) = Hour of day
22 C> - (3) = Hour * 100 + minute
23 C> - (4) = Catalog number
24 C> - (5) = Number of 80 byte increments
25 C> - (6) = Number of bytes in last increment
26 C> - (7) = Total size of message
27 C> WMO header + body of message in bytes
28 C> (not including queue descriptor)
29 C> @param[out] LOC Location to receive queue descriptor
30 C> @param[out] IERR Error return
31 C>
32 C> @note If total size is entered (kary(7)) then kary(5) and
33 C> kary(6) will be calculated.
34 C> If kary(5) and kary(6) are provided then kary(7) will
35 C> be ignored.
36 C>
37 C> @note Equivalence array loc to integer array so it starts on
38 C> a word boundary for sbyte subroutine.
39 C>
40 C> Error returns:
41 C> - IERR = 1 Total byte count and/or 80 byte increment
42 C> count is missing. One or the other is
43 C> required to complete the queue descriptor.
44 C> - IERR = 2 Total size too small
45 C>
46 C> @author Bill Cavanaugh @date 1991-06-21
47  SUBROUTINE w3fi62 (LOC,TTAAII,KARY,IERR)
48 C
49  INTEGER IHOLD(2)
50  INTEGER KARY(7),II,IERR
51 C
52  LOGICAL IBM370
53 C
54  CHARACTER*6 TTAAII,AHOLD
55  CHARACTER*80 LOC
56  CHARACTER*1 BLANK
57 C
58  equivalence(ahold,ihold)
59 C
60  SAVE
61 C
62 C BLANK WILL BE 40 HEX OR DECIMAL 64 ON AN IBM370 TYPE
63 C COMPUTER, THIS IS THE EBCDIC CHARACTER SET.
64 C BLANK WILL BE 20 HEX OR DECIMAL 32 ON A COMPUTER WITH THE
65 C ASCII CHARACTER SET. THIS WILL BE USED TO TEST FOR CHARACTER
66 C SETS TO FIND IBM370 TYPE COMPUTER.
67 C
68  DATA blank /' '/
69 C ----------------------------------------------------------------
70 C
71 C TEST FOR CRAY 64 BIT COMPUTER, LW = 8
72 C
73  CALL w3fi01(lw)
74 C
75 C TEST FOR EBCDIC CHARACTER SET
76 C
77  ibm370 = .false.
78  IF (mova2i(blank).EQ.64) THEN
79  ibm370 = .true.
80  END IF
81 C
82  inofst = 0
83 C BYTES 1-16 'QUEUE DESCRIPTOR'
84  CALL sbyte (loc,-656095772,inofst,32)
85  inofst = inofst + 32
86  CALL sbyte (loc,-985611067,inofst,32)
87  inofst = inofst + 32
88  CALL sbyte (loc,-490481207,inofst,32)
89  inofst = inofst + 32
90  CALL sbyte (loc,-672934183,inofst,32)
91  inofst = inofst + 32
92 C BYTES 17-20 INTEGER ZEROES
93  CALL sbyte (loc,0,inofst,32)
94  inofst = inofst + 32
95 C IF TOTAL COUNT IS INCLUDED
96 C THEN WILL DETERMINE THE NUMBER OF
97 C 80 BYTE INCREMENTS AND WILL DETERMINE
98 C THE NUMBER OF BYTES IN THE LAST INCREMENT
99  ierr = 0
100  IF (kary(7).NE.0) THEN
101  IF (kary(7).LT.35) THEN
102 C PRINT *,'LESS THAN MINIMUM SIZE'
103  ierr = 2
104  RETURN
105  END IF
106  kary(5) = kary(7) / 80
107  kary(6) = mod(kary(7),80)
108  IF (kary(6).EQ.0) THEN
109  kary(6) = 80
110  ELSE
111  kary(5) = kary(5) + 1
112  END IF
113  ELSE
114  IF (kary(5).LT.1) THEN
115  ierr = 1
116  RETURN
117  END IF
118  END IF
119 C BYTE 21-22 NR OF 80 BYTE INCREMENTS
120  CALL sbyte (loc,kary(5),inofst,16)
121  inofst = inofst + 16
122 C BYTE 23 NR OF BYTES IN LAST INCREMENT
123  CALL sbyte (loc,kary(6),inofst,8)
124  inofst = inofst + 8
125 C BYTES 24-28 INTEGER ZEROES
126  CALL sbyte (loc,0,inofst,32)
127  inofst = inofst + 32
128  CALL sbyte (loc,0,inofst,8)
129  inofst = inofst + 8
130 C BYTES 29-34 6 CHAR BULLETIN NAME TTAAII
131  loc(29:34) = ttaaii(1:6)
132 C
133 C IF ON ASCII COMPUTER, CONVERT LAST 6 CHARACTERS TO EBCDIC
134 C
135  IF (.NOT.ibm370) CALL w3ai39(loc(29:29),6)
136 C
137  inofst = inofst + 48
138 C BYTES 35-38 DAY OF MONTH AND UTC(Z) HRS
139 C DAY
140 C
141 C NOTE: W3AI15 WILL MAKE ASCII OR EBCDIC CHARACTERS
142 C DEPENDING ON WHAT TYPE OF COMPUTER IT IS ON
143 C
144  CALL w3ai15 (kary(1),ii,1,lw,'-')
145  CALL sbyte (loc,ii,inofst,16)
146  inofst = inofst + 16
147 C HOURS
148  CALL w3ai15 (kary(2),ii,1,lw,'-')
149  CALL sbyte (loc,ii,inofst,16)
150 C
151 C IF ON ASCII COMPUTER, CONVERT LAST 4 CHARACTERS TO EBCDIC
152 C
153  IF (.NOT.ibm370) CALL w3ai39(loc(35:35),4)
154  inofst = inofst + 16
155 C BYTES 39-40 HR/MIN TIME OF BULLETIN CREATION
156 C TWO BYTES AS 4 BIT BCD
157  ka = kary(3) / 1000
158  kb = mod(kary(3),1000) / 100
159  kc = mod(kary(3),100) / 10
160  kd = mod(kary(3),10)
161  CALL sbyte (loc,ka,inofst,4)
162  inofst = inofst + 4
163  CALL sbyte (loc,kb,inofst,4)
164  inofst = inofst + 4
165  CALL sbyte (loc,kc,inofst,4)
166  inofst = inofst + 4
167  CALL sbyte (loc,kd,inofst,4)
168  inofst = inofst + 4
169 C BYTES 41-45 CATALOG NUMBER ELSE (SET TO 55555)
170  IF (kary(4).GE.1.AND.kary(4).LE.99999) THEN
171  CALL w3ai15 (kary(4),ihold,1,8,'-')
172  IF (lw.EQ.4) THEN
173  CALL sbyte (loc,ihold(1),inofst,8)
174  inofst = inofst + 8
175  CALL sbyte (loc,ihold(2),inofst,32)
176  inofst = inofst + 32
177 C
178 C ON CRAY 64 BIT COMPUTER
179 C
180  ELSE
181  CALL sbyte (loc,ihold,inofst,40)
182  inofst = inofst + 40
183  END IF
184 C
185 C IF ON ASCII COMPUTER, CONVERT LAST 5 CHARACTERS TO EBCDIC
186 C
187  IF (.NOT.ibm370) CALL w3ai39(loc(41:41),5)
188  ELSE
189  CALL sbyte (loc,-168430091,inofst,32)
190  inofst = inofst + 32
191  CALL sbyte (loc,245,inofst,8)
192  inofst = inofst + 8
193  END IF
194 C BYTES 46-80 INTEGER ZEROES
195  DO 4676 i = 1, 8
196  CALL sbyte (loc,0,inofst,32)
197  inofst = inofst + 32
198  4676 CONTINUE
199  CALL sbyte (loc,0,inofst,24)
200  RETURN
201  END
integer function mova2i(a)
This Function copies a bit string from a Character*1 variable to an integer variable.
Definition: mova2i.f:25
subroutine sbyte(IOUT, IN, ISKIP, NBYTE)
Definition: sbyte.f:12
subroutine w3ai15(NBUFA, NBUFB, N1, N2, MINUS)
Converts a set of binary numbers to an equivalent set of ascii number fields in core.
Definition: w3ai15.f:48
subroutine w3ai39(NFLD, N)
translate an 'ASCII' field to 'EBCDIC', all alphanumerics, special charcaters, fill scatter,...
Definition: w3ai39.f:26
subroutine w3fi01(LW)
Determines the number of bytes in a full word for the particular machine (IBM or cray).
Definition: w3fi01.f:19
subroutine w3fi62(LOC, TTAAII, KARY, IERR)
Build 80 character queue descriptor using information supplied by user, placing the completed queue d...
Definition: w3fi62.f:48