<?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: Index intrinsic function IVF return 0 for very big value in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Index-intrinsic-function-IVF-return-0-for-very-big-value/m-p/1402867#M162168</link>
    <description>&lt;P&gt;Hooray,&lt;/P&gt;
&lt;P&gt;I solved the problem, removed kind=8 and replaced index(str(i:) with index(str(i:i200) where i200=200. Execution time &lt;STRONG&gt;11.70 sec&lt;/STRONG&gt;. Thanks to everyone for the advice.&lt;/P&gt;
&lt;P&gt;I7-3770, 16GB RAM, W10/64bit and ssd.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;J. Roy&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 24 Jul 2022 18:43:47 GMT</pubDate>
    <dc:creator>roy437</dc:creator>
    <dc:date>2022-07-24T18:43:47Z</dc:date>
    <item>
      <title>Index intrinsic function IVF return 0 for very big value</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Index-intrinsic-function-IVF-return-0-for-very-big-value/m-p/1395680#M161848</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have a program that turns a very large stl file (4.11GB) into a pts file "stl_to_pts.f90".&amp;nbsp;&amp;nbsp;An example stl file:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;solid ASCII STL file generated with VxScan by Creaform.&lt;BR /&gt;facet normal 0.284589 0.628278 -0.724069&lt;BR /&gt;outer loop&lt;BR /&gt;vertex -1166.990479 -277.309601 656.863098&lt;BR /&gt;vertex -1166.887573 -276.861084 657.292725&lt;BR /&gt;vertex -1166.407104 -277.144348 657.235779&lt;BR /&gt;endloop&lt;BR /&gt;endfacet&lt;BR /&gt;facet normal 0.287695 0.632549 -0.719106&lt;BR /&gt;outer loop&lt;BR /&gt;vertex -1166.887573 -276.861084 657.292725&lt;BR /&gt;vertex -1166.523071 -276.255005 657.971680&lt;BR /&gt;vertex -1166.407104 -277.144348 657.235779&lt;BR /&gt;endloop&lt;BR /&gt;endfacet&lt;BR /&gt;facet normal 0.408622 0.642011 -0.648730&lt;BR /&gt;outer loop&lt;BR /&gt;vertex -1166.527466 -276.258850 657.991821&lt;BR /&gt;vertex -1166.468018 -276.235260 658.052612&lt;BR /&gt;vertex -1166.257812 -276.307129 658.113892&lt;BR /&gt;endloop&lt;BR /&gt;endfacet&lt;BR /&gt;facet normal 0.082224 0.975477 0.204167&lt;BR /&gt;outer loop&lt;BR /&gt;vertex -1166.523071 -276.255005 657.971680&lt;BR /&gt;vertex -1166.527466 -276.258850 657.991821&lt;BR /&gt;vertex -1166.257812 -276.307129 658.113892&lt;BR /&gt;endloop&lt;BR /&gt;endfacet&lt;BR /&gt;facet normal 0.466552 0.599195 -0.650611&lt;BR /&gt;outer loop&lt;BR /&gt;vertex -1166.523071 -276.255005 657.971680&lt;BR /&gt;vertex -1166.257812 -276.307129 658.113892&lt;BR /&gt;vertex -1166.407104 -277.144348 657.235779&lt;BR /&gt;endloop&lt;BR /&gt;endfacet&lt;BR /&gt;facet normal 0.302361 0.775017 -0.554911&lt;BR /&gt;outer loop&lt;BR /&gt;vertex -1166.468018 -276.235260 658.052612&lt;BR /&gt;vertex -1166.377808 -276.043121 658.370117&lt;BR /&gt;vertex -1166.155640 -276.129272 658.370850&lt;BR /&gt;endloop&lt;BR /&gt;endfacet&lt;BR /&gt;facet normal 0.409470 0.665844 -0.623687&lt;BR /&gt;outer loop&lt;BR /&gt;vertex -1166.468018 -276.235260 658.052612&lt;BR /&gt;vertex -1166.155640 -276.129272 658.370850&lt;BR /&gt;vertex -1166.257812 -276.307129 658.113892&lt;BR /&gt;endloop&lt;BR /&gt;endfacet&lt;BR /&gt;facet normal 0.316780 0.659006 -0.682174&lt;BR /&gt;outer loop&lt;BR /&gt;vertex -1166.407104 -277.144348 657.235779&lt;BR /&gt;vertex -1166.257812 -276.307129 658.113892&lt;BR /&gt;vertex -1165.399780 -277.246002 657.605347&lt;BR /&gt;endloop&lt;BR /&gt;endfacet&lt;BR /&gt;endsolid&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Source code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;    module read_fis
       character *260 fisi
       character(:), allocatable :: str
    end module read_fis

    subroutine read_file_to_string
    use ifport
    use read_fis
    implicit none
    integer *4 :: iunit, istat
    integer *8 :: file_size
    character(len=1) :: c
    open(newunit = iunit, file = fisi, status = 'OLD', &amp;amp;
            form = 'UNFORMATTED', access = 'STREAM', iostat = istat)
    if (istat==0) then
        inquire(file=fisi, size=file_size )
        if (file_size &amp;gt; 0) then
            allocate(character(len=file_size ) :: str)
            read(iunit, pos=1, iostat = istat) str
            if (istat==0) then
                !make sure it was all read by trying to read more:
                read(iunit, pos = file_size+1, iostat = istat) c
                if (.not. IS_IOSTAT_END(istat)) then
                    write(*,*) 'Error: file was not completely read: ', trim(fisi)
                end if
            else
                write(*,*) 'Error reading file: ', trim(fisi)
            end if
            close(iunit, iostat=istat)
        else
            write(*,*) 'Error getting file size: ',  trim(fisi)
        end if
    else
        write(*,*) 'Error opening file: ', trim(fisi)
    end if
    return
    end

!   Main program
!===================================================================================

    use read_fis

    implicit none
    character(:), allocatable :: a
    character *260 fise
    character  *10 ext
    character   *1 cr
    character   *2 crlf

    integer *8 i, j, m, i1, i2, k
    integer *4 np, kp
    integer *4 :: iunit, istat

    cr = char(13)
    crlf = cr//char(10)

    call GETARG(1, fisi)
    call GETARG(2, fise)

    kp = index(fise, '.', back = .true.) + 1
    ext = fise(kp:)

    call read_file_to_string ! str = fisi
    m = len(str) ! /2
    allocate(character(len=m) :: a)  !   a = fise

    open(newunit = iunit, file = fise, status = 'NEW', &amp;amp;
            form = 'UNFORMATTED', access = 'STREAM', iostat = istat)
    if(istat == 0) then
        continue
    else
        write(*,*) 'Error opening file: ', trim(fise)
        stop
    end if

    i = 1
    i1 = 1

    if(trim(ext) == 'pts' .or. trim(ext) == 'PTS') then
      np = 0
      do
         k = index(str(i:), 'vertex', kind = 8)
         if(k &amp;gt; 0) then
         	 np = np + 1
             i = i + k + int8(6)
             j = i + index(str(i:), cr, kind =  - int8(2)
             i2 = i1 + j - i + int8(4)
             a(i1:i2) = str(i:j)//' 9'//crlf
             i1 = i2 + int8(1)
         else
             write(99,'(i0,t11,i0)') k, i
             write(iunit, pos = 1, iostat = istat) a(:i2-2)
             exit
         end if
      end do
    else
      do
         k = index(str(i:), 'vertex')
         if(k &amp;gt; 0) then
             i = i + k + 6
             j = i + index(str(i:), cr)
             i2 = i1 + j - i
             a(i1:i2) = str(i:j)
             i1 = i2 + 1
         else
             write(iunit, pos = 1, iostat = istat) a(:i2-2)
             exit
         end if
      end do
    end if

    deallocate(str)
    close(iunit)
    deallocate(a)

    stop
    end
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I checked the "str" variable and it stores the entire stl file.&lt;/P&gt;
&lt;P&gt;The program stops when k = 0 when it no longer finds the word "vertex". The last index found by the program is i = 121,513,698 although the last index in the stl file is 4,416,480,763. The question is: &lt;STRONG&gt;why does the index function return 0 after i = 121,513,698.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;In "Project properties" it is set to "Default Integer kind": 8 (/ integer-size: 64), and in "Configuration Manager": x64, Release&lt;/P&gt;
&lt;P&gt;I mention that I have:&lt;BR /&gt;I7-3770 processor, 16GB RAM, WINDOWS 10 Home / 64bit,&lt;BR /&gt;Intel Parallel Studio XE 2020 Update 4 Windows x64.&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jun 2022 14:20:47 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Index-intrinsic-function-IVF-return-0-for-very-big-value/m-p/1395680#M161848</guid>
      <dc:creator>roy437</dc:creator>
      <dc:date>2022-06-27T14:20:47Z</dc:date>
    </item>
    <item>
      <title>Re: Index intrinsic function IVF return 0 for very big value</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Index-intrinsic-function-IVF-return-0-for-very-big-value/m-p/1396832#M161898</link>
      <description>&lt;P&gt;I had a quick look at your program, and I didn't see the problem, it could be a compiler bug with &amp;gt;32bit character subscripts. If you think it is a bug make a minimal sample code that shows the problem that is easier all round.&lt;/P&gt;
&lt;P&gt;There are some strange things in your code the text STL is a formatted file yet you open it as unformatted for example.&lt;/P&gt;
&lt;P&gt;Functionally you could to what yo are doing in a much simpler way IMO. I made an ran a simple example below.&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;program txt_stl_2_pts
    implicit none(type, external)
    character(132) :: gin
    integer :: iun1, iun2, ip, istat
    character(*), parameter :: GA ='(A)'
    open( newunit = iun1, file ='winder_bed_type_LH.stl', status = 'old', iostat = istat)
    if( istat /= 0 ) goto 900
    open(  newunit = iun2, file ='output.txt', status = 'unknown', iostat = istat )
    if( istat /= 0 ) goto 900
    do 
        read( iun1, ga, iostat = istat ) gin
        if( istat /= 0 ) goto 900
        ip = index(gin,'vertex')
        if ( ip &amp;gt; 0 )  write( iun2, ga) trim( gin(ip+6:) )
    enddo
    900 continue
    close (iun1, iostat = istat )
    close (iun2, iostat = istat )
end program txt_stl_2_pts&lt;/LI-CODE&gt;
&lt;P&gt;u&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jun 2022 16:21:31 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Index-intrinsic-function-IVF-return-0-for-very-big-value/m-p/1396832#M161898</guid>
      <dc:creator>andrew_4619</dc:creator>
      <dc:date>2022-06-30T16:21:31Z</dc:date>
    </item>
    <item>
      <title>Re: Index intrinsic function IVF return 0 for very big value</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Index-intrinsic-function-IVF-return-0-for-very-big-value/m-p/1396837#M161899</link>
      <description>&lt;P&gt;FWIW line 87 looks invalid. This should have produced a compilation error.&lt;/P&gt;
&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jun 2022 16:59:05 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Index-intrinsic-function-IVF-return-0-for-very-big-value/m-p/1396837#M161899</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2022-06-30T16:59:05Z</dc:date>
    </item>
    <item>
      <title>Re: Index intrinsic function IVF return 0 for very big value</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Index-intrinsic-function-IVF-return-0-for-very-big-value/m-p/1402830#M162160</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL aria-labelledby="alternatives-heading"&gt;
&lt;LI class="lmt__translations_as_text__item"&gt;&lt;BUTTON class="lmt__translations_as_text__text_btn" lang="en-EN" aria-description="Click to apply"&gt;I haven't solved the problem yet.&lt;/BUTTON&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The correct line 87 is:&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;SPAN&gt;j = i + index(str(i:), cr, kind=8) - int8(2)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;For test there is file :&amp;nbsp;&lt;A href="https://we.tl/t-PGVsUr5zzZ" target="_blank"&gt;https://we.tl/t-PGVsUr5zzZ&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;J. Roy&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Jul 2022 11:27:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Index-intrinsic-function-IVF-return-0-for-very-big-value/m-p/1402830#M162160</guid>
      <dc:creator>roy437</dc:creator>
      <dc:date>2022-07-24T11:27:20Z</dc:date>
    </item>
    <item>
      <title>Re: Index intrinsic function IVF return 0 for very big value</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Index-intrinsic-function-IVF-return-0-for-very-big-value/m-p/1402832#M162161</link>
      <description>&lt;P&gt;Please test :&amp;nbsp;&lt;A href="https://we.tl/t-PGVsUr5zzZ" target="_blank"&gt;https://we.tl/t-PGVsUr5zzZ&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Filesize = 4.11 GB&lt;/P&gt;
&lt;P&gt;Tell me time to run. Time to run is big. Tell me performances of your computer and OS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thx, J. Roy&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Jul 2022 11:33:06 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Index-intrinsic-function-IVF-return-0-for-very-big-value/m-p/1402832#M162161</guid>
      <dc:creator>roy437</dc:creator>
      <dc:date>2022-07-24T11:33:06Z</dc:date>
    </item>
    <item>
      <title>Re: Index intrinsic function IVF return 0 for very big value</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Index-intrinsic-function-IVF-return-0-for-very-big-value/m-p/1402845#M162163</link>
      <description>&lt;P&gt;What are the command line arguments?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Jul 2022 14:32:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Index-intrinsic-function-IVF-return-0-for-very-big-value/m-p/1402845#M162163</guid>
      <dc:creator>JohnNichols</dc:creator>
      <dc:date>2022-07-24T14:32:00Z</dc:date>
    </item>
    <item>
      <title>Re: Index intrinsic function IVF return 0 for very big value</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Index-intrinsic-function-IVF-return-0-for-very-big-value/m-p/1402848#M162164</link>
      <description>&lt;P&gt;The first problem is you have a test file so large that even VEDIT cannot open it to look at it.&amp;nbsp; &amp;nbsp;I have never seen a text file this large and I deal with huge FEM models.&amp;nbsp; I am not aware of a better editor than vedit for very large files.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The file is created as text numbers, often you run into a problem that the format statement that created the number is incorrect for the number, which happens a lot.&amp;nbsp; &amp;nbsp;But I cannot read your file to look for errors in the text.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suggest you write a simple program that reads and checks each line for correctness, this is a common thing for DXF files for industrial applications in some locations.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Jul 2022 14:41:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Index-intrinsic-function-IVF-return-0-for-very-big-value/m-p/1402848#M162164</guid>
      <dc:creator>JohnNichols</dc:creator>
      <dc:date>2022-07-24T14:41:46Z</dc:date>
    </item>
    <item>
      <title>Re: Index intrinsic function IVF return 0 for very big value</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Index-intrinsic-function-IVF-return-0-for-very-big-value/m-p/1402849#M162165</link>
      <description>&lt;LI-CODE lang="fortran"&gt;! call GETARG(1, fisi)
    !call GETARG(2, fise)
    fisi = "Test.stl"
    fise = "Test.out"
    

    kp = index(fise, '.', back = .true.) + 1
    ext = fise(kp:)

    call read_file_to_string ! str = fisi
    m = len(str) ! /2
    allocate(character(len=m) :: a)  !   a = fise

    open(newunit = iunit, file = fise, status = 'UNKNOWN', &amp;amp;
            form = 'UNFORMATTED', access = 'STREAM', iostat = istat)&lt;/LI-CODE&gt;
&lt;P&gt;Now I can run it in VS 2019 - see unknown, old means you have to delete the file to run it.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Jul 2022 14:56:05 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Index-intrinsic-function-IVF-return-0-for-very-big-value/m-p/1402849#M162165</guid>
      <dc:creator>JohnNichols</dc:creator>
      <dc:date>2022-07-24T14:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: Index intrinsic function IVF return 0 for very big value</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Index-intrinsic-function-IVF-return-0-for-very-big-value/m-p/1402852#M162166</link>
      <description>&lt;P&gt;&lt;FONT color="#FF0000"&gt;Ultraedit&lt;/FONT&gt; 64-bit read very large file.&lt;/P&gt;</description>
      <pubDate>Sun, 24 Jul 2022 15:27:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Index-intrinsic-function-IVF-return-0-for-very-big-value/m-p/1402852#M162166</guid>
      <dc:creator>roy437</dc:creator>
      <dc:date>2022-07-24T15:27:09Z</dc:date>
    </item>
    <item>
      <title>Re: Index intrinsic function IVF return 0 for very big value</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Index-intrinsic-function-IVF-return-0-for-very-big-value/m-p/1402858#M162167</link>
      <description>&lt;P&gt;it is 99 per year, not going to spend the money.&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt; module read_fis
    character *260 fisi
    character(:), allocatable :: str
    end module read_fis

    subroutine read_file_to_string
    use ifport
    use read_fis
    implicit none
    integer *4 :: iunit, istat, ilog
    integer *8 :: file_size, I,k,m,n
    character(len=1) :: c
    open(newunit = iunit, file = fisi, status = 'OLD', &amp;amp;
        form = 'UNFORMATTED', access = 'STREAM', iostat = istat)
    if (istat==0) then
        inquire(file=fisi, size=file_size )
        write(*,100)file_size
100     Format("File size is :: ",i10)

101     Format("File size is &amp;gt; :: ",i10," billion characters")

        ! write(*,100)file_size/1000
        !  write(*,100)file_size/1000000
        write(*,101)file_size/1000000000
        if (file_size &amp;gt; 0) then
            allocate(character(len=file_size ) :: str)
            read(iunit, pos=1, iostat = istat) str
            if (istat==0) then
                !make sure it was all read by trying to read more:
                read(iunit, pos = file_size+1, iostat = istat) c
                if (.not. IS_IOSTAT_END(istat)) then
                    write(*,*) 'Error: file was not completely read: ', trim(fisi)
                end if
            else
                write(*,*) 'Error reading file: ', trim(fisi)
            end if
            k = 1
            open(newunit = ilog, file = "ab.log", status = 'unknown') 
            do i = 1,200
    
                if(mod(1000,1) .eq. 0 ) then 
                !close(ilog)
               ! open(newunit = ilog, file = "ab1.log", status = 'unknown') 
                end if
                if(i .eq. 1) then
                m = k
                n = k + 56
                    write(ilog,1001)I,str(m:n)
                    m = n + 1
                    n = n + 46
                write(ilog,1002)I,str(m:n)
                m = m + 47
                n = m + 15
                write(ilog,1003)I,str(m:n)
                
                m = m + 16
                n = m + 49
                write(ilog,1004)I,str(m:n)
                m = m + 50
                n = m + 49
                write(ilog,1005)I,str(m:n)
                m = m + 50
                n = m + 49
                write(ilog,1006)I,str(m:n)
                
                m = m + 50
                n = m + 11
                write(ilog,1007)I,str(m:n)
                m = m + 12
                n = m + 11
                write(ilog,1008)I,str(m:n)
                
                m = m + 12
                n = m + 43
                
                else
                write(ilog,1002)I,str(m:n)
                    m = n + 1
                    n = n + 46
                write(ilog,1003)I,str(m:n)
                
                m = m + 16
                n = m + 49
                write(ilog,1004)I,str(m:n)
                m = m + 50
                n = m + 49
                write(ilog,1005)I,str(m:n)
                m = m + 50
                n = m + 49
                write(ilog,1006)I,str(m:n)
                
                m = m + 50
                n = m + 11
                write(ilog,1007)I,str(m:n)
                m = m + 12
                n = m + 11
                write(ilog,1008)I,str(m:n)
                
                m = m + 12
                n = m + 43
                end if               
1001            Format(I10,"  Line :: ", A57,\)
1002            Format(I10,"  Line :: ", A42)
1003            Format(I10,"  Line ::     ", A15,\)
1004            Format(I8,"  Line ::     ", A43)
1005            Format(I10,"  Line ::    ", A44)
1006            Format(I10,"  Line ::   ", A45)
1007            Format(I10,"  Line ::   ", (A),\)
1008            Format(I8,"  Line ::   ", (A)/)
            end do
            close(iunit, iostat=istat)
        else
            write(*,*) 'Error getting file size: ',  trim(fisi)
        end if
    else
        write(*,*) 'Error opening file: ', trim(fisi)
    end if

    return
    end

    !   Main program
    !===================================================================================

    use read_fis

    implicit none
    character(:), allocatable :: a
    character *260 fise
    character  *10 ext
    character   *1 cr
    character   *2 crlf

    integer *8 i, j, m, i1, i2, k
    integer *4 np, kp
    integer *4 :: iunit, istat

    cr = char(13)
    crlf = cr//char(10)

    ! call GETARG(1, fisi)
    !call GETARG(2, fise)
    fisi = "Test.stl"
    fise = "Test.out"


    kp = index(fise, '.', back = .true.) + 1
    ext = fise(kp:)

    call read_file_to_string ! str = fisi
    m = len(str) ! /2
    allocate(character(len=m) :: a)  !   a = fise

    open(newunit = iunit, file = fise, status = 'UNKNOWN', &amp;amp;
        form = 'UNFORMATTED', access = 'STREAM', iostat = istat)
    if(istat == 0) then
        continue
    else
        write(*,*) 'Error opening file: ', trim(fise)
        stop
    end if

    i = 1
    i1 = 1

    if(trim(ext) == 'pts' .or. trim(ext) == 'PTS') then
        np = 0
        do
            k = index(str(i:), 'vertex', kind = 8)
            if(k &amp;gt; 0) then
                np = np + 1
                i = i + k + int8(6)
                j = i + index(str(i:), cr, kind=8) - int8(2)
                ! j = i + index(str(i:), cr, kind =  - int8(2)
                i2 = i1 + j - i + int8(4)
                a(i1:i2) = str(i:j)//' 9'//crlf
                i1 = i2 + int8(1)
            else
                write(99,'(i0,t11,i0)') k, i
                write(iunit, pos = 1, iostat = istat) a(:i2-2)
                exit
            end if
        end do
    else
        do
            k = index(str(i:), 'vertex')
            if(k &amp;gt; 0) then
                i = i + k + 6
                j = i + index(str(i:), cr)
                i2 = i1 + j - i
                a(i1:i2) = str(i:j)
                i1 = i2 + 1
            else
                write(iunit, pos = 1, iostat = istat) a(:i2-2)
                exit
            end if
        end do
    end if

    deallocate(str)
    close(iunit)
    deallocate(a)

    stop
    end
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp; I played with your code, str is very hard to take apart and even print.&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Read one line at a time, find what you want and throw it away.&amp;nbsp; That you should be able to write in an hour.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Jul 2022 16:19:31 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Index-intrinsic-function-IVF-return-0-for-very-big-value/m-p/1402858#M162167</guid>
      <dc:creator>JohnNichols</dc:creator>
      <dc:date>2022-07-24T16:19:31Z</dc:date>
    </item>
    <item>
      <title>Re: Index intrinsic function IVF return 0 for very big value</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Index-intrinsic-function-IVF-return-0-for-very-big-value/m-p/1402867#M162168</link>
      <description>&lt;P&gt;Hooray,&lt;/P&gt;
&lt;P&gt;I solved the problem, removed kind=8 and replaced index(str(i:) with index(str(i:i200) where i200=200. Execution time &lt;STRONG&gt;11.70 sec&lt;/STRONG&gt;. Thanks to everyone for the advice.&lt;/P&gt;
&lt;P&gt;I7-3770, 16GB RAM, W10/64bit and ssd.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;J. Roy&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Jul 2022 18:43:47 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Index-intrinsic-function-IVF-return-0-for-very-big-value/m-p/1402867#M162168</guid>
      <dc:creator>roy437</dc:creator>
      <dc:date>2022-07-24T18:43:47Z</dc:date>
    </item>
    <item>
      <title>Re: Index intrinsic function IVF return 0 for very big value</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Index-intrinsic-function-IVF-return-0-for-very-big-value/m-p/1402876#M162169</link>
      <description>&lt;P&gt;11th Gen Intel(R) Core(TM) i7-11850H @ 2.50GHz 2.50 GHz&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;turn off the write to the file out and it runs in less than a second on 32 GB Win 11 and SAmsung SSD.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Jul 2022 20:06:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Index-intrinsic-function-IVF-return-0-for-very-big-value/m-p/1402876#M162169</guid>
      <dc:creator>JohnNichols</dc:creator>
      <dc:date>2022-07-24T20:06:40Z</dc:date>
    </item>
    <item>
      <title>Re: Index intrinsic function IVF return 0 for very big value</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Index-intrinsic-function-IVF-return-0-for-very-big-value/m-p/1402877#M162170</link>
      <description>&lt;P&gt;Wow, probably the best time, congratulations!&lt;/P&gt;</description>
      <pubDate>Sun, 24 Jul 2022 20:12:56 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Index-intrinsic-function-IVF-return-0-for-very-big-value/m-p/1402877#M162170</guid>
      <dc:creator>roy437</dc:creator>
      <dc:date>2022-07-24T20:12:56Z</dc:date>
    </item>
  </channel>
</rss>

