Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Fortran 77 alphabet character $

3 views
Skip to first unread message

Herman D. Knoble

unread,
May 29, 2008, 8:59:01 AM5/29/08
to
What does the F77 Standard say about using the character, $ for the beginning of a
variable name? A professor here has a large code that does this throughout. (See
the following Block Data).

Note: tje variable names in this large code begin with every letter of the alplhabet;
so a substitute for $ won't work.

The prroblem is that G95 will flag thet such use of $ as an error.
Lahey LF95 compiles the code with no warning about the $ variables.
Silverfrost flags the $ varables as an error.
Intel Ifort compiles the code with no warning about the $ variables.

Thanks.
Skip Knoble

-------------------------------------Example of use of $ variables ------------
BLOCKDATA
IMPLICIT INTEGER ($)
COMMON /BASIC/$PRTOP(15),TITLE(18),VERSIN,PAGE,NUMSTP,STEPS,IMAX,
1 JMAX,MMAX,NGEM,$STFLG,NSOR,IJMAX,$CNSIZ,
2 $BASCR,LO1,$INPCR,$MSMCR,$GTINP,
3 NLB,NTB,NRB,NBB,EPI1,ITMAX,FACTOR,$BORSH,
4 LIMI,LIMJ,NIT,TTLM,VMN,MTOX,MC1,MC2,MC3,MC4,I,J,K,TV1,
5 TV2,TV3,TV4,IS1,IS2,
6 GROUPS,IBORON,NOADD,$SGSUM,$SGPT,$MAP(20),$MXMP,LIN
INTEGER STEPS,BESTIR
INTEGER PAGE
COMMON /XENON/ $XEOPT
COMMON /BATCOS/ COSQNN(180)
COMMON /COST/ COSTFL,NUMBAT,DOLLAR,IBAOUT(15,5),ILLREU(15),
1ILREPO(15,5)
COMMON /RELOAD/MAXSH,NCODE(70),NEB(4,70),W(70),P(6),V(6),
1 MMA,MMI,IR(70),BESTIR(70),KC,KSUM,LA,INNEW(5),
2 NEBX(4,70),IV(6),RPLO(70),RPHI(70),
3 BESTID(70),BESTBA(70),OPTPPM
COMMON /PASSCY/ CCULM(70),AASNAM(70),IIBATC(70), TRECUL(15,5),TREN
1AM(15,5),IREOPO(15,5)
C
DATA PAGE/0/
DATA COSQNN/180*0./
DATA DOLLAR/'$$'/
DATA INNEW/11,12,13,19,24/
DATA VERSIN /90.1/
DATA TRECUL/75*0./,TRENAM/75*' '/,IREOPO/75*0/
C DEFAULT MAX. NO. OF ITERATIONS
DATA ITMAX/700/
C DEFAULT OUTPUT OPTIONS
CB DATA $PRTOP/1,10,0,-1,1,1,1,0,0,0,0,1,0,0,0/
DATA $PRTOP/0, 0,0,-1,0,0,1,0,0,0,0,1,0,0,0/
C DEFAULT BOUNDRY CONDITION ASSIGNMENTS
DATA NLB/1/,NTB/1/,NRB/0/,NBB/0/
C DEFAULT POWER MAP DATA
DATA $MAP/8,7,6,4,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0/,$MXMP/6/
END

Arjen Markus

unread,
May 29, 2008, 9:15:27 AM5/29/08
to
If I remember correctly, some compilers allowed the use
of a $ sign as an extension. It was allowed only as the
first character. I do not know what the default type
would have been.

Other compilers I have seen used it in formats: we now
use ADVANCE='NO' for the same functionality.

It seems to me your professor has a problem here. My
suggestion would be to:
- Find a letter in the alphabet that is not used that
often as the first character (a Z perhaps?)
- Use that to replace the $ sign
- Make sure that there is no overlap with existing
variable names. You could use a tool to create a list
of variables then.

Regards,

Arjen

glen herrmannsfeldt

unread,
May 29, 2008, 11:07:29 AM5/29/08
to
Arjen Markus wrote:

> If I remember correctly, some compilers allowed the use
> of a $ sign as an extension. It was allowed only as the
> first character. I do not know what the default type
> would have been.

I first knew it in the OS/360 Fortran compilers.
It is a letter, allowed anywhere in variable names,
which comes after Z. Default is REAL*4. I have
seen:

IMPLICIT REAL*8 (A-H,O-$)

(snip)

PL/I allows @, #, and $ as alphabetic characters.

-- glen

Herman D. Knoble

unread,
May 29, 2008, 10:17:16 AM5/29/08
to

On Thu, 29 May 2008 06:15:27 -0700 (PDT), Arjen Markus <arjen....@wldelft.nl> wrote:

