* VAX->UNIX FORTRAN PORTING PROBLEM!
@ 1996-07-09 4:00 speck
1996-07-10 4:00 ` Jack Patteeuw
0 siblings, 1 reply; 2+ messages in thread
From: speck @ 1996-07-09 4:00 UTC (permalink / raw)
To anyone who can be of assistance:
I am currently have a rather nasty time of porting a piece of VAX Fortran
code to SPARC Fortran on a SUN Sparcstation. The piece of code in question
opens a file, writes to it, and closes the file. When this program is
run on a VAX, after its completion, a procedure is invoked which copies the
data file (created during the run of the Fortran program) via RCP from one
VAX disk to another VAX disk. Another VAX Fortran program is then run,
which uses the newly created data file as input.
When I run the UNIX version of the Fortran program, the data file is
created. Upon terminating, I then have a C-shell script on the UNIX
system, which performs the RCP of the data file to the VAX disk. The
other VAX Fortran program is then run, which uses this data file as
input. However, the VAX program chokes on the file and traces back with
a stack dump.
I am hoping to modify the UNIX Fortran code to properly create the file
in the first place, such that, when the file is RCP'd to the VAX disk,
the file has the proper form to serve as input to the VAX Fortran program.
Here is the File I/O code in the original VAX FORTRAN:
______________________________________________________
OPEN STATEMENT:
______________
OPEN(UNIT=IUNIT,FILE=NAME.TEXT,RECL=16300,STATUS='NEW',
1 ERR=30,RECORDTYPE='VARIABLE',IOSTAT=IOERROR)
LATER ON, A WRITE STATEMENT:
___________________________
C If the buffer for the Guide Star File is full then re-calculate
C the Current_Place pointer, write that buffer to the Guide Star File
C and if the Overflow Buffer was used then move that data to the
C main buffer
C
IF ((CURRENT_PLACE + I) .GE. 16300) THEN
CURRENT_PLACE = (COUNT+CURRENT_PLACE) - 16300
WRITE(IUNIT,10,ERR=40,IOSTAT=IOERROR)MAIN_BUFFER <-------- WRITE
MAIN_BUFFER = ' '
IF (USE_AUX) THEN
MAIN_BUFFER(1:CURRENT_PLACE) = AUX_BUFFER(1:CURRENT_PLACE)
AUX_BUFFER = ' '
END IF
LATER ON, THE FILE IS CLOSED:
____________________________
C If a request has been made to close the Guide Star File and
C the main buffer is empty then just close the file
C
IF ((GS_REQ_DATA.CLOSE_REQUEST_FIL .EQ. '1') .AND. (MAIN_BUFFER .EQ.
1 BLANK_REC)) THEN
CLOSE (UNIT=IUNIT,STATUS='SAVE',ERR=50,IOSTAT=IOERROR)
END IF
OR ELSE, MORE DATA IS WRITTEN USING "FUNKY" FORMAT STATEMENT 15 AND IS CLOSED:
______________________________________________________________________________
C
C If a request has been made to close the Guide Star File and
C the main buffer is not empty then write that last buffer to
C the Guide Star File and then close the file
C
IF ((GS_REQ_DATA.CLOSE_REQUEST_FIL .EQ. '1') .AND. (MAIN_BUFFER .NE.
1 BLANK_REC)) THEN
WRITE(IUNIT,15,ERR=40,IOSTAT=IOERROR) MAIN_BUFFER(1:CURRENT_PLACE)
CLOSE(UNIT=IUNIT,STATUS='SAVE',ERR=50,IOSTAT=IOERROR)
ENDIF
FORMAT STATEMENTS:
__________________
10 FORMAT (A16300)
15 FORMAT(<CURRENT_PLACE>A)
______________________________________________________________
I compiled this subroutine with SPARC Fortran, and the compiler complained that
RECORDTYPE='VARIABLE' is not supported, so I eliminated it from the open
statement. The routine then compiled. When I eventually ran the program,
I was told, via a screen message created by the Fortran compiler, that because
the file was opened for sequential access, the RECL=16300 qualifier is being
ignored. So, I also eliminated the RECL=16300 part of the open statement:
NEW OPEN STATEMENT:
__________________
OPEN(UNIT=IUNIT,FILE=NAME.TEXT,STATUS='NEW',ERR=30,IOSTAT=IOERROR)
___________________________
When I ran the VAX version of the program, followed by the UNIX version, I
then copied the newly created data files (2, 1 from VAX run, 1 from UNIX run)
onto a VAX disk. I then did a DIRECTORY/FULL on both files, and this is what
I got:
VAX-CREATED FILE:
________________
GSRQ24914.DAT;1 File ID: (20078,20078,0)
Size: 20/20 Owner: [SPECK]
Created: 9-JUL-1996 16:25:48.50
Revised: 9-JUL-1996 16:25:48.50 (1)
Expires: <None specified>
Backup: <No backup recorded>
Effective: <None specified>
Recording: <None specified>
File organization: Sequential
Shelved state: Online
File attributes: Allocation: 20, Extend: 0, Global buffer count: 0
No version limit
Record format: Stream_LF, maximum 0 bytes, longest 0 bytes
Record attributes: Carriage return carriage control
RMS attributes: None
Journaling enabled: None
File protection: System:RWED, Owner:RWD, Group:R, World:R
Access Cntrl List: None
Total of 1 file, 20/20 blocks.
UNIX-CREATED FILE:
_________________
GSRQ24914.DAT;1 File ID: (64872,8,0)
Size: 20/27 Owner: [GSDEVT]
Created: 9-JUL-1996 17:02:25.00
Revised: 9-JUL-1996 17:02:25.45 (1)
Expires: <None specified>
Backup: <No backup recorded>
Effective: <None specified>
Recording: <None specified>
File organization: Sequential
Shelved state: Online
File attributes: Allocation: 27, Extend: 0, Global buffer count: 0
No version limit
Record format: Stream_LF, maximum 0 bytes, longest 0 bytes
Record attributes: Carriage return carriage control
RMS attributes: None
Journaling enabled: None
File protection: System:RWE, Owner:RWED, Group:RWED, World:RE
Access Cntrl List: None
Total of 1 file, 20/27 blocks.
__________________
I noticed that the UNIX-created file (I'll call it UFILE from now on, the
VAX-created file "VFILE") has a different record format, a different
record attribute, and a different record format (longest 0 bytes for UFILE,
longest 9994 bytes for VFILE).
So, I tried performing the following 3 attributes conversions on the UFILE,
while it sat on the VAX disk:
SET FILE/ATT=(RAT:FTN)
SET FILE/ATT=(RFM:VAR)
SET FILE/ATT=(LRL:9994)
Then, when I did a dir/full on the UFILE again, I got:
GSRQ24914.DAT;1 File ID: (64872,8,0)
Size: 20/27 Owner: [GSDEVT]
Created: 9-JUL-1996 17:02:25.00
Revised: 9-JUL-1996 17:02:25.45 (1)
Expires: <None specified>
Backup: <No backup recorded>
Effective: <None specified>
Recording: <None specified>
File organization: Sequential
Shelved state: Online
File attributes: Allocation: 27, Extend: 0, Global buffer count: 0
No version limit
Record format: Variable length, maximum 0 bytes, longest 9994 bytes
Record attributes: Fortran carriage control
RMS attributes: None
Journaling enabled: None
File protection: System:RWE, Owner:RWED, Group:RWED, World:RE
Access Cntrl List: None
Total of 1 file, 20/27 blocks.
______________________
I thought, GREAT, the file attributes of VFILE and UFILE now MATCH, so my
VAX Fortran program should be able to access either file. WRONG! It
stack-dumped on the UFILE. I then did wrote a C program which opens both
files and compares them, byte for byte with each other. What I found was
VAX-FILE ASCII VALUE UNIX-FILE ASCII VALUE
BYTE OFFSET
INTO FILE
0 10 32
1 32 32
2 32 50
3 32 52
4 32 ...
5 50
6 52
...
Notice that there is no line-feed at the start of UFILE, and two of the
"32" values (SPACES) are missing in UFILE! I then ran my byte-for-byte
comparison C-program on the ORIGINAL UNIX-FILE on the VAX disk (before
the attributes conversion), and I got:
VAX-FILE ASCII VALUE UNIX-FILE ASCII VALUE
BYTE OFFSET
INTO FILE
0 10 (line-feed) 32 (space)
1 32 32
2 32 32
3 32 32
4 32 32
5 50 50
6 52 52
... ...
9992 32 32
9993 32 32
9994 13 (carriage-return) 10 (line-feed)
Do you have any suggestions as to what I could do to remedy this situation?
Assume that I CAN'T change the VAX Fortran program which accesses the newly
created VFILE or UFILE. However, file manipulations are allowed within the
SPARC UNIX Fortran program, and I am allowing for file attributes conversions
after the file is copied from UNIX disk to VAX disk.
Thanks for any help,
Scott
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: VAX->UNIX FORTRAN PORTING PROBLEM!
1996-07-09 4:00 VAX->UNIX FORTRAN PORTING PROBLEM! speck
@ 1996-07-10 4:00 ` Jack Patteeuw
0 siblings, 0 replies; 2+ messages in thread
From: Jack Patteeuw @ 1996-07-10 4:00 UTC (permalink / raw)
In article <1996Jul9.172242@stsci.edu>, speck@stsci.edu writes:
>
>
>To anyone who can be of assistance:
>
>I am currently have a rather nasty time of porting a piece of VAX Fortran
>code to SPARC Fortran on a SUN Sparcstation. The piece of code in question
>opens a file, writes to it, and closes the file. When this program is
>run on a VAX, after its completion, a procedure is invoked which copies the
>data file (created during the run of the Fortran program) via RCP from one
>VAX disk to another VAX disk. Another VAX Fortran program is then run,
>which uses the newly created data file as input.
Are you absolutely positive that the file was copied using RCP, seeing as
RCP is not a standard VMS command. the COPY command is used to copy files
between different disk drives on the same machine as well as for copying
files over a DECnet network to another VAX. For that matter even in UNIX, rcp
would only be used for network copying.
<much deleted>
Well the bad news is "you can't get there from here !" On top of that you
you have actually broken the old program on the VAX.
Without going into gorry detail (which you will have to do if you really
want to make this work), VMS has an extra "layer" of information inside the
file placed there by something called Record Management Services (RMS).
RMS understands things like records, be they variable, fixed, or fixed with
variable control. UNIX doesn't like to deal with records.
You have two options. Rewrite the second program that read that data which
is now formatted differently or hire someone who really knows VMS, RMS and
UNIX Fortran applications and fix the first program to emulate RMS. I
guess the third option is for you to learn a lot more about VMS than you
already know, but I'll bet you don't want to do that !!
Jack Patteeuw
My opinions are my own and not my employer's, my wife's, or my children !
"I used to do VMS, Stolen from a good friend:
Now I do Unix; "A mind is like a parachute ...
It's a living" It only works when it is open !"
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1996-07-10 4:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-07-09 4:00 VAX->UNIX FORTRAN PORTING PROBLEM! speck
1996-07-10 4:00 ` Jack Patteeuw
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox