Go Back   CodingForums.com > :: Computing & Sciences > Computer Programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-21-2003, 03:44 AM   PM User | #1
Spookster
Supreme Overlord


 
Spookster's Avatar
 
Join Date: May 2002
Location: Marion, IA USA
Posts: 6,234
Thanks: 4
Thanked 81 Times in 80 Posts
Spookster will become famous soon enough
Global variables in FORTRAN

Ok where are all the old folks at? Yeah you old timers that grew up learning Fortran back in the 50's.

How are global variables in Fortran declared? Do you just declare them outside any functions for them to be global or is there some keyword I need to use?
__________________
Spookster
CodingForums Supreme Overlord
All Hail Spookster
Who gave you that Ugging infraction? Yeah that's right it was me!

Last edited by Spookster; 01-21-2003 at 03:49 AM..
Spookster is offline   Reply With Quote
Old 01-21-2003, 03:53 AM   PM User | #2
Spookster
Supreme Overlord


 
Spookster's Avatar
 
Join Date: May 2002
Location: Marion, IA USA
Posts: 6,234
Thanks: 4
Thanked 81 Times in 80 Posts
Spookster will become famous soon enough
I'm using Fortran77 by the way.
__________________
Spookster
CodingForums Supreme Overlord
All Hail Spookster
Who gave you that Ugging infraction? Yeah that's right it was me!
Spookster is offline   Reply With Quote
Old 01-21-2003, 05:07 AM   PM User | #3
Spookster
Supreme Overlord


 
Spookster's Avatar
 
Join Date: May 2002
Location: Marion, IA USA
Posts: 6,234
Thanks: 4
Thanked 81 Times in 80 Posts
Spookster will become famous soon enough
Ok after much digging I found the answer. Using the COMMON block statement allows one to share variables among different functions/subroutines:

http://www.obliquity.com/computer/fortran/common.html
__________________
Spookster
CodingForums Supreme Overlord
All Hail Spookster
Who gave you that Ugging infraction? Yeah that's right it was me!
Spookster is offline   Reply With Quote
Old 01-23-2003, 08:28 AM   PM User | #4
Spookster
Supreme Overlord


 
Spookster's Avatar
 
Join Date: May 2002
Location: Marion, IA USA
Posts: 6,234
Thanks: 4
Thanked 81 Times in 80 Posts
Spookster will become famous soon enough
And by the way I just spent the last week learning Fortran so if anybody has questions on Fortran, ask away.

Next week I will learn COBOL, then the next week Shell scripting, then Prolog, then LISP.
__________________
Spookster
CodingForums Supreme Overlord
All Hail Spookster
Who gave you that Ugging infraction? Yeah that's right it was me!
Spookster is offline   Reply With Quote
Old 01-25-2003, 12:18 AM   PM User | #5
CRASH_OVERRIDE
Regular Coder

 
Join Date: Aug 2002
Location: IN, USA
Posts: 121
Thanks: 0
Thanked 0 Times in 0 Posts
CRASH_OVERRIDE is an unknown quantity at this point
Why would you need to learn all of those languages- I thought they were ancient.
__________________
Just call me Crash...
"Crash- and BURN!"
-Cereal Killer
CRASH_OVERRIDE is offline   Reply With Quote
Old 01-25-2003, 11:33 PM   PM User | #6
Spookster
Supreme Overlord


 
Spookster's Avatar
 
Join Date: May 2002
Location: Marion, IA USA
Posts: 6,234
Thanks: 4
Thanked 81 Times in 80 Posts
Spookster will become famous soon enough
Yes they are all pretty old. Especially Fortran. Why learn them?

1. These old languages were the basis for all future languages. Learning those will make learning other newer languages easier.

2. Many businesses do still use languages like Fortran and Cobol. Especially Cobol. Lisp is the most widely used language for AI.

3. They are all required for my bachelors degree in computer science.

__________________
Spookster
CodingForums Supreme Overlord
All Hail Spookster
Who gave you that Ugging infraction? Yeah that's right it was me!
Spookster is offline   Reply With Quote
Old 01-26-2003, 12:09 PM   PM User | #7
scroots
Senior Coder

 
Join Date: Jun 2002
Location: UK
Posts: 1,137
Thanks: 0
Thanked 0 Times in 0 Posts
scroots is an unknown quantity at this point
Also there is a shortage of cobol programmers so if you can do it you can earn big bucks.