-|If I remember correctly, some compilers allowed the use
-|of a $ sign as an extension. It was allowed only as the
-|first character. I do not know what the default type
-|would have been.
-|
-|Other compilers I have seen used it in formats: we now
-|use ADVANCE='NO' for the same functionality.
-|
-|It seems to me your professor has a problem here. My
-|suggestion would be to:
-|- Find a letter in the alphabet that is not used that
-| often as the first character (a Z perhaps?)
-|- Use that to replace the $ sign
-|- Make sure that there is no overlap with existing
-| variable names. You could use a tool to create a list
-| of variables then.
-|
-|Regards,
-|
-|Arjen

Arjen: thanks. But my original post precludes each of your good suggestions.

Skip

GaryScott

unread,
May 29, 2008, 10:18:06 AM5/29/08
to
On May 29, 10:07 am, glen herrmannsfeldt <g...@ugcs.caltech.edu>
wrote:

In some operating systems, system services (OS API) calls began with a
$ (written in assembly or other languages that did allow $ in names)
so if you wanted to call a system service, you either needed to allow
$ or you needed an aliasing facility.

Richard Maine

unread,
May 29, 2008, 11:30:21 AM5/29/08
to
Herman D. Knoble <SkipKno...@SPAMpsu.DOT.edu> wrote:

> What does the F77 Standard say about using the character, $ for the
> beginning of a variable name?

Nobody seems yet to have actually answered this question. The f77
standard (and all other versions of the standard) doesn't allow it.

I'm afraid I don't have any brilliant suggestions about how to fix such
nonstandard code.

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

mecej4

unread,
May 29, 2008, 12:39:52 PM5/29/08
to
This is not so simple, but may work if the existing source does not use
variables beginning with, say, "Z_" :

(i) Run Fsplit on the sources;

(ii) Run your fortran-77 compiler on each subroutine, collect a list of
variables starting with $. In each such, subroutine, replace $ by Z_;
add an integer type declaration for the variables tagged by the F-77
compiler.

--mecej4

Herman D. Knoble

unread,
May 29, 2008, 1:15:00 PM5/29/08
to
On Thu, 29 May 2008 11:39:52 -0500, mecej4 <mecej4_s...@operamail.com> wrote:

-|Herman D. Knoble wrote:
-|> What does the F77 Standard say about using the character, $ for the beginning of a
-|> variable name? A professor here has a large code that does this throughout. (See
-|> the following Block Data).
-|>
-|> Note: tje variable names in this large code begin with every letter of the alplhabet;
-|> so a substitute for $ won't work.
-|>
-|> The prroblem is that G95 will flag thet such use of $ as an error.
-|> Lahey LF95 compiles the code with no warning about the $ variables.
-|> Silverfrost flags the $ varables as an error.
-|> Intel Ifort compiles the code with no warning about the $ variables.
-|>
-|> Thanks.
-|> Skip Knoble
-|>
-|> -------------------------------------Example of use of $ variables ------------
-|> BLOCKDATA
-|> IMPLICIT INTEGER ($)
-|> COMMON /BASIC/$PRTOP(15),TITLE(18),VERSIN,PAGE,NUMSTP,STEPS,IMAX,
-|> 1 JMAX,MMAX,NGEM,$STFLG,NSOR,IJMAX,$CNSIZ,
-|> 2 $BASCR,LO1,$INPCR,$MSMCR,$GTINP,
-|> 3 NLB,NTB,NRB,NBB,EPI1,ITMAX,FACTOR,$BORSH,
-|> 4 LIMI,LIMJ,NIT,TTLM,VMN,MTOX,MC1,MC2,MC3,MC4,I,J,K,TV1,
-|> 5 TV2,TV3,TV4,IS1,IS2,
-|> 6 GROUPS,IBORON,NOADD,$SGSUM,$SGPT,$MAP(20),$MXMP,LIN
-|> INTEGER STEPS,BESTIR
-|> INTEGER PAGE
-|> COMMON /XENON/ $XEOPT
-|> COMMON /BATCOS/ COSQNN(180)
-|> COMMON /COST/ COSTFL,NUMBAT,DOLLAR,IBAOUT(15,5),ILLREU(15),
-|> 1ILREPO(15,5)
-|> COMMON /RELOAD/MAXSH,NCODE(70),NEB(4,70),W(70),P(6),V(6),
-|> 1 MMA,MMI,IR(70),BESTIR(70),KC,KSUM,LA,INNEW(5),
-|> 2 NEBX(4,70),IV(6),RPLO(70),RPHI(70),
-|> 3 BESTID(70),BESTBA(70),OPTPPM
-|> COMMON /PASSCY/ CCULM(70),AASNAM(70),IIBATC(70), TRECUL(15,5),TREN
-|> 1AM(15,5),IREOPO(15,5)
-|> C
-|> DATA PAGE/0/
-|> DATA COSQNN/180*0./
-|> DATA DOLLAR/'$$'/
-|> DATA INNEW/11,12,13,19,24/
-|> DATA VERSIN /90.1/
-|> DATA TRECUL/75*0./,TRENAM/75*' '/,IREOPO/75*0/
-|> C DEFAULT MAX. NO. OF ITERATIONS
-|> DATA ITMAX/700/
-|> C DEFAULT OUTPUT OPTIONS
-|> CB DATA $PRTOP/1,10,0,-1,1,1,1,0,0,0,0,1,0,0,0/
-|> DATA $PRTOP/0, 0,0,-1,0,0,1,0,0,0,0,1,0,0,0/
-|> C DEFAULT BOUNDRY CONDITION ASSIGNMENTS
-|> DATA NLB/1/,NTB/1/,NRB/0/,NBB/0/
-|> C DEFAULT POWER MAP DATA
-|> DATA $MAP/8,7,6,4,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0/,$MXMP/6/
-|> END
-|>
-|>
-|>
-|This is not so simple, but may work if the existing source does not use
-|variables beginning with, say, "Z_" :
-|
-| (i) Run Fsplit on the sources;
-|
-| (ii) Run your fortran-77 compiler on each subroutine, collect a list of
-|variables starting with $. In each such, subroutine, replace $ by Z_;
-|add an integer type declaration for the variables tagged by the F-77
-|compiler.
-|
-|--mecej4

