<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Approximatrix Forums — I/O Help: Understanding how to set up data Files]]></title>
		<link>https://forums.approximatrix.com/viewtopic.php?id=97</link>
		<atom:link href="https://forums.approximatrix.com/extern.php?action=feed&amp;tid=97&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in I/O Help: Understanding how to set up data Files.]]></description>
		<lastBuildDate>Fri, 25 May 2012 22:30:08 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: I/O Help: Understanding how to set up data Files]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=311#p311</link>
			<description><![CDATA[<p>Yes, for the v simple example I gave, I agree with that.&nbsp; I&#039;ve corrected my previous post as you say.&nbsp; The advantage of using &#039;LUI&#039; and &#039;LUO&#039; is that you can set them to 5 and 6 if you want screen input and output, without having to have different FORMAT statements, depending on where the I/O reads and writes.</p><p>If you want to have the program executable and data + results files in different parts of teh directory structure, you&#039;ll need to use use pathnames instead of filenames, in which case the filemane variable will need to be much larger.</p><p>I gave this example to try to help you get started but I am no longer using this method of opening files.&nbsp; I&#039;m using DISLIN instead, to create a GUI and use Windows filename requesters (dialog boxes).&nbsp; </p><p>This is what a Fortran statement looks like to open a file by the DISLIN GUI method (this sends a dialog box to the screen with the prompt shown in the CALL statement):</p><p>&nbsp; &nbsp; &nbsp; CALL dwgfil(&#039;INPUT file name&#039;, InF%NAM, &#039;*.*&#039;)</p><p>I suggest, though, that you get the hang of using a DOS interface before having a crack at the DISLIN method.</p><p>Good luck with it.<br />-- <br />John</p>]]></description>
			<author><![CDATA[null@example.com (JohnWasilewski)]]></author>
			<pubDate>Fri, 25 May 2012 22:30:08 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=311#p311</guid>
		</item>
		<item>
			<title><![CDATA[Re: I/O Help: Understanding how to set up data Files]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=310#p310</link>
			<description><![CDATA[<p>John,</p><p>Thanks for the reply and the code which I believe I understand....before I test this, could you confirm the unit number for input and output should NOT be 5 or 6 (designating keyboard and screen) and that the data file should be stored in the same directory as the project?</p><p>Regards</p><p>Euan</p>]]></description>
			<author><![CDATA[null@example.com (Euan)]]></author>
			<pubDate>Fri, 25 May 2012 20:40:36 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=310#p310</guid>
		</item>
		<item>
			<title><![CDATA[Re: I/O Help: Understanding how to set up data Files]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=308#p308</link>
			<description><![CDATA[<p>If I had a text file containing these two lines<br />SOME TEXT (20 chars)<br />&nbsp; &nbsp; &nbsp; 10&nbsp; &nbsp; &nbsp; 11&nbsp; &nbsp; &nbsp; 12&nbsp; &nbsp;3.143&nbsp; &nbsp; 2.54&nbsp; &nbsp; &nbsp;1.5</p><p>I&#039;d expect a program containing the following code to read them into variables StringA, I,J,K, X,Y,Z</p><br /><p>C<br />C<br />C<br />&nbsp; &nbsp; &nbsp; CHARACTER FiNAM*12, StringA*20</p><p>C&nbsp; &nbsp; &nbsp;Provide some code to :<br />C&nbsp; &nbsp; &nbsp; &nbsp;- prompt user for a filename in FiNAM<br />C&nbsp; &nbsp; &nbsp; &nbsp;- assign a value to LUI (eg 7)<br />C&nbsp; &nbsp; &nbsp; &nbsp;- assign a value to LUO (eg 8)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;OPEN(UNIT=LUI,<br />&nbsp; &nbsp; &nbsp;+&nbsp; &nbsp; &nbsp; &nbsp; FILE=FiNAM,<br />&nbsp; &nbsp; &nbsp;+&nbsp; &nbsp; &nbsp; &nbsp; STATUS=&#039;OLD&#039;,<br />&nbsp; &nbsp; &nbsp;+&nbsp; &nbsp; &nbsp; &nbsp; ERR=50,<br />&nbsp; &nbsp; &nbsp;+&nbsp; &nbsp; &nbsp; &nbsp; IOSTAT=IOCODE )</p><p>C&nbsp; &nbsp; &nbsp; &nbsp; No ERR, so say so<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;WRITE(LUO,&#039;(&#039;&#039; Opened.&#039;&#039;)&#039;)</p><p>&nbsp; &nbsp; &nbsp; READ(LUI, &#039;(A)&#039;) StringA<br />&nbsp; &nbsp; &nbsp; READ(LUI, &#039;(3I8,3F8.3)&#039;) I,J,K, X,Y,Z<br />C<br />C<br />C</p><br /><br /><p>50&nbsp; &nbsp; &nbsp; &nbsp;CONTINUE<br />C&nbsp; &nbsp; &nbsp; &nbsp; Error-handling<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;WRITE(LUS,&#039;(&#039;&#039;Error code [&#039;&#039;,I4,&#039;&#039;].&#039;&#039;)&#039;) IOCODE</p><br /><p>-----<br />John</p>]]></description>
			<author><![CDATA[null@example.com (JohnWasilewski)]]></author>
			<pubDate>Fri, 25 May 2012 07:09:10 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=308#p308</guid>
		</item>
		<item>
			<title><![CDATA[I/O Help: Understanding how to set up data Files]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=307#p307</link>
			<description><![CDATA[<p>I would like to have my Fortran program open and read data files, then write back to files at the end of the program. I have written a simple program to open and read a data file that is in the same top level directory as the build and modules folders. I have no idea how to create a data file. I tried to use notepad to create a vertical list of numbers (each number on a new line) with no commas or punctuation. I called the file read1.DAT, changing the .txt extension to a .DAT</p><p>I have written the program to open the file and return a value for IOSTAT. If the file opens, IOSTAT=0 and the reading process is supposed to begin.&nbsp; </p><p>The first time I did this, I tried to open the read1.DAT file. . This was not successful, returning the error message &quot;an error occurred reading line 1&quot; which indicated that the file was opened but could not be read.</p><p>I then created an identical file and called it read1.txt. This time I received a message saying that there was an error opening the file, IOSTAT=2 (I don&#039;t know what this signifies except that the file was not opened properly).</p><p>Please help me understand how to set up files that contain data that can be read by my Simply Fortran code. I&#039;m not sure if the files have to be labeled &quot;.DAT&quot; or if there are any rules on how to set them up so the program can read them. Any help would be gratefully received.</p><p>Regards</p><p>Euan</p>]]></description>
			<author><![CDATA[null@example.com (Euan)]]></author>
			<pubDate>Fri, 25 May 2012 00:11:51 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=307#p307</guid>
		</item>
	</channel>
</rss>
