- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Global replace for many command procedures...?
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
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
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
тАО05-28-2006 08:03 PM
тАО05-28-2006 08:03 PM
Thanks,
Chaim
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-28-2006 08:26 PM
тАО05-28-2006 08:26 PM
Re: Global replace for many command procedures...?
Very handy since any edit session can be done (but keep in mind that the edits must be applicable to all source files). If it goes wrong, delete/sin will save you.
Wim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-28-2006 08:29 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-28-2006 09:29 PM
тАО05-28-2006 09:29 PM
Re: Global replace for many command procedures...?
Could you please place a link to the VMS site as I am not yet familiar with this.
Thanks,
Chaim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-28-2006 09:40 PM
тАО05-28-2006 09:40 PM
Re: Global replace for many command procedures...?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-28-2006 09:52 PM
тАО05-28-2006 09:52 PM
Re: Global replace for many command procedures...?
Thanks!
Please excuse my "ignorance". I downloaded this to my PC. WHat is this file? How do I use it on the VMS system?
Thanks,
Chaim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-28-2006 11:04 PM
тАО05-28-2006 11:04 PM
Re: Global replace for many command procedures...?
this is a kitfile for the PCSI utility on VMS. The PCSI Utility (Commandverb PRODUCT) is used to install, reconfigure... software products on VMS. It replaced the older VMSINSTAL DCL-procedure. The doc-set contains more information about PCSI.
You should transfer this file onto your VMS system in binary mode. To install the FIND utility pls. issue:
$ PRODUCT INSTALL FIND
and answer any questions. This will install the FIND utility onto the default destination
SYS$COMMON.
If the file attributes have been corrupted during transfer, you may repair them with
$ SET FILE
regards Kalle
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-28-2006 11:06 PM
тАО05-28-2006 11:06 PM
Re: Global replace for many command procedures...?
To install the software, use the command
PRODUCT INSTALL FIND
See HELP PRODUCT for /SOURCE and /DESTINATION switches.
The file must have been transferred in BINARY mode (by HTTP download or FTP IMAGE mode).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-29-2006 02:09 AM
тАО05-29-2006 02:09 AM
Re: Global replace for many command procedures...?
http://wwwvms.mppmu.mpg.de/util_root/com/gsr.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-29-2006 02:39 AM
тАО05-29-2006 02:39 AM
Re: Global replace for many command procedures...?
So many solutions...
Using basic DCL scripting it could be done as:
------- edit_many.com -------
$ if p1.eqs."" then exit
$ wildcard_removed = p1 - "*" - "%"
$ loop:
$ file = f$searc(p1)
$ if file.eqs."" then exit
$ editx/edt/com=sys$input: 'file
s/noot/aap/%wh
exit
$ if p1.nes.wildcard_removed then goto loop
Personally I would grab perl, mostly because I never bothered to learn tpu.
I find that the regular expressions in perl are so much more desirabel to find just the right strings to replace.
Here is a perl 'one liner' for the same edit:
$ perl -p -i -e "s/old-text/new-text/g" %.tmp
-p = 'print after loop" : loop over input file stashing into default variable $_, print $_ to sys$ouput after executing perl program over each line.
-i = 'inplace' : output to same name as input
-e = 'execute this' : program text follows
s/x/y/g : no variable listed -> operate on $_, s = substitute, g = all matches on line.
Enjoy,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-29-2006 05:05 AM
тАО05-29-2006 05:05 AM
Re: Global replace for many command procedures...?
I have always used (a variation of) Hein's DCL. It's quick, it's easy, it's foolproof.
One note of caution: please make sure of a good to-be-replaced string.
You will NOT want to replace some substring that happens to match!
If you want to make sure, extend the DCL with a DIFF/OUTP=
Scan the DIFF output files for any UNintended changes (expect none or very few of those).
Success.
Proost.
Have one on me.
jpe
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-29-2006 01:53 PM
тАО05-29-2006 01:53 PM
Re: Global replace for many command procedures...?
Before you embark on editing, think about what you're changing and why. There may be a mechanism that means you don't need to modify any code, OR, if you must change code, you may be able to do it in such a way that future changes are much simpler.
Is the string a command (can be redefined as a symbol) or file name (might be possible to redefine as a logical name)?
If it's something that DCL won't automatically substitute, you may be able to code it so there's a manual substitution. Maybe something like this?
$ ChaimString=F$TRNLNM("ChaimStringValue")
$ IF ChaimString.EQS."" THEN ChaimString="DefaultValue"
...
$ COMMAND 'ChaimString'
Now you can change the string value by defining the logical name ChaimStringValue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-29-2006 04:15 PM
тАО05-29-2006 04:15 PM
Re: Global replace for many command procedures...?
I assume that the perl command assumes that there is perl on the VMS system. In our case, we do NOT have perl.
Thanks,
Chaim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-29-2006 04:56 PM
тАО05-29-2006 04:56 PM
Re: Global replace for many command procedures...?
:-)
Perl is not the answer to everything, but it can make system managers and system programmer much more efficient.
For VMS based folks perl is also a great way to make themselves more valuable for non-VMS tasks (Unix, Windoze,...)
At this point each VMS system should have Perl installed IMHO (and DFU also :-).
btw... if I did write a dcl script, or a perl soltuion, I woudl probably first test whether the string is present before creating a fresh version with no changes.
In may example that could look like:
$ if p1.eqs."" then exit
$ wild = p1 - "*" - "%"
$ loop:
$ file = f$searc(p1)
$ if file.eqs."" then exit
$ search/nowarn/noout 'file noot
$ if $severity.eq.3 then goto skip_edit
$ editx/edt/com=sys$input: 'file
s/noot/aap/%wh
exit
$skip_edit:
$ if p1.nes.wild then goto loop
Cheers,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-29-2006 08:53 PM
тАО05-29-2006 08:53 PM
Re: Global replace for many command procedures...?
Rob.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-29-2006 10:12 PM
тАО05-29-2006 10:12 PM
Re: Global replace for many command procedures...?
Personally, I use the TECO editor, which can be programmed to iterate through one or more directories, performing each change globally within a file.
The advantage of TECO, which is admittedly cryptic (unless one is used to its syntax) is that it comes as part of the base OpenVMS distribution kit on all versions of OpenVMS. Thus, it is useable without worrying about installing additional software.
- Bob Gezelter, http://www.rlgsc.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-29-2006 11:44 PM
тАО05-29-2006 11:44 PM
Re: Global replace for many command procedures...?
It shows the string found, and you can say yes or no to change that file; afterwards a difference is shown.
Edit/edt or TECO is used to do the actual change; TECO sometimes needs a temporary files to do so.
Change_all_files.com
$! VERANDER ALLE FILES
$LOOP:
$ FILE=F$SEARCH("''P1'",3)
$ IF "''FILE'" .EQS. "" THEN $ EXIT
$ NAME=F$PARSE(FILE,".COM","","name")
$ F_TYPE=F$PARSE(FILE,".COM","","TYPE")
$ F_dir=F$PARSE(FILE,".COM","","DIRECTORY")
$ F_device=F$PARSE(FILE,".COM","","Device")
$ write sys$output name,F_TYPE
$ zoek_string="check_devices.com"
$ if "''p2'" .nes. "" then $ zoek_string="''p2'"
$ SEA 'f_device''f_dir''NAME''F_TYPE' "''zoek_string'"
$ ERROR_CODE :== '$STATUS'
$ IF ERROR_CODE .EQS. "%X08D78053" THEN GOTO LOOP
$ if f$extract(0,6,name) .eqs. "CHANGE" then goto loop
$ INQUIRE ANS "Moet file ''f_device'''f_dir'''NAME'''F_TYPE' gedaan worden N/[J]
?"
$ IF ANS .EQS. "N" THEN GOTO LOOP
$ SET NOON
$@sys$login:CHANGE_FILES 'f_device''f_dir''NAME''F_TYPE'
$ GOTO LOOP
----------------------------------
change_files.com
*ht$$
$! COMMAND FILES OM backup COM FILES TE UPDATEN met de laatste check_devices
$ FILE="''P1'"
$! maak de .tec file om uit te voeren
$ open /write file update_backups.tec
$ write file "eb''file'$"
$ write file "a$"
$ write file "ncheck_devices.com$0l$"
$ write file ".,zk$ercheck_devices.com$"
$ write file "ex$$"
$ close file
$! teco = "edit\/teco"
$! teco /execute=update_backups.tec
$! of de bovenste of de onderste twee commando's uitvoeren
$! ASSIGN SYS$COMMAND SYS$INPUT
$ edit/edt 'file'
s/RECOVERY_DATA-/RECOVERY_DATA -/wh
exit
$ SET NOON
$ TEST_1=F$SEARCH("''FILE';-1")
$ SET ON
$ IF "''TEST_1'" .NES. "" THEN $ DIF 'FILE'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-31-2006 01:42 AM
тАО05-31-2006 01:42 AM
Re: Global replace for many command procedures...?
http://dcl.openvms.org/search.php?query=sars&what=stories&limit=100
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-31-2006 02:41 AM
тАО05-31-2006 02:41 AM
Re: Global replace for many command procedures...?
just to add my .05 Cent (Euro): We're using the attached piece of TPU-Programming for years.
Regards
Bernd
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-31-2006 03:58 AM
тАО05-31-2006 03:58 AM
Re: Global replace for many command procedures...?
Please re-reply with the attachment renamed to ".txt"
This silly Internet Exploder comes back with
"To help protect your security, Internet Explorer blocked this site from downloading files to your computer...."
Now you and I know that's a crock, but I guess we'll just have to play the game and mis-label the data, no matter how much I hate that.
[See my rant earlier today in:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1031169
:^]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-31-2006 06:31 AM
тАО05-31-2006 06:31 AM
Re: Global replace for many command procedures...?
I tried to read that, but
This page has been removed.
:-(
Proost.
Have one on me.
jpe
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-01-2006 05:39 PM
тАО06-01-2006 05:39 PM
Re: Global replace for many command procedures...?
Here's another search and replace tool that uses DCL and TPU in one command file (see attached TXT file). Unless you want CYA files and an output file from the TPU search, I would modify the file to your desires.
In general, the command line could be:
$ @Replace P1 P2 P3 [EXACT]
where:
P1 = the desired device-dir-file-ext (s)
P2 = (optional quoted) string to search for
P3 = (optional quoted) string as replacement
P4 = Optional - EXACT, to tell TPU to search for the exact string to find or replace with so using quotes around P2 &/or P3 is required
Regards,
Tony
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-01-2006 05:49 PM
тАО06-01-2006 05:49 PM
Re: Global replace for many command procedures...?
-- Tony
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2006 11:18 PM
тАО06-07-2006 11:18 PM
Re: Global replace for many command procedures...?
forgot about the .COM-issue. Renamed version is attached.
Bernd