Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
* Changing record length of fixed record files
@ 1992-09-22 20:06 Przemek Klosowski
  1992-09-23 14:04 ` Dave Cantor
  1992-09-29 19:00 ` Changing record length of fixed record files (SUMMARY) Przemek Klosowski
  0 siblings, 2 replies; 5+ messages in thread
From: Przemek Klosowski @ 1992-09-22 20:06 UTC (permalink / raw)



Hello!

I am working on a problem that involves exchanging files between VMS
and Ultrix computers.  The data file is fixed record/320 byte on VMS
side; I copy it over to Ultrix, massage gently and send back to VMS
using binary mode (actually I open pipe to dcp -i if it matters).
Unfortunately, the file appears on the VMS side as fixed record/512
byte file, which does not do.

I was told by DEC telephone support that dcp is the only supported
DECnet tool between VMS and Ultrix, and it does not seem to allow
setting the VMS RMS parameters.  I therefore assume that I can't
transfer the file so that it ends up in the correct 320 byte record
length. Does anyone have better ideas for executing this transfer?

I have control over the FORTRAN program that reads the data on the VMS
side. Ideally, I would like to INQUIRE about the record length, and if
it is 512 (meaning that this particular file was received from
outside), I would like to change the record length.  I am able to do
this using the FILE utility from DCL; what I would like to do is to
change it on the fly from my program (code fragment to do that would
be appreciated)

I included comp.sys.dec in the distribution in a hope that maybe
someone could suggest another method of transferring the file that
would result in a correct VMS format, making the manipulations in the
above paragraph unnecessary.

Thank you for your help


--
			przemek klosowski (przemek@rrdstrad.nist.gov)
			Reactor Division (bldg. 235), E111
			National Institute of Standards and Technology
			Gaithersburg, MD 20899,      USA

			(301) 975 6249


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Changing record length of fixed record files
  1992-09-22 20:06 Changing record length of fixed record files Przemek Klosowski
@ 1992-09-23 14:04 ` Dave Cantor
  1992-09-23 15:16   ` Bill Parke
  1992-09-29 19:00 ` Changing record length of fixed record files (SUMMARY) Przemek Klosowski
  1 sibling, 1 reply; 5+ messages in thread
From: Dave Cantor @ 1992-09-23 14:04 UTC (permalink / raw)




In article <PRZEMEK.92Sep22160609@rrdstrad.nist.gov>, przemek@rrdstrad.nist.gov (Przemek Klosowski) writes...
> 
>Hello!
> 
>I am working on a problem that involves exchanging files between VMS
>and Ultrix computers.  The data file is fixed record/320 byte on VMS
>side; I copy it over to Ultrix, massage gently and send back to VMS
>using binary mode (actually I open pipe to dcp -i if it matters).
>Unfortunately, the file appears on the VMS side as fixed record/512
>byte file, which does not do.
> 
>I was told by DEC telephone support that dcp is the only supported
>DECnet tool between VMS and Ultrix, and it does not seem to allow
>setting the VMS RMS parameters.  I therefore assume that I can't
>transfer the file so that it ends up in the correct 320 byte record
>length. Does anyone have better ideas for executing this transfer?

I haven't tried this, but it should work:  On the VMS side, do:

   $ EXCHANGE/NETWORK ultrix::"filespec" filename.type

-- --
 Dave C.                          cantor@star.enet.dec.com
 Digital Equipment Corp., Nashua, NH  03062, USA
  The views expressed herein are my own, except where attributed to 
  someone else.  They are neither the opinion of, nor the responsibility 
  of, Digital Equipment Corporation.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Changing record length of fixed record files
  1992-09-23 14:04 ` Dave Cantor
@ 1992-09-23 15:16   ` Bill Parke
  1992-09-24  1:17     ` Blair Phillips - Digital
  0 siblings, 1 reply; 5+ messages in thread
From: Bill Parke @ 1992-09-23 15:16 UTC (permalink / raw)



In article <PRZEMEK.92Sep22160609@rrdstrad.nist.gov>, przemek@rrdstrad.nist.gov (Przemek Klosowski) writes...
> 
>Hello!
> 
>I am working on a problem that involves exchanging files between VMS
>and Ultrix computers.  The data file is fixed record/320 byte on VMS
>side; I copy it over to Ultrix, massage gently and send back to VMS
>using binary mode (actually I open pipe to dcp -i if it matters).
>Unfortunately, the file appears on the VMS side as fixed record/512
>byte file, which does not do.
> 
>I was told by DEC telephone support that dcp is the only supported
>DECnet tool between VMS and Ultrix, and it does not seem to allow
>setting the VMS RMS parameters.  I therefore assume that I can't
>transfer the file so that it ends up in the correct 320 byte record
>length. Does anyone have better ideas for executing this transfer?
>
You can use
	EXCHANGE/NETWORK u*x::file file
  from VMS
