1.4 Internal Representation of Characters

As with the floating-point numbers, the internal representation of characters are also system-dependent. CHGLIB and CHKLIB are packages for standardizing system-dependent character manipulation.

In FORTRAN grammar, the following FORTRAN character set is defined, and a program in FORTRAN must be written using only these characters. (Notes and contents of character-type data are exceptions to this rule.)

Roman characters: ABCDEFGHIJKLMNOPQRSTUVWXYZ
Numbers: 0123456789
Special characters: blank'()*+,-./:= currency sign

Therefore, strictly speaking, it is grammatically incorrect to write a FORTRAN program using lower-case letters.

However, the method of internal representation of characters, including these FORTRAN characters, are not specifically defined in FORTRAN standard. As with the internal representation of floating-point numbers, there are two types of internal representation of characters: the EBCDIC of the IBM standard and the American standard code ASCII.

It can be seen that character codes are system dependent, even for FORTRAN characters. Therefore, the ICHAR function that returns the character code is a standard built-in function of FORTRAN, the returned value will be system dependent. Functions LGE, LGT, LLE, LLT are for comparing the values of the character code, free of any system dependency. These functions compare the codes following the order of ASCII codes, regardless of the code system used by the computer being used. 

Table of EBCDIC Codes
  0 1 2 3 4 5 6 7 8 9 A B C D E F
0 NUL DLE     SP & -           { } $ 0
1 SOH DC1         /   a j ~   A J   1
2 STX DC2 FS SYN         b k s   B K S 2
3 ETX DC3             c l t   C L T 3
4                 d m u   D M U 4
5 HT   LF           e n v   E N V 5
6   BS ETB           f o w   F O W 6
7 DEL   ESC EOT         g p x   G P X 7
8   CAN             h q y   H Q Y 8
9   EM             i r z   I R Z 9
A         :                
B VT       .   , #                
C FF     DC4 < * % @                
D CR GS ENQ NAK ( ) _ '                
E SO RS ACK   + ; > =                
F SI US BEL SUB ? "                

Table of ASCII Codes
  0 1 2 3 4 5 6 7
0 NUL DLE SP 0 @ P   p
1 SOH DC1 ! 1 A Q a q
2 STX DC2 " 2 B R b r
3 ETX DC3 # 3 C S c s
4 EOT DC4 $ 4 D T d t
5 ENQ NAK % 5 E U e u
6 ACK SYN & 6 F V f v
7 BEL ETB ' 7 G W g w
8 BS CAN ( 8 H X h x
9 HT EM ) 9 I Y i y
A LF SUB * : J Z j z
B VT ESC + ; K [ k {
C FF FS , < L \ l |
D CR GS - = M ] m }
E SO RS . > N ^ n ~
F SI US / ? O _ o DEL


In JIS X0201, the \ and ~ in the above table become / and - (overline).

Table of Control Codes
Symbol Name
NUL null
SOH start of heading
STX start of text
ETX end of text
EOT end of transmission
ENQ enquiry
ACK acknowledge
BEL bell
BS backspace
HT horizontal tabulation
LF line feed
VT horizontal tabulation
FF form feed
CR carriage return
SO shift out
SI shift in
DLE data link escape
Symbol Name
DC1 device control 1
DC2 device control 2
DC3 device control 3
DC4 device control 4
NAK negative acknowledge
SYN synchronous idle
ETB end of transmission block
CAN cancel
EM end of medium
SUB substitute character
ESC escape
FS file separator
GS group separator
RS record separator
US unit separator
SP space
DEL delete



Correspondence Between EBCDIC of Fujitsu and Hitachi and ASCII
Code Fujitsu Hitachi ASCII
4A c* [ [
4F | ! !
5A ! ] ]
5B  \ \ $
5F ¬ ^ ^
6A   | |
E0 $ $ \