- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- COM file to do DIFF
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
02-05-2007 01:22 AM
02-05-2007 01:22 AM
I'm new to DCL and OpenVMS and am trying to create a COM file that could do a DIFF between 2 versions of a file, for all the files in a directory.
Is this possible?, or is there any code/script out there that does this already?
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2007 01:53 AM
02-05-2007 01:53 AM
Solutionto begin with:
Welcome to OpenVMS, and to the Forum!
$ HELP LEX is your friend here.
Try something along this line:
$loop:
$ next = f$search("
$ if next .eqs. "" then goto done
$ diff 'next' /output =
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2007 01:57 AM
02-05-2007 01:57 AM
Re: COM file to do DIFF
Welcome to the HP ITRC OpenVMS forum.
Here is a script to get you going:
$loop:
$file = f$search("*.tmp;0",1)
$if file.eqs."" then exit
$older = f$elem(0,";",file) + ";-1"
$!write sys$output file, " ", older
$if "".eqs. f$search(older,2) then goto loop
$diff 'file
$goto loop
It does two 'fancy' things.
1) it uses special file version naming.
To get only the highest version of what might be many files it uses ";0" thus the script does not need to match for other files with the same name but different version. And to see whether a diff is needed it searches for version ;-1 that being the next older version if present.
2) it uses CONTEXT for F$SEARCH such that the main one used to loop through all the files, does nto get confused by the one to test for an older version
be sure to use VMS HELP on all construct in the exampel to fully comprehend.
$HELP LEXI F$SEARCH
$HELP LEXT F$ELEMENT
:
Enjoy DCL,
Hein van den Heuvel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2007 02:04 AM
02-05-2007 02:04 AM
Re: COM file to do DIFF
Then the stuff is rather easy:
$ EACH *.*;0 "DIFFERENCE 'n'"
But for a list of files, You probably want to do something with the files if they are (not-)identical:
some examples how to do things after comparisons are in my command-files like
DELETE_IF_IDENTICAL.COM
COPY_IF_DIFFERENT.COM
on the http page above.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2007 02:10 PM
02-05-2007 02:10 PM
Re: COM file to do DIFF
It is kinda nice to have a generic 'do this action for this list of files script'.
Also, John Gillings pointed out to me that the following line is too quick & dirty in my script:
$ older = F$PARSE(";-1",file) + ";-1"
The problem is of course files with ";" somewhere else in the name. And for other cases perhaps the usage of "." as version indicator. I frequently do things like: delete x.tmp.
The proper way to solve this with learning as little as possible about file name parsing yourself is:
$ older = F$PARSE(";-1",file)
Correct. And shorter :-)
Runner up might be:
older = file - f$parse(file,,,"version") + ";-1"
I only show that to show the power of string substractions and appends. The straight parse is better.
Cheers,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2007 09:04 PM
02-05-2007 09:04 PM
Re: COM file to do DIFF
By the way, EACH together with PIPE allows to do something like:
each *.com;-1 "pipe diff 'nt'/nooutput ; if $SEVERITY.eq.1 then delete/log 'nt';0"
to delete the newest identical versions of files.