- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: Rewriting DCL to Perl scripts
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
тАО08-02-2006 01:58 AM
тАО08-02-2006 01:58 AM
Rewriting DCL to Perl scripts
I am just starting with Perl and need to write some command procedures (DCL) in Perl.
So, i like examples very much.
But searching the internet does not help much.
I have access to books42x7, but that is still not helping me. When i find a clou, it's not for VMS. I spend hours of interpreting the examples and writing them for testing. On my laptop, i have more succes then on VMS systems. The things i am looking for is:
- setting my working directory
- test if file exist
- deleting files
- renaming files
all local, and remote with username/passwd.
- get process id
- set process name
- run/detached file.exe
- submit batch.com
- request a message to console
and more.
I want to avoid to make use of systemcalls, for example for starting a dcl procedure:
system('@test.com test_P1');
Please reply if you will share your knowledge!
Thanks, Kees
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-02-2006 02:20 AM
тАО08-02-2006 02:20 AM
Re: Rewriting DCL to Perl scripts
http://webmaster.iu.edu/perl56/vms/perlvms.html
http://search.cpan.org/dist/perl/README.vms
and the VMS specific addons in
http://www.perl.com/CPAN/authors/Dan_Sugalski/
Why are you re-writing DCL scripts into perl?
Purely Personal Opinion
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-02-2006 02:22 AM
тАО08-02-2006 02:22 AM
Re: Rewriting DCL to Perl scripts
http://www.perl.com/CPAN/modules/by-category/04_Operating_System_Interfaces/VMS/
Purely Personal Opinion
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-02-2006 02:40 AM
тАО08-02-2006 02:40 AM
Re: Rewriting DCL to Perl scripts
http://www.xav.com/perl/lib/Pod/perlfunc.html
Be sure to check out the
"alphabetical listing of perl functions"
This starts with the various handy file test operators.
Below a little perl script to get you going on some of the functions you request.
Groetjes,
Hein.
use strict;
use Getopt::Std;
my %opt;
use vars qw/ %out /;
getopts ('tdr:',\%opt) or &usage;
my $file = shift @ARGV or &usage;
if ($opt{t}) {
print "$file is a plain file\n" if (-f $file);
print "$file is a directory\n" if (-d $file);
exit
}
unlink ($file) if ($opt{d});
if ($opt{r}) {
print "New name : $opt{r}\n";
rename $file, $opt{r};
}
sub usage()
{
print STDERR << "EOF";
blah blah...
usage: $0 [-t | -d | r new_nam] filename
-t : test for existance
-d : delete
-r : rename
EOF
exit;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-02-2006 10:36 AM
тАО08-02-2006 10:36 AM
Re: Rewriting DCL to Perl scripts
At least half of what you want to do is not VMS-specific, so just do what you would do for any other platform. For example, to change the current directory:
$ perl -we "chdir('sys$manager'); print `show def`;"
SYS$SYSROOT:[SYSMGR]
= SYS$SYSROOT:[SYSMGR]
= SYS$COMMON:[SYSMGR]
Of the other things in your list, nearly all of it can be done directly from Perl with no need for spawning DCL commands. The list pointed to in Ian's second post has most of what you need. For example, VMS::Queue::submit will submit a batch job for you.
The only thing on the list that I don't know of a way to do offhand is send OPCOM messages -- sounds like someone needs to write another extension to do that.
As far as Ian's question about why convert from DCL to Perl, I don't know Kees's reasons, but there are some advantages. Probably the most significant one is that the whole script is syntax-checked before it is run, unlike DCL where you can have syntax errors hiding in seldom-followed code paths.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-02-2006 01:58 PM
тАО08-02-2006 01:58 PM
Re: Rewriting DCL to Perl scripts
Fair question.
Personally I would never re-write existing DCL into PERL. That seems just a waste.
For new implementations I believe one should consider PERL for those tasks which do a lot of file walking (glob), pattern matching, searching, renaming, deleting and the likes.
On the other hand if every other line is a SUBMIT, COMPILE, LINK or REPLY then just stick to DCL!
An extra reason for leaning towards PERL could be for personal growth/learning.
Someone handy in perl and regexpr ans such is valuable in Unix and Windoze environments.
fwiw,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-02-2006 07:54 PM
тАО08-02-2006 07:54 PM
Re: Rewriting DCL to Perl scripts
Now i need a while to read all the stuff you are pointing to, but i will let you know how i am going.
In answer to the question why i want to use Perl in place of DCL:
We have a kind of monitoring agent that reports events to a monitoring system (both VMS). As a result on that event, the monitoring system point to a script for a action (can be a solution or a data gathering script) this agent must look for this script, fetch and run it. We will expand the platforms to be monitored from VMS-only to include Linux and Windows.
In the period i was learning Perl, it got me by the nose! So, personally, i want to accept the challenge to rewrite each small piece of code and learn about Perl.
So now i have to visit some sites you mentioned, thanks again.