EBCDIC: lower case < upper case < numbers
ASCII: numbers < upper case < lower case
An alternative to reprogramming to account for these differences is to write FORTRAN function subprograms that compare character data according to the EBCDIC sequence. An example of such a function is shown below. Similar functions can be created for other relational operators.
It is important to note that for intensive character manipulation such as performing a sort on large data files, the increase in cpu usage when using such FORTRAN functions compared to using built-in functions is quite large. Roughly speaking, a program that sorts using these supplemental FORTRAN functions can take 10 times longer than a program using built-in functions.
logical function lte(arg1,arg2)
character*92 ebcdic
character *(*) arg1,arg2
data ebcdic /' .<(+|&!$*);^-/,%_>?`:#@''="abcdefghijklmnopqr~stu
1vwxyz{ABCDEFGHI}JKLMNOPQRSTUVWXYZ0123456789'/
do 10 i = 1,min(len(arg1),len(arg2))
c Test for equality..if equal go to the next character;
c if not continue
if(arg1(i:i).eq.arg2(i:i))then
go to 10
else
do 15 j=1,92
if (arg1(i:i).eq.ebcdic(j:j))then
lte=.true.
return
else if (arg2(i:i).eq.ebcdic(j:j))then
lte=.false.
return
end if
15 continue
end if
10 continue
c All characters up to the shorter of the two arguments are equal
c and therefore the shorter of the two arguments is less than
c the other. If the lengths are equal, lte is .false.
if(len(arg1).eq.len(arg2))then
lte=.false.
else if (len(arg1).lt.len(arg2))then
lte=.true.
else
lte=.false.
end if
return
end
******************************************************************
* *
* Correspondence to VS FORTRAN *
* *
******************************************************************
* *
* VS FORTRAN UNIX *
* ========== ==== *
* *
* if('A'.lt.'3')then if(lte('A','3')then *
* print*, 'EBCDIC' print*, 'EBCDIC' *
* end if end if *
* *
* *
******************************************************************
