- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: VMS to UNIX script re writes
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
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
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
тАО06-25-2008 01:57 AM
тАО06-25-2008 01:57 AM
VMS to UNIX script re writes
I am in the process of moving a system from OVMS to UNIX, and am re writing a number of DCL scripts. Can any one help with the following
$ xyz_file = f$search("dsa1:[John_extract.run]extract*.dat")
$ sh sym xyz_file
$ xyz_date1 = f$extract(5,4,xyz_file)
$ xyz_date2 = f$extract(9,2,xyz_file)
$ xyz_date3 = f$extract(11,2,xyz_file)
space = " "
$ xyz_date_sorted = f$string(xyz_date3+space+xyz_date2+space+xyz_date1)
$ sh sym xyz_date_sorted
$ xyz_date = ("xyz_date_sorted")
Is someone able to help with a suitable UNIX equivelent please?
Many Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-25-2008 02:13 AM
тАО06-25-2008 02:13 AM
Re: VMS to UNIX script re writes
This segment of DCL is searching for filenames of the form "dsa1:[john_extract.run]extract*.dat". It is then extracting pieces of the filename to use in constructing a string. Looking at the character offsets, are you sure that this code is working as intended, or are there some pieces missing from the example?
- Bob Gezelter, http://www.rlgsc.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-25-2008 02:21 AM
тАО06-25-2008 02:21 AM
Re: VMS to UNIX script re writes
Thank you for your response.
You are quite correct. I have probobly broken the code in posting it as I need to protect the identity of the client. However the original code has worked well for several years.
Any sugestions on reproducing for UNIX?
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-25-2008 03:13 AM
тАО06-25-2008 03:13 AM
Re: VMS to UNIX script re writes
Do you just want to solve the string manipulation, or also the search?
What are you going to do with the string, once re-arranged?
I would use perl
- use its 'glob' function to find files
- use pattern matching, ot substr() to pick the names apart.
- build new string
- sort within the perl as needed
- ...
Starting example
perl -e 'while (
perl -e 'while (
btw...
1) that DCL looks hoky... it needs an F$PARSE to get just the name into xyz_file
2) while porting, why not have the source deliver the files with the desirable names?
Enjoy, (but not too much. OpenVMS rules!)
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-25-2008 03:40 AM
тАО06-25-2008 03:40 AM
Re: VMS to UNIX script re writes
If by Unix equivalent you mean that you intend to migrate from DCL to shell then you will have to indicate which shell.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-25-2008 07:19 AM
тАО06-25-2008 07:19 AM
Re: VMS to UNIX script re writes
> UNIX equivelent please?
> [...] indicate which shell.
Or at least which UNIX.
Also, the easiest way to do something on a
UNIX system may not look anything like the
way it was done on a VMS system.
Semi-mindless DCL -> shell-script translation
may be far fron the right approach.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-25-2008 08:02 AM
тАО06-25-2008 08:02 AM
Re: VMS to UNIX script re writes
...and since you posted this in multiple places, I'll add the text I did in HP-UX:
Please consider Hein's offering. Perl is platform agnostic and allows you to write extremely powerful code in a very straighforward fashion.
Even if you don't know Perl now, don't ignore the advice and the annotated example our friend has provided. Instead, profit from it and give Hein the credit he deserves.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-25-2008 09:05 AM
тАО06-25-2008 09:05 AM
Re: VMS to UNIX script re writes
There are also assorted Date::* modules if in fact you are really interested in dates rather filename components (can't tell from your example).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-25-2008 03:29 PM
тАО06-25-2008 03:29 PM
Re: VMS to UNIX script re writes
warning: opinions and generalizations follow
There are trade-offs.
Mindless translation is more likely to give a correctly working result, get the result more quickly and with less effort.
Mindless translation is more likely to lead to a result that is less maintainable in the future and may lead to poor performance. Mindless translation also runs the risk of coming up against something that "can't" be translated.
If there is a *lot* of DCL to migrate then I would favour mindless translation.
If there is only a modest amount then I would favour abstracting what the procedures are attempting to achieve (or reading the associated system documentation, hah!) and re-engineering in the target environment.
But then I wouldn't favour any port from VMS to something else. (-:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-25-2008 07:08 PM
тАО06-25-2008 07:08 PM
Re: VMS to UNIX script re writes
Do get yourself a bash manual (bash shell assumed) and look up substring expressions. There are various excellent bash guides and resources around.
Here's a basic bash replacement:
$ fodder=ab001122
$ echo ${fodder:6:2}${fodder:4:2}${fodder:2:2}
221100
Your DCL could be shorter, too.
The $ dollar here is the bash prompt, and not DCL.
Migrating to bash arguably leaves you in the same basic platform-level state as you have with DCL here, though bash is certainly rather more widespread than DCL, and an entirely capable and functional choice. Other good options include the aforementioned Perl, though I'd also look at php, Python and Ruby. Possibly Java. Move up the stack from the command shell, in other words.
And yes, there are folks around that are reasonably conversant in both OpenVMS and DCL, and in bash.
Stephen Hoffman
HoffmanLabs LLC