<?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 1. Read the index file into in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/forrt1-severe-24-end-of-file-during-read/m-p/1081762#M122044</link>
    <description>&lt;P&gt;Something like this:&lt;/P&gt;

&lt;P&gt;1 Read index file&lt;/P&gt;

&lt;P&gt;2 Read data file&lt;/P&gt;

&lt;P&gt;3 Output the data e.g.&lt;/P&gt;

&lt;P&gt;do I = 1,3&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; do j = 1,3&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (I .eq. index(j)) then&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; write(33, *) data(j)&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; endif&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; enddo&lt;/P&gt;

&lt;P&gt;enddo&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 11 Jan 2016 15:17:00 GMT</pubDate>
    <dc:creator>Les_Neilson</dc:creator>
    <dc:date>2016-01-11T15:17:00Z</dc:date>
    <item>
      <title>forrt1: severe (24): end-of-file during read</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/forrt1-severe-24-end-of-file-during-read/m-p/1081755#M122037</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;

&lt;P&gt;I am getting the following message after running the code:&lt;/P&gt;

&lt;P&gt;forrt1: severe (24): end-of-file during read...&lt;/P&gt;

&lt;P&gt;What does this mean?&lt;/P&gt;

&lt;P&gt;Basically, I'd like to sort the following column of numbers into an order based on their indices:&lt;/P&gt;

&lt;P&gt;Example:&lt;/P&gt;

&lt;P&gt;12&lt;/P&gt;

&lt;P&gt;3&lt;/P&gt;

&lt;P&gt;8&lt;/P&gt;

&lt;P&gt;The index order is:&lt;/P&gt;

&lt;P&gt;3&lt;/P&gt;

&lt;P&gt;2&lt;/P&gt;

&lt;P&gt;1&lt;/P&gt;

&lt;P&gt;So, the expected output is:&lt;/P&gt;

&lt;P&gt;8&lt;/P&gt;

&lt;P&gt;3&lt;/P&gt;

&lt;P&gt;12&lt;/P&gt;

&lt;P&gt;What I am getting in the output file is:&lt;/P&gt;

&lt;P&gt;12&lt;/P&gt;

&lt;P&gt;Please could anyone help?&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2016 12:17:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/forrt1-severe-24-end-of-file-during-read/m-p/1081755#M122037</guid>
      <dc:creator>Chin_Wei_L_</dc:creator>
      <dc:date>2016-01-11T12:17:46Z</dc:date>
    </item>
    <item>
      <title>It is not quite clear from</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/forrt1-severe-24-end-of-file-during-read/m-p/1081756#M122038</link>
      <description>&lt;P&gt;It is not quite clear from your description, but I guess that you are reading the data from a file. Apparently this is not going the way you expect it - the program reaches the end of the file before it has been able to read all the data it expects to find there, hence the error message.&lt;/P&gt;

&lt;P&gt;To help you, we will need to know more about what your program is doing. Could you post the parts that are reading the file? Include the declarations of the variables, that may be important.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2016 12:40:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/forrt1-severe-24-end-of-file-during-read/m-p/1081756#M122038</guid>
      <dc:creator>Arjen_Markus</dc:creator>
      <dc:date>2016-01-11T12:40:20Z</dc:date>
    </item>
    <item>
      <title>Hi</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/forrt1-severe-24-end-of-file-during-read/m-p/1081757#M122039</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;Thank you for your reply.&lt;/P&gt;

&lt;P&gt;Both data and index order are read in from text files, respectively.&lt;/P&gt;

&lt;P&gt;The data.txt file contains a column of numbers:&lt;/P&gt;

&lt;P&gt;12&lt;/P&gt;

&lt;P&gt;3&lt;/P&gt;

&lt;P&gt;8&lt;/P&gt;

&lt;P&gt;The index.txt file contains a column of indices:&lt;/P&gt;

&lt;P&gt;3&lt;/P&gt;