or

	dcp -a file vms-spec

  from the U*X side

NOTE:  -a (ascii transfer) is the default from U*X to somewhere else.

Bill
Bill Parke 			parke%star.enet.dec@decwrl.dec.com
VMS Development			decwrl!star.enet.dec.com!parke
Digital Equipment Corp		parke@star.enet.dec.com
110 Spit Brook Road ZK01-2/D59, Nashua NH 03063

The views expressed are my own.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Changing record length of fixed record files
  1992-09-23 15:16   ` Bill Parke
@ 1992-09-24  1:17     ` Blair Phillips - Digital
  0 siblings, 0 replies; 5+ messages in thread
From: Blair Phillips - Digital @ 1992-09-24  1:17 UTC (permalink / raw)



In article <1992Sep23.151618.21995@nntpd.lkg.dec.com>, parke@star.enet.dec.com (Bill Parke) writes:
>In article <PRZEMEK.92Sep22160609@rrdstrad.nist.gov>, przemek@rrdstrad.nist.gov (Przemek Klosowski) writes...
>> 
>>I am working on a problem that involves exchanging files between VMS
>>and Ultrix computers.  The data file is fixed record/320 byte on VMS
>>side; I copy it over to Ultrix, massage gently and send back to VMS
>>using binary mode (actually I open pipe to dcp -i if it matters).
>>Unfortunately, the file appears on the VMS side as fixed record/512
>>byte file, which does not do.
>> 
>You can use
>	EXCHANGE/NETWORK u*x::file file
>  from VMS

Actually, to preserve the 320 byte fixed length attribute, you will need to say

	EXCHANGE/NET/FDL=FIX320/TRANSFER=BLOCK unixhost::file file

You can generate the FDL file either by ANALYZE/RMS/FDL on the original file,
or by EDIT/FDL.

One possible version of FIX320.FDL is:
FILE
	ORGANIZATION		sequential
RECORD
	BLOCK_SPAN		yes
	CARRIAGE_CONTROL	none
	FORMAT			fixed
	SIZE			320
--
----------
Blair Phillips					Blair.Phillips@cao.mts.dec.com
Digital Equipment Corp (Aust) P/L		Phone: (+61 6) 2754874
Canberra, Australia				FAX  : (+61 6) 2473654
{Any opinions expressed are my own, not those of Digital Equipment Corporation}



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Changing record length of fixed record files (SUMMARY)
  1992-09-22 20:06 Changing record length of fixed record files Przemek Klosowski
  1992-09-23 14:04 ` Dave Cantor
@ 1992-09-29 19:00 ` Przemek Klosowski
  1 sibling, 0 replies; 5+ messages in thread
From: Przemek Klosowski @ 1992-09-29 19:00 UTC (permalink / raw)



Hello!

I asked how to conveniently change a record size of a binary VMS file
(the files contain 320-byte long records of VAX floating numbers, and
they were edited on a UNIX system and copied back with wrong record
size (512)). The editing process is asynchronous, and it is not
practical to initiate the copy from the VMS side---if it weren't so,
the task would have been easy, as there is a VMS utility that allows
one to copy data over the network and set the RMS structure of a resulting
file (EXCHANGE/NETWORK file/FDL=fdldescription).

Several people wrote me in response to my query (my thanks go to all
of them, listed later in this message). Some recommended creating a
template file with correct record lenght and using COPY/OVERLAY.
However, this works only when both original and new file have record
lengths that are a multiply of 512 bytes, which is not the case here.

Another idea was to use the PD FILE utility; it did not work for me,
because my version of FILE was compiled using GCC, and could only get
its parameters via a CLD mechanism; however, I had to call it as a
foreign command using lib$spawn().

Yet another idea that occurred to me was to use the EXCHANGE/NETWORK
utility for a _local_ file:
	lib$spawn(EXCHANGE/NETWORK OLDFILE NEWFILE/FDL=FIXED320) This
requires a use of an extra file (FIXED320.FDL) containing the PDL
description of a desired file format. Carl J Lydick
<carl@SOL1.GPS.CALTECH.EDU> suggested a way of sending this
descripiton directly to EXCHANGE via a mailbox; this, however, is
beyond the scope of this article.

Finally, dano@petrucio.ae.utexas.edu (Dano Carroll) sent me a Fortran
program that I enclose in part at the end that contains code to directly
manipulate the record length using the sys$modify call.


I thank those kind folks for their help and advice:

       pack@acd.ucar.edu  
     bengtl@maths.lth.se  
   murphy@decuac.DEC.COM  
     hudson@ug.cs.dal.ca  
 blue!garry@uunet.UU.NET  
          KARSTEN@tfl.dk  
 blair@snogum.enet.dec.com
   carl@SOL1.GPS.CALTECH  
