NCEPLIBS-w3emc  2.11.0
aea.f
Go to the documentation of this file.
1 C> @file
2 C> @brief This subroutine converts ascii to ebcdic, or ebcdic to ascii
3 C> @author desmarais @date 11-29-1982
4 
5 C> Program history log:
6 C> - 11-29-1982 Desmarais
7 C> - 03-31-1988 R. E. Jones
8 C> - change logic so it works like a ibm370 translate instruction.
9 C> - 08-22-1988 R. E. Jones
10 C> - changes for microsoft fortran 4.10
11 C> - 09-04-1988 R. E. Jones
12 C> - change tables to 128 character set
13 C> - 01-31-1990 R. E. Jones
14 C> - convert to cray cft77 fortran cray does not allow char*1 to be set to hex
15 C> - 12-21-1998 Stephen Gilbert
16 C> - replaced function ichar with mova2i.
17 C>
18 C> @param[in, out] IA character*1 array of ascii data if nc < 0
19 C> @param[in, out] IE character*1 array of ebcdic data if nc > 0
20 C> @param[in] NC integer, contains character count to convert.
21 C> - if nc .lt. 0, convert ascii to ebcdic
22 C> - if nc .gt. 0, convert ebcdic to ascii
23 C>
24 C> @note This subroutine can be replaced by cray utility subroutines
25 C> uscctc and uscctt. See manual sr-2079 page 3-15. Cray utility tr
26 C> can also be used for ascii, ebcdic conversion. See manual sr-2079
27 C> page 9-35.
28 C> @note Software version of ibm370 translate instruction, by
29 C> changing the two tables we could do a 64, 96, 128 ascii
30 C> character set, change lower case to upper, etc.
31 C> - aea() converts data at a rate of 1.5 million characters per sec.
32 C> - cray utility usccti convert ibm ebcdic to ascii
33 C> - cray utility uscctc convert ascii to ibm ebcdic
34 C> - they convert data at a rate of 2.1 million characters per sec.
35 C> - cray utility tr will also do a ascii, ebcdic conversion.
36 C> tr convert data at a rate of 5.4 million characters per sec.
37 C> tr is in library /usr/lib/libcos.a add to segldr card.
38 C>
39 C> @author desmarais @date 11-29-1982
40  SUBROUTINE aea (IA, IE, NC )
41 C*** ASCII CONTAINS ASCII CHARACTERS, AS PUNCHED ON IBM029
42 C
43  INTEGER(8) IASCII(32)
44  INTEGER(8) IEBCDC(32)
45 C
46  CHARACTER*1 IA(*)
47  CHARACTER*1 IE(*)
48  CHARACTER*1 ASCII(0:255)
49  CHARACTER*1 EBCDIC(0:255)
50 C
51  equivalence(iascii(1),ascii(0))
52  equivalence(iebcdc(1),ebcdic(0))
53 C
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'/
71 C
72 C*** EBCDIC CONTAINS HEX. REPRESENTATION OF EBCDIC CHARACTERS
73 C
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'/
84 C
85  num = iabs(nc)
86 C
87  IF (nc .EQ. 0) RETURN
88 C
89  IF (nc .GT. 0) THEN
90 C
91 C*** CONVERT STRING ... EBCDIC TO ASCII, NUM CHARACTERS
92 C
93  DO 10 j = 1, num
94  ia(j) = ascii(mova2i(ie(j)))
95  10 CONTINUE
96 C
97  ELSE
98 C
99 C*** CONVERT STRING ... ASCII TO EBCDIC, NUM CHARACTERS
100 C
101  DO 20 j = 1, num
102  ie(j) = ebcdic(mova2i(ia(j)))
103  20 CONTINUE
104  END IF
105 C
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