NCEPLIBS-w3emc 2.12.0
Loading...
Searching...
No Matches
w3fi61.f
Go to the documentation of this file.
1C> @file
2C> @brief Build 40 char communications prefix.
3C> @author Bill Cavanaugh @date 1991-06-21
4
5C> Using information from the user, build a 40 character
6C> communications prefix and place in indicated location.
7C>
8C> Program history log:
9C> - Bill Cavanaugh 1991-06-21
10C> - Ralph Jones 1991-09-20 Changes for silicongraphics 3.3 fortran 77.
11C> - Ralph Jones 1993-03-29 Add save statement.
12C> - Ralph Jones 1994-04-28 Change for cray 64 bit word size and
13C> for ASCII character set computers.
14C> - Boi Vuong 2002-10-15 Replaced function ichar with mova2i.
15C>
16C> @param[in] ICAT Catalog number.
17C> @param[in] AREG AFOS regional addressing flags (6 positions)
18C> select any or all of the following. Selections
19C> will automatically be left justified and blank
20C> filled to 6 positions.
21C> If bulletins and/or messages are not to be routed
22C> to AFOS, then leave the field filled with blanks.
23C> - E - Eastern region
24C> - C - Central region
25C> - W - Western region
26C> - S - Southern region
27C> - A - Atlantic region
28C> - P - Pacific region
29C> @param[in] IERR Error return.
30C> @param[in] IBCKUP Backup indicator w/header key
31C> - 0 = Not a backup.
32C> - 1 = FD backup.
33C> - 2 = DF backup.
34C> - Back up is only permitted for KU and KU bulletins.
35C> @param[in] IDATYP Data type indicator.
36C> - 0 = EBCIDIC data.
37C> - 11 = Binary data.
38C> - 12 = Psuedo-ASCII data.
39C> - 3 = ASCII data.
40C> @param[out] LOC Name of the array to receive the communications prefix.
41C>
42C> @note Error returns
43C> IERR:
44C> - = 0 Normal return.
45C> - = 1 Incorrect backup flag.
46C> - = 2 A regional addressing flag is non-blank and non-standard entry.
47C> - = 3 Data type is non-standard entry.
48C>
49C> @author Bill Cavanaugh @date 1991-06-21
50 SUBROUTINE w3fi61 (LOC,ICAT,AREG,IBCKUP,IDATYP,IERR)
51 INTEGER LOC(*)
52 INTEGER ICAT,IBCKUP,IDATYP
53 INTEGER IERR,IHOLD
54C
55 CHARACTER*6 AREG
56 CHARACTER*8 AHOLD
57 CHARACTER*6 ARGNL
58 CHARACTER*1 BLANK
59C
60 LOGICAL IBM370
61C
62 equivalence(ihold,ahold)
63C
64 SAVE
65C
66 DATA argnl /'ECWSAP'/
67C
68C BLANK WILL BE 40 HEX OR DECIMAL 64 ON AN IBM370 TYPE
69C COMPUTER, THIS IS THE EBCDIC CHARACTER SET.
70C BLANK WILL BE 20 HEX OR DECIMAL 32 ON A COMPUTER WITH THE
71C ASCII CHARACTER SET. THIS WILL BE USED TO TEST FOR CHARACTER
72C SETS TO FIND IBM370 TYPE COMPUTER.
73C
74 DATA blank /' '/
75 DATA ibm370/.false./
76C
77C ----------------------------------------------------------------
78C
79C TEST FOR CRAY 64 BIT COMPUTER, LW = 8
80C
81 CALL w3fi01(lw)
82C
83C TEST FOR EBCDIC CHARACTER SET
84C
85 IF (mova2i(blank).EQ.64) THEN
86 ibm370 = .true.
87 END IF
88C
89 ierr = 0
90 inofst = 0
91C BYTE 1 SOH - START OF HEADER
92 CALL sbyte (loc,125,inofst,8)
93 inofst = inofst + 8
94C BYTE 2 TRANSMISSION PRIORITY
95 CALL sbyte (loc,1,inofst,8)
96 inofst = inofst + 8
97C BYTE 3-7 CATALOG NUMBER
98 IF (icat.GT.0) THEN
99 IF (lw.EQ.4) THEN
100 kk = icat / 10
101 CALL w3ai15 (kk,ihold,1,4,'-')
102 IF (.NOT.ibm370) CALL w3ai39(ihold,4)
103 CALL sbyte (loc,ihold,inofst,32)
104 inofst = inofst + 32
105 kk = mod(icat,10)
106 CALL w3ai15 (kk,ihold,1,4,'-')
107 IF (.NOT.ibm370) CALL w3ai39(ihold,4)
108 CALL sbyte (loc,ihold,inofst,8)
109 inofst = inofst + 8
110 ELSE
111 CALL w3ai15 (icat,ihold,1,8,'-')
112 IF (.NOT.ibm370) CALL w3ai39(ihold,8)
113 CALL sbyte (loc,ihold,inofst,40)
114 inofst = inofst + 40
115 END IF
116 ELSE
117 CALL sbyte (loc,-252645136,inofst,32)
118 inofst = inofst + 32
119 CALL sbyte (loc,240,inofst,8)
120 inofst = inofst + 8
121 END IF
122C BYTE 8-9-10 BACK-UP FLAG FOR FD OR DF BULLETINS
123C 0 = NOT A BACKUP
124C 1 = FD
125C 2 = DF
126 IF (ibckup.EQ.0) THEN
127C NOT A BACKUP
128 CALL sbyte (loc,4210752,inofst,24)
129 inofst = inofst + 24
130 ELSE IF (ibckup.EQ.1) THEN
131C BACKUP FOR FD
132 CALL sbyte (loc,12764868,inofst,24)
133 inofst = inofst + 24
134 ELSE IF (ibckup.EQ.2) THEN
135C BACKUP FOR DF
136 CALL sbyte (loc,12764358,inofst,24)
137 inofst = inofst + 24
138 END IF
139C BYTE 11 BLANK
140 CALL sbyte (loc,64,inofst,8)
141 inofst = inofst + 8
142C BYTE 12 DATA TYPE
143 IF (idatyp.EQ.0) THEN
144 ELSE IF (idatyp.EQ.11) THEN
145 ELSE IF (idatyp.EQ.12) THEN
146 ELSE IF (idatyp.EQ.3) THEN
147 ELSE
148 ierr = 3
149 RETURN
150 END IF
151 CALL sbyte (loc,idatyp,inofst,8)
152 inofst = inofst + 8
153C BYTES 13-18 AFOS REGIONAL ADDRESSING FLAGS
154 CALL sbyte (loc,1077952576,inofst,32)
155 inofst = inofst + 32
156 CALL sbyte (loc,1077952576,inofst,16)
157 kreset = inofst + 16
158 inofst = inofst - 32
159 DO 1000 j = 1, 6
160 DO 900 k = 1, 6
161 IF (areg(j:j).EQ.argnl(k:k)) THEN
162C PRINT *,AREG(J:J),ARGNL(K:K),' MATCH'
163 ihold = 0
164 IF (lw.EQ.4) THEN
165 ahold(4:4) = areg(j:j)
166 IF (.NOT.ibm370) CALL w3ai39(ihold,4)
167 ELSE
168 ahold(8:8) = areg(j:j)
169 CALL w3ai39(ihold,8)
170 END IF
171 CALL sbyte (loc,ihold,inofst,8)
172 inofst = inofst + 8
173 GO TO 1000
174 ELSE IF (areg(j:j).EQ.' ') THEN
175C PRINT *,'BLANK SOURCE '
176 GO TO 1000
177 END IF
178 900 CONTINUE
179 ierr = 2
180 RETURN
181 1000 CONTINUE
182 inofst = kreset
183C BYTES 19-39 UNUSED (SET TO BLANK)
184 DO 1938 i = 1, 20, 4
185 CALL sbyte (loc,1077952576,inofst,32)
186 inofst = inofst + 32
187 1938 CONTINUE
188C BYTE 39 MUST BE A BLANK
189 CALL sbyte (loc,64,inofst,8)
190 inofst = inofst + 8
191C BYTE 40 MUST BE A BLANK
192 CALL sbyte (loc,64,inofst,8)
193C ----------------------------------------------------------------
194 RETURN
195 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 w3fi61(loc, icat, areg, ibckup, idatyp, ierr)
Using information from the user, build a 40 character communications prefix and place in indicated lo...
Definition w3fi61.f:51