Mecej: Thanks. As it turns out there were only a handful of variables
beginning with Z. I used Kedit to view and change these to WZ...... .
Then, after double-checking witih Kedit subcommand; ALL /Z/,
I issued a global Kedit: CHANGE /$/Z/ * *

Moot point though since thte code violates the Standard in
many places by passing DP arrays to every type under the
sun (even Integer*2). G95 correctly rejects these illegal
but often prevelent parameter/argument mappings.

I don't have an F77 compiler; I use G95, Lahey LF95, and
Silverfrost under Windows and a plethora of comoilers under
Linux. I think my first post indicated that LF95 (no debugging
options) and Intel ifort compile the code witih no changes.
It runs the sample input and generates output that matches
the sampe output file. But I don't like working with such
messy code without first being able to use Lahey LF95
with debug options:
-chk(a,e,s,u,x) -chkglobal -g -pca -stchk -trace -nzero -o0 -trap diou

Thanks to all.
Skip

e p chandler

unread,
May 29, 2008, 1:45:48 PM5/29/08
to
On May 29, 8:59 am, Herman D. Knoble <SkipKnobleL...@SPAMpsu.DOT.edu>
wrote:

g95 does allow the dollar sign in identifiers if the -fdollar-ok
option is specified, however it is not allowed as the leading
character.

Perhaps some other text substitution like Q$ will work. Alas I have no
idea how to emulate

IMPLICIT INTEGER ($).

- e


GaryScott

unread,
May 29, 2008, 2:47:57 PM5/29/08
to

That's odd as the most common usage was as the first character.

>
> Perhaps some other text substitution like Q$ will work. Alas I have no
> idea how to emulate
>
> IMPLICIT INTEGER ($).
>

> - e- Hide quoted text -
>
> - Show quoted text -

John Harper

unread,
May 29, 2008, 6:40:41 PM5/29/08
to
In article <1ihp0t1.1wwsw6bist6d2N%nos...@see.signature>,

Richard Maine <nos...@see.signature> wrote:
>Herman D. Knoble <SkipKno...@SPAMpsu.DOT.edu> wrote:
>
>> What does the F77 Standard say about using the character, $ for the
>> beginning of a variable name?
>
>Nobody seems yet to have actually answered this question. The f77
>standard (and all other versions of the standard) doesn't allow it.
>
>I'm afraid I don't have any brilliant suggestions about how to fix such
>nonstandard code.

Because f95 allows longer names than f77, if the underscore wasn't in
the professor's character set, you could compile with f95 by changing
the offending $ into D_ at the cost of
(a) continuation lines wherever the code now went past space 72,
or (b) changing to free source form, which IMHO would need more work.

-- John Harper, School of Mathematics, Statistics and Computer Science,
Victoria University, PO Box 600, Wellington 6140, New Zealand
e-mail john....@vuw.ac.nz phone (+64)(4)463 6780 fax (+64)(4)463 5045

e p chandler