scroots
__________________
Spammers next time you spam me consider the implications:
(1) that you will be persuaded by me(in a legitimate mannor)
(2)It is worthless to you, when i have finished
scroots is offline   Reply With Quote
Old 01-27-2003, 08:59 PM   PM User | #8
ScottInTexas
Regular Coder

 
Join Date: Nov 2002
Posts: 567
Thanks: 2
Thanked 4 Times in 4 Posts
ScottInTexas is on a distinguished road
Don't forget Pascal, Forth and Ada.

I mean, we wouldn't want to leave anyone out.

When I took Fortran IV I was also learning Compiled Basic on the new Vax 11/780 (Super hot stuff!), and I'm not that old! Even so, I couldn't have given you the answer without diggin through my books or old programs.

Scott
__________________
Scott Stewart
Always happy to learn from pros.
ScottInTexas is offline   Reply With Quote
Old 01-10-2007, 05:05 PM   PM User | #9
ALMAR
New to the CF scene

 
Join Date: Jan 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
ALMAR is an unknown quantity at this point
External variables in FORTRAN

Quote:
Originally Posted by Spookster View Post
Ok after much digging I found the answer. Using the COMMON block statement allows one to share variables among different functions/subroutines:

http://www.obliquity.com/computer/fortran/common.html
Hey there!
I've found your comment by browsing i-net.
Problem is the next: when I making main program in Fortran by that manner for defining common blocks it conflicts with the _main() C++ program.

I trying to make mixed C++\Fortran program, for usage old Fortran modules. There no problem with functions an local variables, but in the case of global variables - need help!
ALMAR is offline   Reply With Quote
Old 01-16-2007, 03:37 AM   PM User | #10
DavidB
New Coder

 
Join Date: May 2006
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
DavidB is an unknown quantity at this point
Quote:
Originally Posted by Spookster View Post
And by the way I just spent the last week learning Fortran so if anybody has questions on Fortran, ask away.
This post is pretty old; is your offer still open?

I often translate FORTRAN programs into C++ and Javascript. To help me understand what a program does, I have downloaded and installed the OpenWATCOM compiler. One small piece of code I have recently come across has me puzzled: the FORTRAN 77 program uses a variable "L" without declaring it anywhere. Does FORTRAN default undeclared variables to a particular type?

Regards.


David
DavidB is offline   Reply With Quote
Old 01-16-2007, 08:50 PM   PM User | #11
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,530
Thanks: 0
Thanked 503 Times in 494 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
Fortran defaults variables starting with I, J, K, L, and M to integer and everything else to float. That is why I is the variable usually chosen to control loops since it was the shortest variable name to use as a loop control that comes earliest in the alphabet.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Old 02-24-2012, 08:32 PM   PM User | #12
badddad
New to the CF scene

 
Join Date: Feb 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
badddad is an unknown quantity at this point
Yeah but why were they chosen like that in the first place? Because those letters (as lower case subscripts) are used in mathematics all the time! Implementing mathematical algorithms was the design principle behind FORmula TRANslator in the first place
badddad is offline   Reply With Quote
Old 02-24-2012, 08:43 PM   PM User | #13
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,530
Thanks: 0
Thanked 503 Times in 494 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
Quote:
Originally Posted by scroots View Post
Also there is a shortage of cobol programmers so if you can do it you can earn big bucks.
Only if you live in India and only relative to what other Indians earn. All the CoBOL jobs went to India about ten years ago when companies realised how much cheaper it was. They had employed the Indians to work on Y2K in order to get the necessary hundreds of extra staff needed for that project at an affordable price and once it was finished it was basically the local staff who were let go and the Indians retained to maintain the systems.

The more programming languages that you know the easier it is to learn additional similar languages and to make sens of code in languages that you don't know. After learning the first language in any given programming style it becomes easier to learn additional programs that use that style. If is the first procedure based, object oriented, rules based etc language that is the hardest to learn. Just to know one of each type of language would mean learning a dozen or more different languages. I know languages in each of the three styles mentioned but not any of the others. Fortran was the first language I learnt - back in the mid 70s before I had access to a computer.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Old 02-24-2012, 09:04 PM   PM User | #14
tracknut
Regular Coder

 
Join Date: Aug 2006
Posts: 906
Thanks: 4
Thanked 212 Times in 211 Posts
tracknut is an unknown quantity at this point
I can certainly attest to the "new type of language" issue. Some of the hardest languages I ever learned were SNOBOL (string oriented), APL (sort of a mathematical symbol language), LISP (a language for people fond of parentheses), and JAM (to program the Xerox Star, with a stack as the only memory available).

For me at least, any of these were harder than C or Assembly, because they were different enough that normal assumptions about programming didn't always apply.

Dave
tracknut is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:07 PM.


Advertisement
Log in to turn off these ads.