&lt;P&gt;2&lt;/P&gt;

&lt;P&gt;1&lt;/P&gt;

&lt;P&gt;I would like to sort the numbers based on their indices in that particular order as in the index.txt and then write out to sorted.txt.&lt;/P&gt;

&lt;P&gt;The Fortran code is:&lt;/P&gt;

&lt;P&gt;program sort&lt;/P&gt;

&lt;P&gt;implicit none&lt;/P&gt;

&lt;P&gt;integer i, j, data(3), index(3)&lt;/P&gt;

&lt;P&gt;open(11, file='data.txt', status='old')&lt;/P&gt;

&lt;P&gt;open(22, file='index.txt', status='old')&lt;/P&gt;

&lt;P&gt;open(33, file='sorted.txt', status='new')&lt;/P&gt;

&lt;P&gt;do 101 i=1, 3&lt;/P&gt;

&lt;P&gt;&amp;nbsp; do 201 j=1, 3&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp; read(22, *) index(j)&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if (index(j) == i) then&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; read(11, *) data(i)&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; write(33, *) data(i)&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; go to 101&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;else&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; go to 201&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;end if&lt;/P&gt;

&lt;P&gt;&amp;nbsp;201 &amp;nbsp;continue&lt;/P&gt;

&lt;P&gt;101 continue&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp;close(11)&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp;close(22)&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp;close(33)&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp;stop&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp;end&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Something wrong with this code?&lt;/P&gt;

&lt;P&gt;Any comments welcome.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2016 13:02:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/forrt1-severe-24-end-of-file-during-read/m-p/1081757#M122039</guid>
      <dc:creator>Chin_Wei_L_</dc:creator>
      <dc:date>2016-01-11T13:02:51Z</dc:date>
    </item>
    <item>
      <title>Well, if there is anything</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/forrt1-severe-24-end-of-file-during-read/m-p/1081758#M122040</link>
      <description>&lt;P&gt;Well, if there is anything wrong with the code perse, is a rather philosophical question ;). But it definitely is not doing what you want. Your code searches for the line that contains the value of i, but it does not rewind the file, so on the next value of i (loop 101), it reaches the end of the file and then you get the error message. Instead you could do:&lt;/P&gt;

&lt;UL&gt;
	&lt;LI&gt;Read the indices&lt;/LI&gt;
	&lt;LI&gt;Read the data&lt;/LI&gt;
	&lt;LI&gt;Write out the data in the order given by the indices&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;You are already storing the data and the indices in arrays, so use that feature.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2016 13:15:29 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/forrt1-severe-24-end-of-file-during-read/m-p/1081758#M122040</guid>
      <dc:creator>Arjen_Markus</dc:creator>
      <dc:date>2016-01-11T13:15:29Z</dc:date>
    </item>
    <item>
      <title>Hi</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/forrt1-severe-24-end-of-file-during-read/m-p/1081759#M122041</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;Thank you for the tips.&lt;/P&gt;

&lt;P&gt;However, I think I am complicated myself with the following:&lt;/P&gt;

&lt;UL style="line-height: 21.3px; margin-bottom: 20px; margin-left: 1em; padding-left: 1em; color: rgb(68, 68, 68); font-family: Calibri, sans-serif; font-size: 15px;"&gt;
	&lt;LI style="line-height: 21.3px; margin-bottom: 3px;"&gt;Write out the data in the order given by the indices&lt;/LI&gt;
&lt;/UL&gt;

&lt;P style="line-height: 21.3px; margin-bottom: 3px;"&gt;Please could you provide more insight?&amp;nbsp;&lt;/P&gt;

&lt;P style="line-height: 21.3px; margin-bottom: 3px;"&gt;&amp;nbsp;&lt;/P&gt;