dano@petrucio.ae.utexas.edu 


        Przemek Klosowski                               _----___
   ------------------------------------------------  ##=\ ^^ ^^ ^=====O-
        417 Muddy Branch Rd #203                         \ ^^  /
        Gaithersburg MD 20878                             |_^_|
        (301) 977 0046                                     VvV
     _______________________________________________________________
    |  przemek@ndcvx.cc.nd.edu     |      przemek@rrdstrad.nist.gov |
    |  Physics Department         and     NIST, Reactor Bldg #235   |
    |  U. of Maryland              |      Gaithersburg MD 20899     |
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



      OPTIONS /EXTEND_SOURCE
      call fixupfile('qbuffer.buf')
      end

Code obtained from: dano@petrucio.ae.utexas.edu (Dano Carroll); 
Changes the record length of a file via RMS calls. High wizardry.

      OPTIONS /EXTEND_SOURCE
      subroutine fixupfile(filename)
      character*(*) filename
      integer*4 lib$spawn, status, reclen 
 
      INCLUDE '($SYSSRVNAM)'
      INCLUDE '($FABDEF)/LIST'
      INCLUDE '($NAMDEF)/LIST'
      INCLUDE '($RMEDEF)/LIST'
      INCLUDE '($RMSDEF)/LIST'
      RECORD /FABDEF/ MYFAB
      RECORD /NAMDEF/ MYNAM
      byte  RESNAME(NAM$C_MAXRSS), EXPNAME(NAM$C_MAXRSS)   
C
C	Set file attribute block values
C
      MYFAB.FAB$B_BID = FAB$C_BID
      MYFAB.FAB$B_BLN = FAB$C_BLN
      MYFAB.FAB$L_FNA = %LOC(FILENAME)

      MYFAB.FAB$B_FNS = LENGTH(FILENAME)

      MYFAB.FAB$B_FAC = FAB$M_PUT
      MYFAB.FAB$L_FOP = IOR(FAB$M_ESC,MYFAB.FAB$L_FOP)
      MYFAB.FAB$L_FOP = IOR(FAB$M_NAM,MYFAB.FAB$L_FOP)
      MYFAB.FAB$L_CTX = IOR(RME$C_SETRFM,MYFAB.FAB$L_CTX)
      MYFAB.FAB$W_IFI = 0
      MYFAB.FAB$L_NAM = %LOC(MYNAM)
      MYNAM.NAM$B_BID = NAM$C_BID
      MYNAM.NAM$B_BLN = NAM$C_BLN
      MYNAM.NAM$L_RSA = %LOC(RESNAME)
      MYNAM.NAM$B_RSS = NAM$C_MAXRSS
      MYNAM.NAM$L_ESA = %LOC(EXPNAME)
      MYNAM.NAM$B_ESS = NAM$C_MAXRSS
C
C	Parse the file specification
C
      STATUS = SYS$PARSE(MYFAB)
      IF ( .NOT. STATUS ) CALL LIB$SIGNAL(%VAL(STATUS))
C
C	Search for the file
C
      STATUS = SYS$SEARCH(MYFAB)
      IF ( .NOT. STATUS ) CALL LIB$SIGNAL(%VAL(STATUS))
C
C	  Open the file
C
      STATUS = SYS$OPEN(MYFAB)
      IF ( .NOT. STATUS ) CALL LIB$SIGNAL(%VAL(STATUS))
      if (MYFAB.FAB$W_MRS .eq. 512) then
c         presumably file was copied over; convert record length
c         to Beat's 80*4 = 320
C	  It will be in bytes (not longwords), unlike in other places
C
         MYFAB.FAB$W_MRS = 320
         STATUS = SYS$MODIFY(MYFAB)
         IF ( .NOT. STATUS ) CALL LIB$SIGNAL(%VAL(STATUS))
      else 
         if (MYFAB.FAB$W_MRS .ne. 320) then
            type *,'-W- File QBUFFER.BUF has weird record length'
         endif
      endif
C     
C     Close the file
C     
      STATUS = SYS$CLOSE(MYFAB)
      IF ( .NOT. STATUS ) CALL LIB$SIGNAL(%VAL(STATUS))

      end

--
			przemek klosowski (przemek@rrdstrad.nist.gov)
			Reactor Division (bldg. 235), E111
			National Institute of Standards and Technology
			Gaithersburg, MD 20899,      USA

			(301) 975 6249


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1992-09-29 19:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1992-09-22 20:06 Changing record length of fixed record files Przemek Klosowski
1992-09-23 14:04 ` Dave Cantor
1992-09-23 15:16   ` Bill Parke
1992-09-24  1:17     ` Blair Phillips - Digital
1992-09-29 19:00 ` Changing record length of fixed record files (SUMMARY) Przemek Klosowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox