<?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: DCL scripting - using WRITE to file in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/dcl-scripting-using-write-to-file/m-p/5355407#M36455</link>
    <description>&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;2 good suggestions&lt;/P&gt;&lt;P&gt;I have implemented simply creating a text string with the&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;buffer = buffer + text&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and then write that to the file on completion&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;cheers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 07 Oct 2011 07:03:47 GMT</pubDate>
    <dc:creator>robert70</dc:creator>
    <dc:date>2011-10-07T07:03:47Z</dc:date>
    <item>
      <title>DCL scripting - using WRITE to file</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-scripting-using-write-to-file/m-p/5354803#M36451</link>
      <description>&lt;P&gt;Using WRITE to a file in a command eg.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$ OPEN/WRITE HFILE D:[USER]TEST.TXT&lt;/P&gt;&lt;P&gt;$ WRITE HFILE " FAILURE @ ''TIME' , "&lt;/P&gt;&lt;P&gt;$ WRITE HFILE "&amp;nbsp;DATE IS&amp;nbsp;&amp;nbsp;''DATE'"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For reasons I wont go into here I must outpout the file test.txt in 2 seperate write statements but I want both outputs to appear on the same line&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;eg&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FAILURE @ 13:03:33 , DATE is 12-10-11&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and not what I am getting eg&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FAILURE @ 13:03:33 ,&lt;/P&gt;&lt;P&gt;DATE is 12-10-11&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you write an ascii backspace&amp;nbsp;at the start of the 2nd WRITE perhaps?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried with&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$WRITE HFILE "{ESC}[1D"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But this dosent appear to work&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2011 15:55:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-scripting-using-write-to-file/m-p/5354803#M36451</guid>
      <dc:creator>robert70</dc:creator>
      <dc:date>2011-10-06T15:55:57Z</dc:date>
    </item>
    <item>
      <title>Re: DCL scripting - using WRITE to file</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-scripting-using-write-to-file/m-p/5354857#M36452</link>
      <description>&lt;P&gt;DCL does not work the way you want and need here, so you're going to have to re-open the file and rewrite the records within the file to account for that second WRITE statement. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or migrate to a language that can manage the records in the fashion you seek here; Python, Perl, php, Lua, etc. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or figure out some other way to modify the existing record in the existing file; on Unix, I'd use sed here, and while editing a file from within a DCL procedure is feasible on VMS, it's unfortunately somewhat more effort than sed, and gnv is wonky at best. &amp;nbsp;If you have a good solid target, then the VMS SUMSLP editor would potentially work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And in general, you will always want to issue the matching CLOSE /NOLOG just before an OPEN command:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CLOSE /NOLOG HFILE ﻿&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This ensures the I/O channel is always closed, as these can be left open and dangling from a previous error.﻿&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"For reasons I wont go into here"? &amp;nbsp; So then relevent management is either complicit in or ignorant of the decision, eh?&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2011 16:37:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-scripting-using-write-to-file/m-p/5354857#M36452</guid>
      <dc:creator>Hoff</dc:creator>
      <dc:date>2011-10-06T16:37:50Z</dc:date>
    </item>
    <item>
      <title>Re: DCL scripting - using WRITE to file</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-scripting-using-write-to-file/m-p/5354935#M36453</link>
      <description>&lt;DIV&gt;As we know from Down Under, you can force the output file to stream_lf. Then, after the first write, you can adjust EOF and overwrite the '\n' with the second write. Whether this is worth the effort is a different question and very likely depends on reasons you didn't want to go into.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;$ create/fdl=sys$input test.txt&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;record&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; format stream_lf&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;$ OPEN/append HFILE TEST.TXT&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;$ WRITE HFILE " FAILURE @ ''TIME' , "&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;$ close hfile&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;$ ffb=f$file ("test.txt","ffb")&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;$ ebk=f$file ("test.txt","eof")&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;$! in this example ffb is 21, but in general:&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;$ if ffb .eq. 0&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;$ then&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;$ ffb= 511&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;$ ebk= ebk-1&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;$ else&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;$ ffb= ffb-1&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;$ endif&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;$ set file/attr=(ffb='ffb,ebk='ebk) test.txt&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;$ open/append hfile test.txt&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;$ WRITE HFILE " DATE IS &amp;nbsp;''DATE'"&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;$ close hfile&lt;/FONT&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 06 Oct 2011 17:26:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-scripting-using-write-to-file/m-p/5354935#M36453</guid>
      <dc:creator>H.Becker</dc:creator>
      <dc:date>2011-10-06T17:26:18Z</dc:date>
    </item>
    <item>
      <title>Re: DCL scripting - using WRITE to file</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-scripting-using-write-to-file/m-p/5355099#M36454</link>
      <description>&lt;P&gt;You can play around hacking at the file attributes as described&amp;nbsp;by Hartmut (neat hack!), but it might be better to change your I/O model. Build yourself a module of&amp;nbsp;routines&amp;nbsp;surrounding the output file which implement the operations&amp;nbsp;you want to be able to&amp;nbsp;perform. This can be as elaborate&amp;nbsp;as you want, or as simple as possible.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FILEOPEN&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; OPEN/WRITE file name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; buffer=""&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FILECLOSE&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; FILEWRITELN&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; CLOSE file&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FILEWRITE&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; buffer=buffer+text&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FILEWRITELN&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; FILEWRITE text&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; WRITE file buffer&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;buffer=""&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(Object oriented DCL? ;-)&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2011 21:27:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-scripting-using-write-to-file/m-p/5355099#M36454</guid>
      <dc:creator>John Gillings</dc:creator>
      <dc:date>2011-10-06T21:27:17Z</dc:date>
    </item>
    <item>
      <title>Re: DCL scripting - using WRITE to file</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-scripting-using-write-to-file/m-p/5355407#M36455</link>
      <description>&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;2 good suggestions&lt;/P&gt;&lt;P&gt;I have implemented simply creating a text string with the&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;buffer = buffer + text&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and then write that to the file on completion&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;cheers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Oct 2011 07:03:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-scripting-using-write-to-file/m-p/5355407#M36455</guid>
      <dc:creator>robert70</dc:creator>
      <dc:date>2011-10-07T07:03:47Z</dc:date>
    </item>
    <item>
      <title>Re: DCL scripting - using WRITE to file</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-scripting-using-write-to-file/m-p/5355599#M36456</link>
      <description>&lt;P&gt;"Completion" implies some form of logging and potentially scheduling and job control tasks are involved.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Guessing...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The VMS job control and job scheduling implementation is unfortunately very weak and only getting weaker in comparison with other platforms, but there are ways to implement your own on VMS. &amp;nbsp;And there are also open-source and third-party commercial job scheduling options.﻿&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Available options can include using OPCOM and post-processing OPERATOR.LOG as a potential solution, or using a sequential or indexed RMS file as a status database (that's fairly common, and fairly quick to implement), or using user-generated accounting messages, or various other available solutions. &amp;nbsp; I've also seen folks use logical names and sometimes logical names in shared tables here in place of the symbols you're now targetting, too.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd look to use a scheduling package of some sort, as re-implementing your own isn't particularly cost-effective. &amp;nbsp;And you get to solve problems folks have already solved. &amp;nbsp;Failing that option, a simple RMS database is probably the best choice.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Oct 2011 10:14:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-scripting-using-write-to-file/m-p/5355599#M36456</guid>
      <dc:creator>Hoff</dc:creator>
      <dc:date>2011-10-07T10:14:01Z</dc:date>
    </item>
  </channel>
</rss>

