<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Perl and awk result to a symbol/logical? in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/perl-and-awk-result-to-a-symbol-logical/m-p/4585213#M39513</link>
    <description>A couple more follow-ups on a Perl solution involving DCL symbols (though there's nothing wrong with using logical names if that works for you).&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;Although not much has changed recently, somewhat more current docs than what Hein points to are available here:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://search.cpan.org/~dapm/perl-5.10.1/vms/ext/DCLsym/DCLsym.pm" target="_blank"&gt;http://search.cpan.org/~dapm/perl-5.10.1/vms/ext/DCLsym/DCLsym.pm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;There is nothing about the use of modules that precludes one-liners, though the command line can get on the long side:&lt;BR /&gt;&lt;BR /&gt;$ perl -"MVMS::DCLsym" -e "$h=new VMS::DCLsym; $h-&amp;gt;setsym('myvalue',sprintf(""%3.2f"",(400-375.56)/375.56*100),'GLOBAL');"&lt;BR /&gt;$ show symbol myvalue&lt;BR /&gt;  MYVALUE == "6.51"&lt;BR /&gt;&lt;BR /&gt;The perl command above shows up as wrapped here but fits on one line in 132-wide mode.</description>
    <pubDate>Wed, 17 Feb 2010 15:30:20 GMT</pubDate>
    <dc:creator>Craig A Berry</dc:creator>
    <dc:date>2010-02-17T15:30:20Z</dc:date>
    <item>
      <title>Perl and awk result to a symbol/logical?</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/perl-and-awk-result-to-a-symbol-logical/m-p/4585207#M39507</link>
      <description>Hi Folks,&lt;BR /&gt;&lt;BR /&gt;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. &lt;BR /&gt;&lt;BR /&gt;Thanks.</description>
      <pubDate>Wed, 17 Feb 2010 05:15:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/perl-and-awk-result-to-a-symbol-logical/m-p/4585207#M39507</guid>
      <dc:creator>roose</dc:creator>
      <dc:date>2010-02-17T05:15:51Z</dc:date>
    </item>
    <item>
      <title>Re: Perl and awk result to a symbol/logical?</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/perl-and-awk-result-to-a-symbol-logical/m-p/4585208#M39508</link>
      <description>Get the some VMS:: packages for perl, then there is the setsym() function available. &lt;BR /&gt;Example:&lt;BR /&gt;&lt;BR /&gt;#&lt;TITLE&gt; convert a Unix style path to VMS filespec using PERL rules &lt;/TITLE&gt;&lt;BR /&gt;# argument 1 is the unix path (in string quotes to preserve case)&lt;BR /&gt;# output is in global DCL symbol VMS_FILENAME&lt;BR /&gt;# Author: Joseph Huber&lt;BR /&gt;use VMS::Filespec;&lt;BR /&gt;use VMS::DCLsym;&lt;BR /&gt;my $f = shift ;&lt;BR /&gt;my $x = vmsify($f) ;&lt;BR /&gt;#print $x;&lt;BR /&gt;$handle = new VMS::DCLsym;&lt;BR /&gt;$handle-&amp;gt;setsym('VMS_FILENAME',$x,'GLOBAL') or die "Can't create symbol: $!\n";&lt;BR /&gt;</description>
      <pubDate>Wed, 17 Feb 2010 07:22:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/perl-and-awk-result-to-a-symbol-logical/m-p/4585208#M39508</guid>
      <dc:creator>Joseph Huber_1</dc:creator>
      <dc:date>2010-02-17T07:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: Perl and awk result to a symbol/logical?</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/perl-and-awk-result-to-a-symbol-logical/m-p/4585209#M39509</link>
      <description>Thanks Joseph for the quick reply. I was thinking more initially of a one liner command, and I have been able to get one for perl:&lt;BR /&gt;&lt;BR /&gt;$ value1 = "400"&lt;BR /&gt;$ value2 = "375.56"&lt;BR /&gt;$ perl -e "$ENV{myvalue} = sprintf(""%3.2f"",(400 - 375.56) / 375.56 * 100)"&lt;BR /&gt;$ show logi myvalue&lt;BR /&gt;   "MYVALUE" = "6.51" (LNM$PROCESS_TABLE)&lt;BR /&gt;&lt;BR /&gt;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?</description>
      <pubDate>Wed, 17 Feb 2010 08:03:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/perl-and-awk-result-to-a-symbol-logical/m-p/4585209#M39509</guid>
      <dc:creator>roose</dc:creator>
      <dc:date>2010-02-17T08:03:35Z</dc:date>
    </item>
    <item>
      <title>Re: Perl and awk result to a symbol/logical?</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/perl-and-awk-result-to-a-symbol-logical/m-p/4585210#M39510</link>
      <description>For using awk, see the procedure typlog on dcl.openvms.org&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://dcl.openvms.org/stories.php?story=08/12/04/2298229" target="_blank"&gt;http://dcl.openvms.org/stories.php?story=08/12/04/2298229&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Instead of doing &lt;BR /&gt;system ("type/tail " $NF ) }&lt;BR /&gt;&lt;BR /&gt;you can do &lt;BR /&gt;system ("def/job mylogical $NF")&lt;BR /&gt;or something similar.</description>
      <pubDate>Wed, 17 Feb 2010 08:15:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/perl-and-awk-result-to-a-symbol-logical/m-p/4585210#M39510</guid>
      <dc:creator>labadie_1</dc:creator>
      <dc:date>2010-02-17T08:15:55Z</dc:date>
    </item>
    <item>
      <title>Re: Perl and awk result to a symbol/logical?</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/perl-and-awk-result-to-a-symbol-logical/m-p/4585211#M39511</link>
      <description>&lt;!--!*#--&gt;If you have gnv installed you can do something simple like:&lt;BR /&gt;&lt;BR /&gt;$ mc SYS$COMMON:[GNV.bin]bash. -c "x=`dcl sh sys/noproc/full` &amp;amp;&amp;amp; dcl def/job x ""\""$x\""""&lt;BR /&gt;$ sh log x&lt;BR /&gt;   "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)&lt;BR /&gt;$&lt;BR /&gt;&lt;BR /&gt;In case it is not so obvious in the used font, here: there are backticks used to assign the value to x.&lt;BR /&gt;&lt;BR /&gt;But with gnv then you get dcl.c, the source code of this wrapper and then you can easily hack a:&lt;BR /&gt;&lt;BR /&gt;$ mc []symfromdcl sys show sys/noproc/full&lt;BR /&gt;$ sh symb sys&lt;BR /&gt;  SYS = "OpenVMS V8.3  on node BREZN   17-FEB-2010 11:27:28.47   Uptime  2 01:22:19.        COMPAQ AlphaServer DS20E 833 MH."&lt;BR /&gt;$&lt;BR /&gt;&lt;BR /&gt;(Yes, there is a \n after each output line in the symbol.)</description>
      <pubDate>Wed, 17 Feb 2010 11:34:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/perl-and-awk-result-to-a-symbol-logical/m-p/4585211#M39511</guid>
      <dc:creator>H.Becker</dc:creator>
      <dc:date>2010-02-17T11:34:03Z</dc:date>
    </item>
    <item>
      <title>Re: Perl and awk result to a symbol/logical?</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/perl-and-awk-result-to-a-symbol-logical/m-p/4585212#M39512</link>
      <description>Back to Perl,&lt;BR /&gt;&lt;BR /&gt;Be sure to check out the documentation &lt;BR /&gt;on: CLISYM_[LOCAL] and PERL_ENV_TABLES.&lt;BR /&gt;in: &lt;A href="http://perldoc.perl.org/perlvms.html" target="_blank"&gt;http://perldoc.perl.org/perlvms.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;You may also want to google for DCLsym.&lt;BR /&gt;For example:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.ryerson.ca/perl/manual/vms/lib/DCLsym.html'" target="_blank"&gt;http://www.ryerson.ca/perl/manual/vms/lib/DCLsym.html'&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Hein.</description>
      <pubDate>Wed, 17 Feb 2010 14:37:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/perl-and-awk-result-to-a-symbol-logical/m-p/4585212#M39512</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2010-02-17T14:37:11Z</dc:date>
    </item>
    <item>
      <title>Re: Perl and awk result to a symbol/logical?</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/perl-and-awk-result-to-a-symbol-logical/m-p/4585213#M39513</link>
      <description>A couple more follow-ups on a Perl solution involving DCL symbols (though there's nothing wrong with using logical names if that works for you).&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;Although not much has changed recently, somewhat more current docs than what Hein points to are available here:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://search.cpan.org/~dapm/perl-5.10.1/vms/ext/DCLsym/DCLsym.pm" target="_blank"&gt;http://search.cpan.org/~dapm/perl-5.10.1/vms/ext/DCLsym/DCLsym.pm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;There is nothing about the use of modules that precludes one-liners, though the command line can get on the long side:&lt;BR /&gt;&lt;BR /&gt;$ perl -"MVMS::DCLsym" -e "$h=new VMS::DCLsym; $h-&amp;gt;setsym('myvalue',sprintf(""%3.2f"",(400-375.56)/375.56*100),'GLOBAL');"&lt;BR /&gt;$ show symbol myvalue&lt;BR /&gt;  MYVALUE == "6.51"&lt;BR /&gt;&lt;BR /&gt;The perl command above shows up as wrapped here but fits on one line in 132-wide mode.</description>
      <pubDate>Wed, 17 Feb 2010 15:30:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/perl-and-awk-result-to-a-symbol-logical/m-p/4585213#M39513</guid>
      <dc:creator>Craig A Berry</dc:creator>
      <dc:date>2010-02-17T15:30:20Z</dc:date>
    </item>
    <item>
      <title>Re: Perl and awk result to a symbol/logical?</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/perl-and-awk-result-to-a-symbol-logical/m-p/4585214#M39514</link>
      <description>Sorry, I did a typo, the correct code looks like&lt;BR /&gt;&lt;BR /&gt;system ("def/job mylogical " $NF )&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 17 Feb 2010 15:47:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/perl-and-awk-result-to-a-symbol-logical/m-p/4585214#M39514</guid>
      <dc:creator>labadie_1</dc:creator>
      <dc:date>2010-02-17T15:47:01Z</dc:date>
    </item>
    <item>
      <title>Re: Perl and awk result to a symbol/logical?</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/perl-and-awk-result-to-a-symbol-logical/m-p/4585215#M39515</link>
      <description>A rather ugly and expensive, but general way to get a one line result of any command into a logical name, using PIPE:&lt;BR /&gt;&lt;BR /&gt;$ PIPE perl -e "sprintf(""%3.2f"",(400 - 375.56) / 375.56 * 100)" | -&lt;BR /&gt;(READ SYS$PIPE v ; DEFINE/JOB/NOLOG myvalue &amp;amp;v)&lt;BR /&gt;$ show logi myvalue&lt;BR /&gt;"MYVALUE" = "6.51" (LNM$JOB_82874EC0)&lt;BR /&gt;&lt;BR /&gt;Not the kind of thing you'd want to do in a tight loop, but the benefit is that it works for anything.&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;(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).</description>
      <pubDate>Wed, 17 Feb 2010 21:03:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/perl-and-awk-result-to-a-symbol-logical/m-p/4585215#M39515</guid>
      <dc:creator>John Gillings</dc:creator>
      <dc:date>2010-02-17T21:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: Perl and awk result to a symbol/logical?</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/perl-and-awk-result-to-a-symbol-logical/m-p/4585216#M39516</link>
      <description>&amp;gt;&amp;gt;&lt;BR /&gt;(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).&amp;lt;&amp;lt;&lt;BR /&gt;&lt;BR /&gt;But the perl VMS::setsym() does only the one image invocation (Perl), and not 2 subprocesses like the pipe solutions.&lt;BR /&gt;And since the job logical table space is rather small, one should take care to deassign the logical after use!</description>
      <pubDate>Thu, 18 Feb 2010 09:10:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/perl-and-awk-result-to-a-symbol-logical/m-p/4585216#M39516</guid>
      <dc:creator>Joseph Huber_1</dc:creator>
      <dc:date>2010-02-18T09:10:51Z</dc:date>
    </item>
    <item>
      <title>Re: Perl and awk result to a symbol/logical?</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/perl-and-awk-result-to-a-symbol-logical/m-p/4585217#M39517</link>
      <description>&amp;gt;&amp;gt;&amp;gt;And since the job logical table space is rather small, one should take care to deassign the logical after use!&lt;BR /&gt;&lt;BR /&gt;So&lt;BR /&gt;&lt;BR /&gt;$ mysymb = f$trnlnm("mylogical","lnm$job")&lt;BR /&gt;$ deas/job mylogical</description>
      <pubDate>Thu, 18 Feb 2010 09:38:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/perl-and-awk-result-to-a-symbol-logical/m-p/4585217#M39517</guid>
      <dc:creator>labadie_1</dc:creator>
      <dc:date>2010-02-18T09:38:00Z</dc:date>
    </item>
    <item>
      <title>Re: Perl and awk result to a symbol/logical?</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/perl-and-awk-result-to-a-symbol-logical/m-p/4585218#M39518</link>
      <description>One addition:&lt;BR /&gt;when using the perl $ENV{myvalue} method, don't blindly expect to have the logical MYVALUE defined, it could well be a global DCL symbol (or nothing at all if perl defined a local DCL symbol).&lt;BR /&gt;To make sure perl creates the right entity independent of the installation or system setup:&lt;BR /&gt;&lt;BR /&gt;$ define/user PERL_ENV_TABLES CLISYM_GLOBAL&lt;BR /&gt;or&lt;BR /&gt;$ define/user PERL_ENV_TABLES LNM$FILE_DEV&lt;BR /&gt;before invoking perl.&lt;BR /&gt;Then $ENV() generates DCL symbols resp. logical names.</description>
      <pubDate>Thu, 18 Feb 2010 10:45:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/perl-and-awk-result-to-a-symbol-logical/m-p/4585218#M39518</guid>
      <dc:creator>Joseph Huber_1</dc:creator>
      <dc:date>2010-02-18T10:45:47Z</dc:date>
    </item>
    <item>
      <title>Re: Perl and awk result to a symbol/logical?</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/perl-and-awk-result-to-a-symbol-logical/m-p/4585219#M39519</link>
      <description>and for results needed only inside a DCL procedure, a local symbol is appropriate:&lt;BR /&gt;&lt;BR /&gt;define/user PERL_ENV_TABLES CLISYM_LOCAL&lt;BR /&gt;perl -e "$ENV{result} = sprintf(""testing result"")"&lt;BR /&gt;sh sym result&lt;BR /&gt;  RESULT = "testing result"&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Feb 2010 10:54:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/perl-and-awk-result-to-a-symbol-logical/m-p/4585219#M39519</guid>
      <dc:creator>Joseph Huber_1</dc:creator>
      <dc:date>2010-02-18T10:54:03Z</dc:date>
    </item>
  </channel>
</rss>

