<?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: Using PIPE to Open and Read a File in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/using-pipe-to-open-and-read-a-file/m-p/3775276#M9596</link>
    <description>How about&lt;BR /&gt;&lt;BR /&gt;$ @COMPARE_STUFF&lt;BR /&gt;&lt;BR /&gt;where compare_stuff.com contains the open/read/close&lt;BR /&gt;etc...?&lt;BR /&gt;&lt;BR /&gt;Dave&lt;BR /&gt;</description>
    <pubDate>Thu, 20 Apr 2006 21:58:27 GMT</pubDate>
    <dc:creator>David B Sneddon</dc:creator>
    <dc:date>2006-04-20T21:58:27Z</dc:date>
    <item>
      <title>Using PIPE to Open and Read a File</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/using-pipe-to-open-and-read-a-file/m-p/3775275#M9595</link>
      <description>I have a flat text file with a six digit date (yymmdd) imbedded inside a string of characters on the first line of the file.  I want a single command to open the file, read the line, parse out the date, and compare it to what I expect it to be.  I am trying to use this but not having any luck:&lt;BR /&gt;&lt;BR /&gt;PIPE OPEN/READ/SHARE FILUN FNAME.TXT | READ FILUN FSTR | CLOSE FILUN | FILDAT=F$EXTRACT(73,6,FSTR) | IF "''FILDAT'" .NES. "060420" THEN EXIT 44&lt;BR /&gt;&lt;BR /&gt;Please help - thank you!</description>
      <pubDate>Thu, 20 Apr 2006 21:05:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/using-pipe-to-open-and-read-a-file/m-p/3775275#M9595</guid>
      <dc:creator>Lin Park</dc:creator>
      <dc:date>2006-04-20T21:05:55Z</dc:date>
    </item>
    <item>
      <title>Re: Using PIPE to Open and Read a File</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/using-pipe-to-open-and-read-a-file/m-p/3775276#M9596</link>
      <description>How about&lt;BR /&gt;&lt;BR /&gt;$ @COMPARE_STUFF&lt;BR /&gt;&lt;BR /&gt;where compare_stuff.com contains the open/read/close&lt;BR /&gt;etc...?&lt;BR /&gt;&lt;BR /&gt;Dave&lt;BR /&gt;</description>
      <pubDate>Thu, 20 Apr 2006 21:58:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/using-pipe-to-open-and-read-a-file/m-p/3775276#M9596</guid>
      <dc:creator>David B Sneddon</dc:creator>
      <dc:date>2006-04-20T21:58:27Z</dc:date>
    </item>
    <item>
      <title>Re: Using PIPE to Open and Read a File</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/using-pipe-to-open-and-read-a-file/m-p/3775277#M9597</link>
      <description>Lin, looks like you have a UNIX background. Remember when writing procedures, that's not just a dialog between you and the computer but involves the support staff or others who one day may have to examine your work for what ever reason.</description>
      <pubDate>Thu, 20 Apr 2006 23:12:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/using-pipe-to-open-and-read-a-file/m-p/3775277#M9597</guid>
      <dc:creator>Thomas Ritter</dc:creator>
      <dc:date>2006-04-20T23:12:14Z</dc:date>
    </item>
    <item>
      <title>Re: Using PIPE to Open and Read a File</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/using-pipe-to-open-and-read-a-file/m-p/3775278#M9598</link>
      <description>Lin,&lt;BR /&gt;&lt;BR /&gt;  Yes, you can use PIPE to do this, but since this is really a sequence of commands to be executed sequentially, rather than a cascade of pipes, you need to enclose the sequence in parentheses and use the ";" separator, rather than "|"&lt;BR /&gt;&lt;BR /&gt;  So, &lt;BR /&gt;&lt;BR /&gt;$ PIPE (OPEN/READ/SHARE FILUN FNAME.TXT ; -&lt;BR /&gt; READ FILUN FSTR ; CLOSE FILUN ; -&lt;BR /&gt; FILDAT=F$EXTRACT(73,6,FSTR) ; -&lt;BR /&gt; IF FILDAT.NES."060420" THEN EXIT 44)&lt;BR /&gt;&lt;BR /&gt;Note you must have a space on either side of every ";" character so DCL knows it's not a file version number delimiter. I've also used continuation characters and explicit line feeds to make it more readable, but it could just be one long command.&lt;BR /&gt;&lt;BR /&gt;Note that since it's just the first line you're interested in, using a "real" pipe you can shorten the sequence to:&lt;BR /&gt;&lt;BR /&gt;$ PIPE TYPE FNAME.TXT | -&lt;BR /&gt;(READ SYS$PIPE FSTR ; -&lt;BR /&gt; FILDAT=F$EXTRACT(73,6,FSTR) ; -&lt;BR /&gt; IF FILDAT.NES."060420" THEN EXIT 44)&lt;BR /&gt;&lt;BR /&gt;Although it's less characters, it involves an extra process creation, so may be slower.&lt;BR /&gt;&lt;BR /&gt;As others have pointed out, this could be done using a command procedure, but then the pipe command could be stored in a single symbol, thus making it independent of a file.</description>
      <pubDate>Thu, 20 Apr 2006 23:41:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/using-pipe-to-open-and-read-a-file/m-p/3775278#M9598</guid>
      <dc:creator>John Gillings</dc:creator>
      <dc:date>2006-04-20T23:41:57Z</dc:date>
    </item>
    <item>
      <title>Re: Using PIPE to Open and Read a File</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/using-pipe-to-open-and-read-a-file/m-p/3775279#M9599</link>
      <description>David - thanks for the suggestion but I am trying to do this without having a command procedure.&lt;BR /&gt;&lt;BR /&gt;Thomas - thanks for that.&lt;BR /&gt;&lt;BR /&gt;John - your response was quite helpful and the first one worked perfectly.  Thank You VERY MUCH!!!!!</description>
      <pubDate>Fri, 21 Apr 2006 11:14:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/using-pipe-to-open-and-read-a-file/m-p/3775279#M9599</guid>
      <dc:creator>Lin Park</dc:creator>
      <dc:date>2006-04-21T11:14:33Z</dc:date>
    </item>
    <item>
      <title>Re: Using PIPE to Open and Read a File</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/using-pipe-to-open-and-read-a-file/m-p/3775280#M9600</link>
      <description>Hmmm... I _love_ one liners. Honestly. But to create a subprocess just to be able to stick more than 1 command on a line it crazy, notbaly if that line is 'unmanageably' long.&lt;BR /&gt;&lt;BR /&gt;Check out: $pipe ( show proc )&lt;BR /&gt;&lt;BR /&gt;It would be kinda nice if DCL understood the parenthesis syntax without a pipe &amp;amp; subprocess:&lt;BR /&gt;$(command-1; command-2; ... )&lt;BR /&gt;&lt;BR /&gt;Might I suggest:&lt;BR /&gt;&lt;BR /&gt;$ perl -e "exit 44 if ('060420' ne substr &amp;lt;&amp;gt;,73,6)" fname.txt&lt;BR /&gt;&lt;BR /&gt;hth,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 21 Apr 2006 12:52:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/using-pipe-to-open-and-read-a-file/m-p/3775280#M9600</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2006-04-21T12:52:07Z</dc:date>
    </item>
    <item>
      <title>Re: Using PIPE to Open and Read a File</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/using-pipe-to-open-and-read-a-file/m-p/3775281#M9601</link>
      <description>I agree that it's silly to create a subprocess for this, and that's what the parentheses will do (create a subshell).  But are they needed?  Why not just:&lt;BR /&gt;&lt;BR /&gt;$ PIPE OPEN/READ/SHARE FILUN FNAME.TXT ; -&lt;BR /&gt;READ FILUN FSTR ; CLOSE FILUN ; -&lt;BR /&gt;FILDAT=F$EXTRACT(73,6,FSTR) ; -&lt;BR /&gt;IF FILDAT.NES."060420" THEN EXIT 44&lt;BR /&gt;&lt;BR /&gt;You might want to use &amp;amp;&amp;amp; in place of the first two ;s since if you can't open or read the file then the rest can't be done either.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 24 Apr 2006 12:47:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/using-pipe-to-open-and-read-a-file/m-p/3775281#M9601</guid>
      <dc:creator>Jess Goodman</dc:creator>
      <dc:date>2006-04-24T12:47:32Z</dc:date>
    </item>
    <item>
      <title>Re: Using PIPE to Open and Read a File</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/using-pipe-to-open-and-read-a-file/m-p/3775282#M9602</link>
      <description>Jess,&lt;BR /&gt;&lt;BR /&gt;it is not the parentheses that give rise to the subproces, it is the PIPE command that does that.&lt;BR /&gt;So, your solution also creates a subprocess.&lt;BR /&gt;&lt;BR /&gt;fwiw,&lt;BR /&gt;&lt;BR /&gt;Proost.&lt;BR /&gt;&lt;BR /&gt;Have one on me (perhaps in May in Nashua&amp;gt;)&lt;BR /&gt;&lt;BR /&gt;jpe</description>
      <pubDate>Mon, 24 Apr 2006 14:43:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/using-pipe-to-open-and-read-a-file/m-p/3775282#M9602</guid>
      <dc:creator>Jan van den Ende</dc:creator>
      <dc:date>2006-04-24T14:43:27Z</dc:date>
    </item>
    <item>
      <title>Re: Using PIPE to Open and Read a File</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/using-pipe-to-open-and-read-a-file/m-p/3775283#M9603</link>
      <description>Jan, did you try?&lt;BR /&gt;&lt;BR /&gt;Check out:&lt;BR /&gt;&lt;BR /&gt;$Help pipe description&lt;BR /&gt;&lt;BR /&gt;or try:&lt;BR /&gt;&lt;BR /&gt;$show proc&lt;BR /&gt;$ pipe open x x.tmp ; read x y ; show process ; show symb y&lt;BR /&gt;&lt;BR /&gt;Jess, &lt;BR /&gt;&lt;BR /&gt;Thanks for that entry. You are right. I only ever used pipe to pipe into a next process, but that's only one of its features. I learned something new today!&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Mon, 24 Apr 2006 16:05:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/using-pipe-to-open-and-read-a-file/m-p/3775283#M9603</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2006-04-24T16:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: Using PIPE to Open and Read a File</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/using-pipe-to-open-and-read-a-file/m-p/3775284#M9604</link>
      <description>Well,&lt;BR /&gt;&lt;BR /&gt;Hein, that makes 2 who learned! Until now I took "PIPE = create subprocess" for granted.&lt;BR /&gt;&lt;BR /&gt;Thanks, Jess!&lt;BR /&gt;&lt;BR /&gt;Proost.&lt;BR /&gt;&lt;BR /&gt;Have one on me (maybe in May in Nashua?)&lt;BR /&gt;&lt;BR /&gt;jpe</description>
      <pubDate>Tue, 25 Apr 2006 05:14:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/using-pipe-to-open-and-read-a-file/m-p/3775284#M9604</guid>
      <dc:creator>Jan van den Ende</dc:creator>
      <dc:date>2006-04-25T05:14:19Z</dc:date>
    </item>
  </channel>
</rss>

