[comp.unix.cray] Unformatted data transfer..

suray@cs.tamu.edu (Subhankar Ray) (10/17/90)

Hello Everyone,

Here is a test program, where I was generating a file on YMP, named 
ibm( good for IBM) and then I moved it to IBM (under 
MVS/os) using   binary ftp. But when I was trying to make an 
unformatted read on IBM, it was
giving end of record ( or end of file depending on the recfm and lrecl 
modified by IEBGENER). Am I missing something ?

Subhankar Ray 

**********************************   test program **************************
                      program unformat
                      real a(100)
                      real aibm(100)
                      real cray(100)
                      parameter (length=100)
                   open (unit=10,file='cray',
     1                 form='unformatted')
                   open (unit=11,file='ibm',
     1                 form='unformatted')
c Initializing the array with some known values
                      do 100 i=1,100
                        a(i)= i
 100                  continue
                      write(10)a
c from cray to ibm conversion ******************
                      iret = cray2ibm(2,length,aibm,0,a,1)
                      if (iret.lt.0) write(*,*)'error'
                      write(11)aibm
c from IBM to Cray **********************
                      iret = ibm2cray(2,length,aibm,0,cray,1)
                      if (iret.lt.0) write(*,*)'error'
                      write(*,*)cray(100)              
                      stop 
                      end

karl@uts.amdahl.com (Karl Rowley) (10/19/90)

In article <9171@helios.TAMU.EDU> suray@cs.tamu.edu (Subhankar Ray) writes:
>
>Here is a test program, where I was generating a file on YMP, named 
>ibm( good for IBM) and then I moved it to IBM (under 
>MVS/os) using   binary ftp. But when I was trying to make an 
>unformatted read on IBM, it was
>giving end of record ( or end of file depending on the recfm and lrecl 
>modified by IEBGENER). Am I missing something ?
>

An unformatted file on the Cray contains other information besides the data.
Each record begins with a header that contains the length of the record.  This
is necessary to enforce the semantics of Fortran I/O.  I'll bet that the structure
of an unformatted file on your IBM machine is different from  that on the Cray, and
that this is the source of your problem.

If you can locate documentation of the structure of unformatted files on the two
machines, you could write a utility to do the translation.  Or, you could write
the data out in 'pure' binary form on the Cray by calling some C code, assuming 
that there is a way to then read the data on the IBM machine.

					Karl Rowley
					Amdahl Corp.
					Santa Clara, CA
					karl@uts.amdahl.com
					...!ames!amdahl!karl

hennebry@plains.NoDak.edu (Michael J. Hennebry) (10/19/90)

In article <9171@helios.TAMU.EDU> suray@cs.tamu.edu (Subhankar Ray) writes:
>Hello Everyone,
>
>Here is a test program, where I was generating a file on YMP, named 
>ibm( good for IBM) and then I moved it to IBM (under 
>MVS/os) using   binary ftp. But when I was trying to make an 
>unformatted read on IBM, it was
>giving end of record ( or end of file depending on the recfm and lrecl 
>modified by IEBGENER). Am I missing something ?

No doubt differences in IBM and Cray control information are causing the
problem. If you give IEBGENER RECFM=U, it should be able to read just
about anything. It will regard control info as just more data. U stands
for undefined. Some time ago, perhaps still, unformatted IBM FORTRAN
files had to be VBS, which means variable blocked spanned. Using IEBGENER
to copy the file from RECFM=U to VBS will give you a file that you can
examine with IBM FORTRAN and convert to something useful.

-- 
Mike    hennebry@plains.NoDak.edu
"Got any grim reapers?" -- Norm

booker@network.ucsd.edu (Booker bense) (10/22/90)

>In article <9171@helios.TAMU.EDU> suray@cs.tamu.edu (Subhankar Ray) writes:
>>Hello Everyone,
>>
>>Here is a test program, where I was generating a file on YMP, named 
>>ibm( good for IBM) and then I moved it to IBM (under 
>>MVS/os) using   binary ftp. But when I was trying to make an 
>>unformatted read on IBM, it was
>>giving end of record ( or end of file depending on the recfm and lrecl 
>>modified by IEBGENER). Am I missing something ?
>





Look into using the assign command under unicos. It will allow you to
tell the operating system that the file is to be written in IBM
format. It also supports vax and other formats. It's not the easiest
to figure out, but it's well worth digging into if you are doing lots 
of I/O. It can also speed up your code if you set things up correctly.

-Booker C. Bense
/* benseb@grumpy.sdsc.edu */