&lt;P style="line-height: 21.3px; margin-bottom: 3px;"&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2016 14:05:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/forrt1-severe-24-end-of-file-during-read/m-p/1081759#M122041</guid>
      <dc:creator>Chin_Wei_L_</dc:creator>
      <dc:date>2016-01-11T14:05:04Z</dc:date>
    </item>
    <item>
      <title>Since the index for the data</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/forrt1-severe-24-end-of-file-during-read/m-p/1081760#M122042</link>
      <description>&lt;P&gt;Since the index for the data is in the array index, you can use data(index(i)) to get the value that should appear in the i-th position&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2016 14:07:22 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/forrt1-severe-24-end-of-file-during-read/m-p/1081760#M122042</guid>
      <dc:creator>Arjen_Markus</dc:creator>
      <dc:date>2016-01-11T14:07:22Z</dc:date>
    </item>
    <item>
      <title>Hi</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/forrt1-severe-24-end-of-file-during-read/m-p/1081761#M122043</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;Many apologies as I am still struggling with this.&lt;/P&gt;

&lt;P&gt;Please could further help with demonstrating an example of the code?&lt;/P&gt;

&lt;P&gt;(Beginner)&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2016 15:11:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/forrt1-severe-24-end-of-file-during-read/m-p/1081761#M122043</guid>
      <dc:creator>Chin_Wei_L_</dc:creator>
      <dc:date>2016-01-11T15:11:39Z</dc:date>
    </item>
    <item>
      <title>1. Read the index file into</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/forrt1-severe-24-end-of-file-during-read/m-p/1081762#M122044</link>
      <description>&lt;P&gt;Something like this:&lt;/P&gt;

&lt;P&gt;1 Read index file&lt;/P&gt;

&lt;P&gt;2 Read data file&lt;/P&gt;

&lt;P&gt;3 Output the data e.g.&lt;/P&gt;

&lt;P&gt;do I = 1,3&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; do j = 1,3&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (I .eq. index(j)) then&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; write(33, *) data(j)&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; endif&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; enddo&lt;/P&gt;

&lt;P&gt;enddo&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2016 15:17:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/forrt1-severe-24-end-of-file-during-read/m-p/1081762#M122044</guid>
      <dc:creator>Les_Neilson</dc:creator>
      <dc:date>2016-01-11T15:17:00Z</dc:date>
    </item>
    <item>
      <title>Well, most of it is already</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/forrt1-severe-24-end-of-file-during-read/m-p/1081763#M122045</link>
      <description>&lt;P&gt;Well, most of it is already there - you just need to read the index file in one loop and the data file in another loop. Then in a third loop you can write the data as I showed.&lt;/P&gt;

&lt;P&gt;Instead of:&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;do 101 i = 1,3
    ...
101 continue&lt;/PRE&gt;

&lt;P&gt;you can also do (and this is preferred, because you do not need to be careful with the label numbers then):&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;do i = 1,3
     ...
enddo&lt;/PRE&gt;

&lt;P&gt;Or, to make it more generic: instead of 3 as a fixed upper bound, use size() to get the right upper bound automatically:&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;do i = 1,size(index)
    read( 101, * ) index(i)
enddo&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2016 15:18:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/forrt1-severe-24-end-of-file-during-read/m-p/1081763#M122045</guid>
      <dc:creator>Arjen_Markus</dc:creator>
      <dc:date>2016-01-11T15:18:00Z</dc:date>
    </item>
    <item>
      <title>Thanks guys. The code works</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/forrt1-severe-24-end-of-file-during-read/m-p/1081764#M122046</link>
      <description>&lt;P&gt;Thanks guys. The code works with some small modifications and does the job. Very much appreciated!&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2016 16:45:56 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/forrt1-severe-24-end-of-file-during-read/m-p/1081764#M122046</guid>
      <dc:creator>Chin_Wei_L_</dc:creator>
      <dc:date>2016-01-11T16:45:56Z</dc:date>
    </item>
  </channel>
</rss>

