HP OpenVMS Systemsask the wizard |
The Question is:
Good morning,
I am having a problem altering an indexed file. The file was
created and is modified by a fortran program that was written
10 years ago. Unfortunately the update component is not updating
the file correctly. Specifically it is not updating a single
entry that I need to replace. Basically all I need to do is replace
a users's seven character last name (appended to a 9 character
id). The file will not function as a sequential file because the
fortran programs that created it will only deal with it as an
indexed file. Any attempt to edit it (a copy) results in a
sequential file that cannot be reconverted to an indexed file.
I played some games with setting the file attributes and rms.fdl
files, so that I could edit that one entry, but the bottom line
seems to be if I convert it to a sequential file I can't reconvert
it. I'd rather not approach it from the fortran side if I can
help it.
Is there any easy way I can change that one entry without rewriting
several programs. Isw there any sort of configurable editor for this
kind of thing?
Here's what the file looks like. I would appreciate any help.
IDNUMS.DAT;1 File ID: (15487,1,0)
Size: 49620/49620 Owner: [ACS_PRIV,OVERHEAD]
Created: 11-OCT-1988 14:46:57.91
Revised: 9-JUN-1999 11:18:17.96 (3862)
Expires: 17-JAN-2025 10:17:02.23
Backup: 7-JUN-1999 14:38:15.10
Effective: <None specified>
Recording: <None specified>
File organization: Indexed, Prolog: 3, Using 1 key
Shelved state: Online
File attributes: Allocation: 49620, Extend: 0, Maximum bucket size: 1
Global buffer count: 0, No version limit
Record format: Fixed length 35 byte records
Record attributes: Fortran carriage control
RMS attributes: None
Journaling enabled: None
File protection: System:RWED, Owner:RWE, Group:RWE, World:
Access Cntrl List: None
Total of 1 file, 49620/49620 blocks.
Thanks for your assistance,
Don Perreault
The Answer is :
The OpenVMS Wizard suspects the value you are trying to change is the
primary key for a record. RMS indexed files do NOT allow this. The
official solution is to read the record reserving the data within the
application, delete the record, and then change the key and create a
record with the fresh value.
After a bit of practice on a copy of the file, you can perform this
operation entirely using DCL:
$ OPEN/READ/WRITE [/SHARE=WRITE] file IDNUMS.DAT
$ READ/KEY="xxxx" file record
$ SHOW SYMBOL record ! The correct record?
$ READ/KEY="xxxx"/DELETE file record
$ record = "yyyy" + F$EXTRACT(4,999,record) ! Or whatever is needed
$ WRITE record file
You can also perform these changes from within a text editor, as long as
you remember to re-convert the file back to an indexed file when done:
$ ANAL/RMS/STAT/FDL/OUT=idnums idnums.dat
$ CONV/FDL=nl:[/SHARE] idnums.dat idnums.seq ! Optional, really.
$ EDIT idnums.seq ! make the changes
$ CONV/STAT/FDL=idnums idnums.seq idnums.dat
Your file specification listing "Created: 11-OCT-1988 14:46:57.91" and
"Revised: 9-JUN-1999 11:18:17.96 (3862)" indicates this file is long
overdue for a CONVERT. The other file attributes also tend to indicate
that this file is long overdue for an optimization pass as well.
Suggestions:
o OPTIMIZE the file using the command EDIT/FDL/NOINTER isdnum.FDL,
before performing the CONVERT.
o CONVERT the file, whether it needs it or not.
|