Software Archive
Read-only legacy content
17060 Discussions

Transferring program from a mainframe to a PC

Intel_C_Intel
Employee
278 Views
I am an engineer trying to compile and run a Fortran77 program from a mainframe onto a PC using CVF. I have been getting some reoccuring errors that I can debug individually, but tend to show up again later. The most common ones are:

severe(161): Program exception - array bounds exceeded
severe (64): Input conversion error

At first I assumed that they were formatting errors, and tried to adjust accordingly. I also upgraded hoping that could help as well. However, it appears that the formatting in both the input source and within the program correspond. I am wondering if there is anyone familiar with programs from mainframes that could suggest another approach to finally debugging this program. I have noticed several differences in the way that this was programmed 30 years ago as opposed to how I was taught.

Thanks for any input.
0 Kudos
5 Replies
Intel_C_Intel
Employee
278 Views
Hi,
If by mainframe you mean 370/390 and possibly VM, I've programmed in that environment for about 20 years. Aside for a VERY small number of extensions, VS FORTRAN is pretty much standard (IBM was never big on adding extensions, at least under VM). I would guess that this is a bug in the source code that simply wasn't detected by the mainframe compiler. I'd be happy to take a quick look if you have a souce extract for testing.
0 Kudos
Intel_C_Intel
Employee
278 Views
Array Bounds Exceeded - 30 years ago, Fortran compilers did not check array bounds, hence your program would have run without complaint on that score. What it was actually doing was reading or setting the value(s) of the next variable(s) along in memory, hence the program results might possibly be interesting, to say the least.

However, this phenomenom was actually used deliberately by some programmers, although it makes one cringe now. I inherited a program that read in data arrays by just such a technique - I use it still, although I have modified that part of it to be sanitary.

So my advice is to examine the program where it is halted by CVF at the first bounds exception and determine whether it is intentional or not. Your next step depends upon the answer. Please let us know of your progress - it brings back mixed memories!

Bear of little brain
0 Kudos
durisinm
Novice
278 Views
You may have the /check:bounds option set for your project. If you switch to /check:nobounds, then CVF shouldn't issue messages when your program exceeds an array's bounds.

If you think that exceeding array bounds is improper behavior, then stick with /check:bounds and find and correct the error. As the other respondents have already pointed out, this type of coding was (and still is) common. I support an application that contains a lot of "stupid Fortran tricks." It contains several arrays whose subscripts frequently take on negative values (which really grates on my nerves) as a way of addressing memory above the array in a COMMON block. It works, but I thinks it's bad programming.

Mike Durisin
0 Kudos
Intel_C_Intel
Employee
278 Views
I maintain several legacy programs which exceed the array bounds on purpose. One example is to zero out variables. This works for variables in common.
e.g.

REAL A(1000), B(300), C(450), D(250)
COMMON A,B,C,D
DO I=1,2000
A(I)=0.0
END DO

The above code sets arrays A, B, C and D to zero.

Your program may not have a bug. It may be exceeding the array bounds on purpose too.

Regards
0 Kudos
Intel_C_Intel
Employee
278 Views
After several aggravating days, I did manage to get the program to compile. It was mainly source code error that the main frame simply did not pick up, although many of the errors were probably done on purpose to conserve space. I did use the /check:nobounds suggestion, and it solved the array bounds problem. I also found that the previous programmer used Hollerinth characters incorrectly, and that was easily solved as well. Another interesting discovery was that the previous programmer declared EVERYTHING as Implicit real, even the characters. After declaring everything as the correct type and kind (mainly the characters), it ran smoothly. Thanks for all the suggestions!
0 Kudos
Reply