Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2007 06:20 PM
07-25-2007 06:20 PM
I want to open a file & retreive the desired record. Then, i will update the particular field into the same record & write back to the file.
Could anyone provide the DCL example to me how to update the particular field into the same record & write back to the file?
Thanks,
Sentosa
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2007 06:31 PM
07-25-2007 06:31 PM
SolutionFor an RMS indexed file using DCL as language it could look like (untested):
$key="xyz"
$open/read/write file name.ext
$read/key=&key file record
$write sys$output "old text: ", f$ext(20,10,record)
$write sys$output "old binary: ", f$cvsi(30*8,32,record)
$record[20,10] := "new text value"
$record[30*8,32] = 12345 ! New binary value
$write/update/symbol file record
$close close
hth,
Hein van den Heuvel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2007 07:35 PM
07-25-2007 07:35 PM
Re: DCL
Sorry for missing some information.
the source & target file is normal text file in OpenVMS.
Thanks,
Sentosa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2007 07:48 PM
07-25-2007 07:48 PM
Re: DCL
>>>
the source & target file is normal text file in OpenVMS.
>>>
You will have to use some tool then.
You want to replace any occurrence of
$ create modify.edt
s?
exit
$
$ edit/edt
- oldstring or newstring contains a questionmark "?", then replace "?" in the EDT file with another character, eg "/" or "#"
- if you only need to replace 1 occurrence, leace out the "wh" ( = whole ) in the s ( = substitute ) command
- if targetfile is just a higher version of sourcefile, leave out the filename on the exit command.
Far, and far more is possible, but you will need the manual for that.
--- EDT is one possibility, there are many more.
EDT has the advantage to be available on ANY VMS system, without any extra software, I have used it since VMS V3.
hth
Proost.
Have one on me.
jpe
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2007 08:10 PM
07-25-2007 08:10 PM
Re: DCL
Actually, i need to do the (update) action in batch mode using DCL for handling different suitation. So, edit mode is not suitable for me.
Regards,
Sentosa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2007 09:23 PM
07-25-2007 09:23 PM
Re: DCL
On a sequential file you can use a similar aproach as Hein give you for an indexed file:
$open/read/write file name.ext
$loop:
$read file record /end=end
$if ... (put some test for which record should b updated)
$then
$ write sys$output "old text: ", f$ext(20,10,record)
$ write sys$output "old binary: ", f$cvsi(30*8,32,record)
$ record[20,10] := "new text value"
$ record[30*8,32] = 12345 ! New binary value
$ write/update/symbol file record
$endif
$goto loop
$end:
$close file
The length of the new record must remain the same as the old record for all sequential files!
Bojan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2007 09:23 PM
07-25-2007 09:23 PM
Re: DCL
There are many choices for doing the change in batch.
If you wish to stay with using DCL, you can manipulate the record using the F$LOCATE, cut out the unchanging portions of the string using F$EXTRACT, and then use the "+" (which on strings does concatenation; or simple substitution) to put the pieces of the new record together again. I have used both approaches, depending on the context, to wit:
$! Extract Item Field and change it.
$ FRONTRECORD = F$EXTRACT(0, 20, RECORD)
$ BACKRECORD = F$EXTRACT(30, F$LENGTH(RECORD)-30, RECORD)
$ ITEM = F$EXTRACT(20, 10, RECORD)
$ IF ITEM .EQS. "C-09876543"
$ THEN
.....
$ ITEM = "D-12345678"
$ ENDIF
$!
$ RECORD = FRONTRECORD + ITEM + BACKRECORD
The above code snippet is for illustrative purposes, I sanitized it and had to retype it from an exemplar (Please type it into a test case and experiment with it before using).
For masses of records, there are also the SLP TPU and TECO editors which can be used for batch processing.
All of the functions and editors are documented in the help text and documentation set. The DCL lexical functions are documented under "Lexical functions".
I hope that the above is helpful.
- Bob Gezelter, http://www.rlgsc.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2007 10:11 PM
07-25-2007 10:11 PM