VMS to Windows

VMS to Windows

Read with interest knowledge base article Q1022 as referred to in response to ?VMS to Windows2000?.
I compiled the segmented_to_unix.for program on Alpha/VMS.
Noticed that the compiler warned about overflow when compiling the line

RAB1.RAB$W_USZ = SIZEOF(BUFFER1)

Still it seemed to work for the test cases that I tried.

Then I included this piece of code in a utility program that can be used to convert our two most common binary, segmented file types including conversion from VAX-floating to ?Little_Endian?.
What then happened was that I got a run-time overflow in the same location.
So I just replaced the statement above with

RAB1.RAB$W_USZ = -32766

instead. Why? Only because that was the value of it in the debugger when it stopped and then I ?continued from a severe error? and it worked?

I am very certain that this can be made in cleverer way but all my test cases have worked so far?
Is what I have done unharmful for this case?

LarsM

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

The reason you see the problem is the program is trying to stuff a value which is larger than the maximum signed word into a signed word. The value is 32770 which is fine if represented by a signed longword, but this overflows the sign bit for a signed word, thus the error. However RMS treats it as an unsigned so it works, and what you have done won't hurt anything.

If you aren't using the Fortran 77 compiler you could also change the statement to something like:

RAB1.RAB$W_USZ = TRANSFER (SIZEOF(BUFFER1), RAB.RAB$W_USZ)

or compiling with /check=nooverflow.

James

Thanks James!
I took your suggestion and it seems to work just fine.

Now I want to go the other way (Windows to VMS) and referring to the same knowledge base article one should be able to compile the "unix_to_segmented.for" program using VF but the INCLUDE statements like

INCLUDE '($SYSSRVNAM)'
INCLUDE '($FABDEF)'
INCLUDE '($XABDEF)'
INCLUDE '($XABFHCDEF)'

won't compile. Is there a preprocessor path that I should set so that the compiler can find the files or should the statements be changed to fit the Windows environment? Any help will be appreciated.

LarsM

All those "unformatted conversion" programs are for VMS only - they won't compile or run on Windows.

Steve

Steve - Intel Developer Support

Leave a Comment

Please sign in to add a comment. Not a member? Join today