- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Perl and awk result to a symbol/logical?
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
тАО02-16-2010 09:15 PM
тАО02-16-2010 09:15 PM
Perl and awk result to a symbol/logical?
Is it possible to assign the result of a perl or awk command to a VMS symbol or logical? I'm initially trying to do some decimal computation and would like to use either perl or awk without piping the output to a file, then manipulate later on the value using my DCL script.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-16-2010 11:22 PM
тАО02-16-2010 11:22 PM
Re: Perl and awk result to a symbol/logical?
Example:
#
# argument 1 is the unix path (in string quotes to preserve case)
# output is in global DCL symbol VMS_FILENAME
# Author: Joseph Huber
use VMS::Filespec;
use VMS::DCLsym;
my $f = shift ;
my $x = vmsify($f) ;
#print $x;
$handle = new VMS::DCLsym;
$handle->setsym('VMS_FILENAME',$x,'GLOBAL') or die "Can't create symbol: $!\n";
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-17-2010 12:03 AM
тАО02-17-2010 12:03 AM
Re: Perl and awk result to a symbol/logical?
$ value1 = "400"
$ value2 = "375.56"
$ perl -e "$ENV{myvalue} = sprintf(""%3.2f"",(400 - 375.56) / 375.56 * 100)"
$ show logi myvalue
"MYVALUE" = "6.51" (LNM$PROCESS_TABLE)
Now, if I would like to do such a thing using awk, how can I export awk's one liner result to a VMS logical/symbol?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-17-2010 12:15 AM
тАО02-17-2010 12:15 AM
Re: Perl and awk result to a symbol/logical?
http://dcl.openvms.org/stories.php?story=08/12/04/2298229
Instead of doing
system ("type/tail " $NF ) }
you can do
system ("def/job mylogical $NF")
or something similar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-17-2010 03:34 AM
тАО02-17-2010 03:34 AM
Re: Perl and awk result to a symbol/logical?
$ mc SYS$COMMON:[GNV.bin]bash. -c "x=`dcl sh sys/noproc/full` && dcl def/job x ""\""$x\""""
$ sh log x
"X" = "OpenVMS V8.3 on node BREZN 17-FEB-2010 11:27:25.03 Uptime 2 01:22:16. COMPAQ AlphaServer DS20E 833 MH." (LNM$JOB_84613700)
$
In case it is not so obvious in the used font, here: there are backticks used to assign the value to x.
But with gnv then you get dcl.c, the source code of this wrapper and then you can easily hack a:
$ mc []symfromdcl sys show sys/noproc/full
$ sh symb sys
SYS = "OpenVMS V8.3 on node BREZN 17-FEB-2010 11:27:28.47 Uptime 2 01:22:19. COMPAQ AlphaServer DS20E 833 MH."
$
(Yes, there is a \n after each output line in the symbol.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-17-2010 06:37 AM
тАО02-17-2010 06:37 AM
Re: Perl and awk result to a symbol/logical?
Be sure to check out the documentation
on: CLISYM_[LOCAL] and PERL_ENV_TABLES.
in: http://perldoc.perl.org/perlvms.html
You may also want to google for DCLsym.
For example:
http://www.ryerson.ca/perl/manual/vms/lib/DCLsym.html'
Regards,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-17-2010 07:30 AM
тАО02-17-2010 07:30 AM
Re: Perl and awk result to a symbol/logical?
There is no reason, if you have Perl, to acquire extra modules in this case; VMS::DCLsym has been part of the core distribution for eons.
Although not much has changed recently, somewhat more current docs than what Hein points to are available here:
http://search.cpan.org/~dapm/perl-5.10.1/vms/ext/DCLsym/DCLsym.pm
There is nothing about the use of modules that precludes one-liners, though the command line can get on the long side:
$ perl -"MVMS::DCLsym" -e "$h=new VMS::DCLsym; $h->setsym('myvalue',sprintf(""%3.2f"",(400-375.56)/375.56*100),'GLOBAL');"
$ show symbol myvalue
MYVALUE == "6.51"
The perl command above shows up as wrapped here but fits on one line in 132-wide mode.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-17-2010 07:47 AM
тАО02-17-2010 07:47 AM
Re: Perl and awk result to a symbol/logical?
system ("def/job mylogical " $NF )
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-17-2010 01:03 PM
тАО02-17-2010 01:03 PM
Re: Perl and awk result to a symbol/logical?
$ PIPE perl -e "sprintf(""%3.2f"",(400 - 375.56) / 375.56 * 100)" | -
(READ SYS$PIPE v ; DEFINE/JOB/NOLOG myvalue &v)
$ show logi myvalue
"MYVALUE" = "6.51" (LNM$JOB_82874EC0)
Not the kind of thing you'd want to do in a tight loop, but the benefit is that it works for anything.
An even more general mechanism in a DCL procedure is to pipe the output of one part into another invocation of the same procedure, with some mechanism for choosing a different path.
(note that some of the other suggestions look like they involve creating a process, so are probably a similar expense as the above PIPE command).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-18-2010 01:10 AM
тАО02-18-2010 01:10 AM
Re: Perl and awk result to a symbol/logical?
(note that some of the other suggestions look like they involve creating a process, so are probably a similar expense as the above PIPE command).<<
But the perl VMS::setsym() does only the one image invocation (Perl), and not 2 subprocesses like the pipe solutions.
And since the job logical table space is rather small, one should take care to deassign the logical after use!