NCEPLIBS-w3emc 2.12.0
Loading...
Searching...
No Matches
w3fi62.f
Go to the documentation of this file.
1C> @file
2C> @brief Build 80-char on295 queue descriptor.
3C> @author Bill Cavanaugh @date 1991-06-21
4
5C> Build 80 character queue descriptor using information
6C> supplied by user, placing the completed queue descriptor in the
7C> location specified by the user. (based on office note 295).
8C>
9C> PROGRAM HISTORY LOG:
10C> - Bill Cavanaugh 1991-06-21
11C> - Bill Cavanaugh 1994-03-08 Modified to allow for bulletin sizes that
12C> exceed 20000 bytes
13C> - Ralph Jones 1994-04-28 Change for cray 64 bit word size and
14C> for ASCII character set computers
15C> - Ralph Jones 1996-01-29 Preset IERR to zero
16C> - Boi Vuong 2002-10-15 Replaced function ichar with mova2i
17C>
18C> @param[in] TTAAII First 6 characters of WMO header
19C> @param[inout] KARY Integer array containing user information
20C> - (1) = Day of month
21C> - (2) = Hour of day
22C> - (3) = Hour * 100 + minute
23C> - (4) = Catalog number
24C> - (5) = Number of 80 byte increments
25C> - (6) = Number of bytes in last increment
26C> - (7) = Total size of message
27C> WMO header + body of message in bytes
28C> (not including queue descriptor)
29C> @param[out] LOC Location to receive queue descriptor
30C> @param[out] IERR Error return
31C>
32C> @note If total size is entered (kary(7)) then kary(5) and
33C> kary(6) will be calculated.
34C> If kary(5) and kary(6) are provided then kary(7) will
35C> be ignored.
36C>
37C> @note Equivalence array loc to integer array so it starts on
38C> a word boundary for sbyte subroutine.
39C>
40C> Error returns:
41C> - IERR = 1 Total byte count and/or 80 byte increment
42C> count is missing. One or the other is
43C> required to complete the queue descriptor.
44C> - IERR = 2 Total size too small
45C>
46C> @author Bill Cavanaugh @date 1991-06-21
47 SUBROUTINE w3fi62 (LOC,TTAAII,KARY,IERR)
48C
49 INTEGER IHOLD(2)
50 INTEGER KARY(7),II,IERR
51C
52 LOGICAL IBM370
53C
54 CHARACTER*6 TTAAII,AHOLD
55 CHARACTER*80 LOC
56 CHARACTER*1 BLANK
57C
58 equivalence(ahold,ihold)
59C
60 SAVE
61C
62C BLANK WILL BE 40 HEX OR DECIMAL 64 ON AN IBM370 TYPE
63C COMPUTER, THIS IS THE EBCDIC CHARACTER SET.
64C BLANK WILL BE 20 HEX OR DECIMAL 32 ON A COMPUTER WITH THE
65C ASCII CHARACTER SET. THIS WILL BE USED TO TEST FOR CHARACTER
66C SETS TO FIND IBM370 TYPE COMPUTER.
67C
68 DATA blank /' '/
69C ----------------------------------------------------------------
70C
71C TEST FOR CRAY 64 BIT COMPUTER, LW = 8
72C
73 CALL w3fi01(lw)
74C
75C TEST FOR EBCDIC CHARACTER SET
76C
77 ibm370 = .false.
78 IF (mova2i(blank).EQ.64) THEN
79 ibm370 = .true.
80 END IF
81C
82 inofst = 0
83C 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
92C BYTES 17-20 INTEGER ZEROES
93 CALL sbyte (loc,0,inofst,32)
94 inofst = inofst + 32
95C IF TOTAL COUNT IS INCLUDED
96C THEN WILL DETERMINE THE NUMBER OF
97C 80 BYTE INCREMENTS AND WILL DETERMINE
98C 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
102C 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
119C BYTE 21-22 NR OF 80 BYTE INCREMENTS
120 CALL sbyte (loc,kary(5),inofst,16)
121 inofst = inofst + 16
122C BYTE 23 NR OF BYTES IN LAST INCREMENT
123 CALL sbyte (loc,kary(6),inofst,8)
124 inofst = inofst + 8
125C 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
130C BYTES 29-34 6 CHAR BULLETIN NAME TTAAII
131 loc(29:34) = ttaaii(1:6)
132C
133C IF ON ASCII COMPUTER, CONVERT LAST 6 CHARACTERS TO EBCDIC
134C
135 IF (.NOT.ibm370) CALL w3ai39(loc(29:29),6)
136C
137 inofst = inofst + 48
138C BYTES 35-38 DAY OF MONTH AND UTC(Z) HRS
139C DAY
140C
141C NOTE: W3AI15 WILL MAKE ASCII OR EBCDIC CHARACTERS
142C DEPENDING ON WHAT TYPE OF COMPUTER IT IS ON
143C
144 CALL w3ai15 (kary(1),ii,1,lw,'-')
145 CALL sbyte (loc,ii,inofst,16)
146 inofst = inofst + 16
147C HOURS
148 CALL w3ai15 (kary(2),ii,1,lw,'-')
149 CALL sbyte (loc,ii,inofst,16)
150C
151C IF ON ASCII COMPUTER, CONVERT LAST 4 CHARACTERS TO EBCDIC
152C
153 IF (.NOT.ibm370) CALL w3ai39(loc(35:35),4)
154 inofst = inofst + 16
155C BYTES 39-40 HR/MIN TIME OF BULLETIN CREATION
156C 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
169C 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
177C
178C ON CRAY 64 BIT COMPUTER
179C
180 ELSE
181 CALL sbyte (loc,ihold,inofst,40)
182 inofst = inofst + 40
183 END IF
184C
185C IF ON ASCII COMPUTER, CONVERT LAST 5 CHARACTERS TO EBCDIC
186C
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
194C 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