- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: Perl - capturing output of DCL lexicals
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
тАО04-04-2007 01:52 PM
тАО04-04-2007 01:52 PM
So, how can I capture the output of a DCL lexical from within a Perl script? I've tried various combinations of Perl calls to DCL with various combinations of back-ticks, etc, without any success. Can anyone give me at least one example?
TIA
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-04-2007 02:20 PM
тАО04-04-2007 02:20 PM
Re: Perl - capturing output of DCL lexicals
dumb question... what do you mean by "output of a lexical function"? I'm not aware of any that produce any output. By definition, they return a function result, usually assigned to a symbol.
I'm guessing you want to capture the lexical function result as a string in perl? How about executing
write sys$output f$yourfunction(params...)
this should work inside back ticks.
(sorry, no perl installed here, so no example)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-04-2007 02:49 PM
тАО04-04-2007 02:49 PM
SolutionFor example:
$ type tmp.pl
use strict;
use warnings;
my $cluster = qx(write sys\$output f\$getdvi("sys\$disk","cluster"));
my $test = 10 * $cluster;
print "$test\n";
$ perl tmp.pl
30
Notice the ugly \ (backslash) escapes to make the $ signs not be interpreted as perl variables.
For one liners you can use basic DCL substitution magic:
$ perl -e "$test=10*''f$getdvi("sys$disk","cluster")'; print $test"
30
$
I appreciate you are probably looking for a generic solution. But for now, what immediate problem are you trying to solve. That may allow us to make concrete examples.
Also, many DCL lexical outputs are avaibale as posix style build-ins. And there are operators for may F$FILE functions like -s for file size in bytes, -M for RDT in days since program start. For F$SEARCH there is 'glob' and so on!
Hope this helps some,
Hein van den Heuvel (at gmail dot com)
HvdH Performance Consulting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-05-2007 02:26 AM
тАО04-05-2007 02:26 AM
Re: Perl - capturing output of DCL lexicals
Or you can set symbols and/or logicals from DCL and retrieve them from Perl.
Or you need to build the VMS::* extensions. Note that VMS::System only has the SYI functions and there are separate extensions that cover QUI, DVI, JPI etc. These are not especially difficult to build and install, so depending on the definition of "don't want to" in your post, that's a hurdle that can be gotten over. Let me know if there is some particular problem you had with them.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-05-2007 03:29 AM
тАО04-05-2007 03:29 AM
Re: Perl - capturing output of DCL lexicals
Your example is extactly what I was having problems with.
Craig,
You've hit my problem squarely on the head!
Hein,
You've given the example and answer I needed: escape those pesky dollar signs! I can get my code to work now.
Thanks all for responding.