unread,
May 29, 2008, 7:16:13 PM5/29/08
to
On May 29, 6:40 pm, har...@mcs.vuw.ac.nz (John Harper) wrote:
> In article <1ihp0t1.1wwsw6bist6d2N%nos...@see.signature>,
>
> Richard Maine <nos...@see.signature> wrote:
> >Herman D. Knoble <SkipKnobleL...@SPAMpsu.DOT.edu> wrote:
>
> >> What  does the F77 Standard say about using the character, $ for the
> >> beginning of a variable name?
>
> >Nobody seems yet to have actually answered this question. The f77
> >standard (and all other versions of the standard) doesn't allow it.
>
> >I'm afraid I don't have any brilliant suggestions about how to fix such
> >nonstandard code.
>
> Because f95 allows longer names than f77, if the underscore wasn't in
> the professor's character set, you could compile with f95 by changing
> the offending $ into D_ at the cost of
> (a) continuation lines wherever the code now went past space 72,
> or (b) changing to free source form, which IMHO would need more work.
>

Even better (in the scheme of lesser of evils) would be I_ as a
replacement for a leading $. That way all of these would default to
type INTEGER - removing the need for IMPLICIT INTEGER ($).

- e

Terence

unread,
May 29, 2008, 7:35:35 PM5/29/08
to
Like my trusty MS F77 compilere, the CVF (Digital) compiler WILL
accept the dollar sign in all positions, since it as extension of F77,
but the manual DOES warn you about being careful since this use is not
generally supported (ie. is non-standard conforming).
A pity. They keep taking my toys away...

Gary Scott

unread,
May 29, 2008, 9:25:24 PM5/29/08
to
Terence wrote:

But, didn't you already know that it wasn't standard conforming?

--

Gary Scott
mailto:garylscott@sbcglobal dot net

Fortran Library: http://www.fortranlib.com

Support the Original G95 Project: http://www.g95.org
-OR-
Support the GNU GFortran Project: http://gcc.gnu.org/fortran/index.html

If you want to do the impossible, don't hire an expert because he knows
it can't be done.

-- Henry Ford

Terence

unread,
May 30, 2008, 12:37:11 AM5/30/08
to
Yes, Gary I did, but it's not I who posted the problem.
I NEVER used $ myself within a varibal name, but I DID look at the
manual just then...
The Toy I referred to was the total caution-free use of my F77
compiler which is now somewhat limited (just a tinsy-winsy bit: ports)
in what it can do on an NT or XP operating system.
I like quick clean coding and F77 gives it for far less effort than
anything else I have tried over the years. Pascal came close but I
found Fortran more flexible.

Ian Gay

unread,
May 30, 2008, 12:50:15 AM5/30/08
to
Herman D. Knoble wrote:

> On Thu, 29 May 2008 11:39:52 -0500, mecej4
> <mecej4_s...@operamail.com> wrote:
>
> -|Herman D. Knoble wrote:
> -|> What does the F77 Standard say about using the character, $ for
> the beginning of a
> -|> variable name?

[snip]

> I don't have an F77 compiler; I use G95, Lahey LF95, and
> Silverfrost under Windows and a plethora of comoilers under
> Linux. I think my first post indicated that LF95 (no debugging
> options) and Intel ifort compile the code witih no changes.
> It runs the sample input and generates output that matches
> the sampe output file. But I don't like working with such
> messy code without first being able to use Lahey LF95
> with debug options:
> -chk(a,e,s,u,x) -chkglobal -g -pca -stchk -trace -nzero -o0 -trap
> diou
>
> Thanks to all.
> Skip

Openwatcom have a free F77 compiler for windows. According to my oldish
language reference (unfortunately the current one is not on their
website) it accepts, as an extension, both $ and _ in variable names.

Ian


--
*********** To reply by e-mail, make w single in address **************

user1

unread,
May 30, 2008, 8:18:32 AM5/30/08
to

>
> Moot point though since thte code violates the Standard in
> many places by passing DP arrays to every type under the
> sun (even Integer*2). G95 correctly rejects these illegal
> but often prevelent parameter/argument mappings.
>

Are caller and callee in same source file ? Perhaps you could break it
up - each subprogram in a separate file, compile separately. Fsplit may
help.

Phillip Helbig---remove CLOTHES to reply

unread,
Jun 3, 2008, 9:41:14 AM6/3/08
to
In article <j96t34ds3chf1qjvl...@4ax.com>, Herman D.
Knoble <SkipKno...@SPAMpsu.DOT.edu> writes:

> What does the F77 Standard say about using the character, $ for the beginning of a
> variable name?

This is the only character in F77 which a) is explicitly allowed and b)
for which there is no example of its use. When I wrote F77, I always
used it as the continuation mark, since otherwise (except in CHARACTERs
and comments) I couldn't use it all. Also, it made continuations easy
to spot.

0 new messages