* 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 (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