<?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 VMS to UNIX script re writes in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/vms-to-unix-script-re-writes/m-p/4222051#M44188</link>
    <description>Hello,&lt;BR /&gt;&lt;BR /&gt;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&lt;BR /&gt;&lt;BR /&gt;$  xyz_file = f$search("dsa1:[John_extract.run]extract*.dat")&lt;BR /&gt;$  sh sym xyz_file&lt;BR /&gt;$ xyz_date1 = f$extract(5,4,xyz_file)&lt;BR /&gt;$ xyz_date2 = f$extract(9,2,xyz_file)&lt;BR /&gt;$ xyz_date3 = f$extract(11,2,xyz_file)&lt;BR /&gt; space = " "&lt;BR /&gt;$ xyz_date_sorted = f$string(xyz_date3+space+xyz_date2+space+xyz_date1)&lt;BR /&gt;$ sh sym xyz_date_sorted&lt;BR /&gt;$ xyz_date = ("xyz_date_sorted")&lt;BR /&gt;&lt;BR /&gt;Is someone able to help with a suitable UNIX equivelent please?&lt;BR /&gt;&lt;BR /&gt;Many Thanks</description>
    <pubDate>Wed, 25 Jun 2008 08:57:11 GMT</pubDate>
    <dc:creator>John Crump</dc:creator>
    <dc:date>2008-06-25T08:57:11Z</dc:date>
    <item>
      <title>VMS to UNIX script re writes</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/vms-to-unix-script-re-writes/m-p/4222051#M44188</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;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&lt;BR /&gt;&lt;BR /&gt;$  xyz_file = f$search("dsa1:[John_extract.run]extract*.dat")&lt;BR /&gt;$  sh sym xyz_file&lt;BR /&gt;$ xyz_date1 = f$extract(5,4,xyz_file)&lt;BR /&gt;$ xyz_date2 = f$extract(9,2,xyz_file)&lt;BR /&gt;$ xyz_date3 = f$extract(11,2,xyz_file)&lt;BR /&gt; space = " "&lt;BR /&gt;$ xyz_date_sorted = f$string(xyz_date3+space+xyz_date2+space+xyz_date1)&lt;BR /&gt;$ sh sym xyz_date_sorted&lt;BR /&gt;$ xyz_date = ("xyz_date_sorted")&lt;BR /&gt;&lt;BR /&gt;Is someone able to help with a suitable UNIX equivelent please?&lt;BR /&gt;&lt;BR /&gt;Many Thanks</description>
      <pubDate>Wed, 25 Jun 2008 08:57:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/vms-to-unix-script-re-writes/m-p/4222051#M44188</guid>
      <dc:creator>John Crump</dc:creator>
      <dc:date>2008-06-25T08:57:11Z</dc:date>
    </item>
    <item>
      <title>Re: VMS to UNIX script re writes</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/vms-to-unix-script-re-writes/m-p/4222052#M44189</link>
      <description>John,&lt;BR /&gt;&lt;BR /&gt;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?&lt;BR /&gt;&lt;BR /&gt;- Bob Gezelter, &lt;A href="http://www.rlgsc.com" target="_blank"&gt;http://www.rlgsc.com&lt;/A&gt;</description>
      <pubDate>Wed, 25 Jun 2008 09:13:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/vms-to-unix-script-re-writes/m-p/4222052#M44189</guid>
      <dc:creator>Robert Gezelter</dc:creator>
      <dc:date>2008-06-25T09:13:44Z</dc:date>
    </item>
    <item>
      <title>Re: VMS to UNIX script re writes</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/vms-to-unix-script-re-writes/m-p/4222053#M44190</link>
      <description>Hello Bob&lt;BR /&gt;&lt;BR /&gt;Thank you for your response.&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt; Any sugestions on reproducing for UNIX?&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Wed, 25 Jun 2008 09:21:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/vms-to-unix-script-re-writes/m-p/4222053#M44190</guid>
      <dc:creator>John Crump</dc:creator>
      <dc:date>2008-06-25T09:21:07Z</dc:date>
    </item>
    <item>
      <title>Re: VMS to UNIX script re writes</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/vms-to-unix-script-re-writes/m-p/4222054#M44191</link>
      <description>Think bigger, think perl&lt;BR /&gt;&lt;BR /&gt;Do you just want to solve the string manipulation, or also the search?&lt;BR /&gt;What are you going to do with the string, once re-arranged?&lt;BR /&gt;&lt;BR /&gt;I would use perl&lt;BR /&gt;- use its 'glob' function to find files&lt;BR /&gt;- use pattern matching, ot substr() to pick the names apart.&lt;BR /&gt;- build new string &lt;BR /&gt;- sort within the perl as needed&lt;BR /&gt;- ...&lt;BR /&gt;&lt;BR /&gt;Starting example&lt;BR /&gt;&lt;BR /&gt; perl -e 'while (&lt;EXTRACT&gt;){ m/extract(....)(..)(..)/; print "$3 $2 $1\n"}'&lt;BR /&gt;&lt;BR /&gt; perl -e 'while (&lt;EXTRACT&gt;){ m/extract(....)(..)(..)/; push @list, "$3 $2 $1\n"} print reverse sort @list'&lt;BR /&gt;&lt;BR /&gt;btw... &lt;BR /&gt;&lt;BR /&gt;1) that DCL looks hoky... it needs an F$PARSE to get just the name into xyz_file&lt;BR /&gt;&lt;BR /&gt;2) while porting, why not have the source deliver the files with the desirable names?&lt;BR /&gt;&lt;BR /&gt;Enjoy, (but not too much. OpenVMS rules!)&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/EXTRACT&gt;&lt;/EXTRACT&gt;</description>
      <pubDate>Wed, 25 Jun 2008 10:13:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/vms-to-unix-script-re-writes/m-p/4222054#M44191</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2008-06-25T10:13:19Z</dc:date>
    </item>
    <item>
      <title>Re: VMS to UNIX script re writes</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/vms-to-unix-script-re-writes/m-p/4222055#M44192</link>
      <description>If you went with perl then you could migrate to perl while still on VMS, perhaps allowing more sane regression testing (rather than changing both your scripting language and your platform simultaneously).&lt;BR /&gt;&lt;BR /&gt;If by Unix equivalent you mean that you intend to migrate from DCL to shell then you will have to indicate which shell.</description>
      <pubDate>Wed, 25 Jun 2008 10:40:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/vms-to-unix-script-re-writes/m-p/4222055#M44192</guid>
      <dc:creator>Derek Garson</dc:creator>
      <dc:date>2008-06-25T10:40:33Z</dc:date>
    </item>
    <item>
      <title>Re: VMS to UNIX script re writes</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/vms-to-unix-script-re-writes/m-p/4222056#M44193</link>
      <description>&amp;gt; Is someone able to help with a suitable&lt;BR /&gt;&amp;gt; UNIX equivelent please?&lt;BR /&gt;&lt;BR /&gt;&amp;gt; [...] indicate which shell.&lt;BR /&gt;&lt;BR /&gt;Or at least which UNIX.&lt;BR /&gt;&lt;BR /&gt;Also, the easiest way to do something on a&lt;BR /&gt;UNIX system may not look anything like the&lt;BR /&gt;way it was done on a VMS system.&lt;BR /&gt;Semi-mindless DCL -&amp;gt; shell-script translation&lt;BR /&gt;may be far fron the right approach.</description>
      <pubDate>Wed, 25 Jun 2008 14:19:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/vms-to-unix-script-re-writes/m-p/4222056#M44193</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2008-06-25T14:19:17Z</dc:date>
    </item>
    <item>
      <title>Re: VMS to UNIX script re writes</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/vms-to-unix-script-re-writes/m-p/4222057#M44194</link>
      <description>Hi John:&lt;BR /&gt;&lt;BR /&gt;...and since you posted this in multiple places, I'll add the text I did in HP-UX:&lt;BR /&gt;&lt;BR /&gt;Please consider Hein's offering. Perl is platform agnostic and allows you to write extremely powerful code in a very straighforward fashion. &lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 25 Jun 2008 15:02:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/vms-to-unix-script-re-writes/m-p/4222057#M44194</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-06-25T15:02:44Z</dc:date>
    </item>
    <item>
      <title>Re: VMS to UNIX script re writes</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/vms-to-unix-script-re-writes/m-p/4222058#M44195</link>
      <description>I would second (or third) the Perl recommendation, except that if you are really trying to disassemble file specs into their component parts I suggest using the File::Spec module that is included with Perl.  It abstracts out the OS-specific syntax, so that, for example File::Spec-&amp;gt;splitdir('[.foo.bar.baz]') on VMS will give you the same answer as File::Spec-&amp;gt;splitdir('foo/bar/baz') on Unix.&lt;BR /&gt;&lt;BR /&gt;There are also assorted Date::* modules if in fact you are really interested in dates rather filename components (can't tell from your example).</description>
      <pubDate>Wed, 25 Jun 2008 16:05:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/vms-to-unix-script-re-writes/m-p/4222058#M44195</guid>
      <dc:creator>Craig A Berry</dc:creator>
      <dc:date>2008-06-25T16:05:05Z</dc:date>
    </item>
    <item>
      <title>Re: VMS to UNIX script re writes</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/vms-to-unix-script-re-writes/m-p/4222059#M44196</link>
      <description>&amp;gt;Semi-mindless DCL -&amp;gt; shell-script translation may be far from the right approach.&lt;BR /&gt;&lt;BR /&gt;warning: opinions and generalizations follow&lt;BR /&gt;&lt;BR /&gt;There are trade-offs.&lt;BR /&gt;&lt;BR /&gt;Mindless translation is more likely to give a correctly working result, get the result more quickly and with less effort.&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;If there is a *lot* of DCL to migrate then I would favour mindless translation.&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;But then I wouldn't favour any port from VMS to something else. (-:&lt;BR /&gt;</description>
      <pubDate>Wed, 25 Jun 2008 22:29:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/vms-to-unix-script-re-writes/m-p/4222059#M44196</guid>
      <dc:creator>Derek Garson</dc:creator>
      <dc:date>2008-06-25T22:29:35Z</dc:date>
    </item>
    <item>
      <title>Re: VMS to UNIX script re writes</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/vms-to-unix-script-re-writes/m-p/4222060#M44197</link>
      <description>So you're looking for Unix expertise from a bunch of OpenVMS folks?  Not the path I'd choose.  Ask some Unix folks.&lt;BR /&gt;&lt;BR /&gt;Do get yourself a bash manual (bash shell assumed) and look up substring expressions.  There are various excellent bash guides and resources around.&lt;BR /&gt;&lt;BR /&gt;Here's a basic bash replacement:&lt;BR /&gt;&lt;BR /&gt;$ fodder=ab001122&lt;BR /&gt;$ echo ${fodder:6:2}${fodder:4:2}${fodder:2:2}&lt;BR /&gt;221100&lt;BR /&gt;&lt;BR /&gt;Your DCL could be shorter, too.&lt;BR /&gt;&lt;BR /&gt;The $ dollar here is the bash prompt, and not DCL.&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;And yes, there are folks around that are reasonably conversant in both OpenVMS and DCL, and in bash.&lt;BR /&gt;&lt;BR /&gt;Stephen Hoffman&lt;BR /&gt;HoffmanLabs LLC&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 26 Jun 2008 02:08:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/vms-to-unix-script-re-writes/m-p/4222060#M44197</guid>
      <dc:creator>Hoff</dc:creator>
      <dc:date>2008-06-26T02:08:36Z</dc:date>
    </item>
  </channel>
</rss>

