home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!wupost!usc!cs.utexas.edu!rutgers!news.cs.indiana.edu!arizona.edu!hopey.telcom.arizona.edu!doug
- From: doug@hopey.telcom.arizona.edu (Doug Wellington USGS)
- Newsgroups: comp.lang.fortran
- Subject: SOLVED: Common block problem with MS-FORTRAN
- Message-ID: <31DEC199216134211@hopey.telcom.arizona.edu>
- Date: 31 Dec 92 23:13:00 GMT
- Distribution: world,local
- Organization: University of Arizona Telecommunications
- Lines: 19
- Nntp-Posting-Host: hopey.telcom.arizona.edu
- News-Software: VAX/VMS VNEWS 1.41
-
- I solved the problem with the common block crossing the segment
- barrier by counting all of the bytes in all of the items in the
- common block and padding so that no variable actually lay "on top"
- of the end of the segment.
-
- In this case, I had several arrays of CHARACTER and INTEGER that
- added up to a total of 44000 bytes. Then I had an array of CHARACTER*30
- that took the total up to 74000. (All of the arrays had 1000 elements.)
- 64K comes out to 65536 bytes, so I subtracted the 44000 from that which
- left 21536, then I divided by 30 (for each element in the CHARACTER*30).
- That gave me 717 with a remainder of 26. (Aha!) That meant that the 718th
- element had 26 characters in the first segment and 4 in the second. So
- the solution was to add one CHARACTER*26 in front of the whole array of
- CHARACTER*30, so that the 718th element actually started in the second
- segment. Sheesh!
-
- Thanks to everyone who replied. I tossed the mail already, so I'm sorry
- I can't thank people by name, but you guys know who you are. Thanks again!
- -Doc
-