NCEPLIBS-w3emc 2.12.0
Loading...
Searching...
No Matches
aea.f
Go to the documentation of this file.
1C> @file
2C> @brief This subroutine converts ascii to ebcdic, or ebcdic to ascii
3C> @author desmarais @date 11-29-1982
4
5C> Program history log:
6C> - 11-29-1982 Desmarais
7C> - 03-31-1988 R. E. Jones
8C> - change logic so it works like a ibm370 translate instruction.
9C> - 08-22-1988 R. E. Jones
10C> - changes for microsoft fortran 4.10
11C> - 09-04-1988 R. E. Jones
12C> - change tables to 128 character set
13C> - 01-31-1990 R. E. Jones
14C> - convert to cray cft77 fortran cray does not allow char*1 to be set to hex
15C> - 12-21-1998 Stephen Gilbert
16C> - replaced function ichar with mova2i.
17C>
18C> @param[in, out] IA character*1 array of ascii data if nc < 0
19C> @param[in, out] IE character*1 array of ebcdic data if nc > 0
20C> @param[in] NC integer, contains character count to convert.
21C> - if nc .lt. 0, convert ascii to ebcdic
22C> - if nc .gt. 0, convert ebcdic to ascii
23C>
24C> @note This subroutine can be replaced by cray utility subroutines
25C> uscctc and uscctt. See manual sr-2079 page 3-15. Cray utility tr
26C> can also be used for ascii, ebcdic conversion. See manual sr-2079
27C> page 9-35.
28C> @note Software version of ibm370 translate instruction, by
29C> changing the two tables we could do a 64, 96, 128 ascii
30C> character set, change lower case to upper, etc.
31C> - aea() converts data at a rate of 1.5 million characters per sec.
32C> - cray utility usccti convert ibm ebcdic to ascii
33C> - cray utility uscctc convert ascii to ibm ebcdic
34C> - they convert data at a rate of 2.1 million characters per sec.
35C> - cray utility tr will also do a ascii, ebcdic conversion.
36C> tr convert data at a rate of 5.4 million characters per sec.
37C> tr is in library /usr/lib/libcos.a add to segldr card.
38C>
39C> @author desmarais @date 11-29-1982
40 SUBROUTINE aea (IA, IE, NC )
41C*** ASCII CONTAINS ASCII CHARACTERS, AS PUNCHED ON IBM029
42C
43 INTEGER(8) IASCII(32)
44 INTEGER(8) IEBCDC(32)
45C
46 CHARACTER*1 IA(*)
47 CHARACTER*1 IE(*)
48 CHARACTER*1 ASCII(0:255)
49 CHARACTER*1 EBCDIC(0:255)
50C
51 equivalence(iascii(1),ascii(0))
52 equivalence(iebcdc(1),ebcdic(0))
53C
54 DATA iascii/
55 & z'000102030009007F',z'0000000B0C0D0E0F',
56 & z'1011120000000000',z'1819000000000000',
57 & z'00001C000A001700',z'0000000000050607',
58 & z'00001600001E0004',z'000000001415001A',
59 & z'2000600000000000',z'0000602E3C282B00',
60 & z'2600000000000000',z'000021242A293B5E',
61 & z'2D2F000000000000',z'00007C2C255F3E3F',
62 & z'0000000000000000',z'00603A2340273D22',
63 & z'2061626364656667',z'6869202020202020',
64 & z'206A6B6C6D6E6F70',z'7172202020202020',
65 & z'207E737475767778',z'797A2020205B2020',
66 & z'0000000000000000',z'00000000005D0000',
67 & z'7B41424344454647',z'4849202020202020',
68 & z'7D4A4B4C4D4E4F50',z'5152202020202020',
69 & z'5C20535455565758',z'595A202020202020',
70 & z'3031323334353637',z'3839202020202020'/
71C
72C*** EBCDIC CONTAINS HEX. REPRESENTATION OF EBCDIC CHARACTERS
73C
74 DATA iebcdc/
75 & z'00010203372D2E2F',z'1605250B0C0D0E0F',
76 & z'101112003C3D3226',z'18193F2722003500',
77 & z'405A7F7B5B6C507D',z'4D5D5C4E6B604B61',
78 & z'F0F1F2F3F4F5F6F7',z'F8F97A5E4C7E6E6F',
79 & z'7CC1C2C3C4C5C6C7',z'C8C9D1D2D3D4D5D6',
80 & z'D7D8D9E2E3E4E5E6',z'E7E8E9ADE0BD5F6D',
81 & z'7981828384858687',z'8889919293949596',
82 & z'979899A2A3A4A5A6',z'A7A8A9C06AD0A107',
83 & 16*z'4040404040404040'/
84C
85 num = iabs(nc)
86C
87 IF (nc .EQ. 0) RETURN
88C
89 IF (nc .GT. 0) THEN
90C
91C*** CONVERT STRING ... EBCDIC TO ASCII, NUM CHARACTERS
92C
93 DO 10 j = 1, num
94 ia(j) = ascii(mova2i(ie(j)))
95 10 CONTINUE
96C
97 ELSE
98C
99C*** CONVERT STRING ... ASCII TO EBCDIC, NUM CHARACTERS
100C
101 DO 20 j = 1, num
102 ie(j) = ebcdic(mova2i(ia(j)))
103 20 CONTINUE
104 END IF
105C
106 RETURN
107 END
subroutine aea(ia, ie, nc)
Program history log:
Definition aea.f:41
integer function mova2i(a)
This Function copies a bit string from a Character*1 variable to an integer variable.
Definition mova2i.f:25