From: Clauden? Correia on
Hi all,
I am trying to compile a f77 code inside HadRat9. But I have problems with
the funciton TRIM that is not recognized by the compiler.

command line:
g77 -o fprog.o -c fprog.f
warning:
hostName = TRIM(hostName)//CHAR(0)
Reference to unimplemented intrinsic 'TRIM' at (^) (assumed EXTERNAL)

another error also appear with the operator '//' but I believe that it is
related with the unrecognized function TRIM.

I need to reinstall the compiler? Or I need to include some library at the
command line?

thanks a lot,
Clauden? Correia


From: Richard E Maine on
Clauden? Correia <c.correia(a)tu-bs.de> wrote:

> I am trying to compile a f77 code inside HadRat9. But I have problems with
> the funciton TRIM that is not recognized by the compiler.

That's because TRIM is not an f77 function. It is an f90 one. Most f77
compilers don't have it (except those f77 compilers that are also f90
ones).

--
Richard Maine | Good judgment comes from experience;
email: my first.last at org.domain| experience comes from bad judgment.
org: nasa, domain: gov | -- Mark Twain
From: David Ham on
Clauden? Correia wrote:
> Hi all,
> I am trying to compile a f77 code inside HadRat9. But I have problems with
> the funciton TRIM that is not recognized by the compiler.
>
> command line:
> g77 -o fprog.o -c fprog.f
> warning:
> hostName = TRIM(hostName)//CHAR(0)
> Reference to unimplemented intrinsic 'TRIM' at (^) (assumed EXTERNAL)
>
> another error also appear with the operator '//' but I believe that it is
> related with the unrecognized function TRIM.
>
> I need to reinstall the compiler? Or I need to include some library at the
> command line?
>
> thanks a lot,
> Clauden? Correia
>
>

See Richard's post for the reason for this error. I'll only add that g95
and gfortran are free (in every sense) Fortran 95 compilers available
for your platform and, if you are not being paid to code (eg because you
are a student) then the Intel Fortran compiler is gratis for you.

David
From: Ken Plotkin on
On Mon, 7 Nov 2005 20:54:00 +0100, "Clauden? Correia"
<c.correia(a)tu-bs.de> wrote:

[snip]
>command line:
>g77 -o fprog.o -c fprog.f
>warning:
>hostName = TRIM(hostName)//CHAR(0)
>Reference to unimplemented intrinsic 'TRIM' at (^) (assumed EXTERNAL)
[snip]

TRIM trims trailing blanks from a string.

See if your compiler has intrinsic len_trim. Not f77, but not an
uncommon extension. If you have it, then you can do

n = len_trim(hostname)
hostname=hostname(1:n)//char(0)

although it occurs to me that you might have a problem with the
recursive nature of the statement: setting a string equal to part of
itself. I don't remember when that became legit.

If you don't have len_trim, you can find the end via a simple loop.
If hostname is character*k, then

do 10, n=k,1,-1
if(hostname(n:n).ne.' ') go to 20
10 enddo
20 continue
hostname=hostname(1:n)//char(0)

Ken Plotkin

From: Richard Maine on
Ken Plotkin <kplotkin(a)nospam-cox.net> wrote:


> n = len_trim(hostname)
> hostname=hostname(1:n)//char(0)
>
> although it occurs to me that you might have a problem with the
> recursive nature of the statement: setting a string equal to part of
> itself. I don't remember when that became legit.

F90. But looking at the usage here, that is sort of superfluous anyway.
The same result could be obtained in f77 with just

hostname(n+1:) = char(0)

--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain