forums.silverfrost.com
Welcome to the Silverfrost forums

 Preconnected logical unit numbers Goto page Previous  1, 2
Author Message
LitusSaxonicum

Joined: 23 Aug 2005
Posts: 1790
Location: Yateley, Hants, UK

 Posted: Sun Mar 04, 2018 7:03 pm    Post subject: Fascinating. Hardly a complete list, though. And what the heck is it doing in Salflibc.dll (or not)?
mecej4

Joined: 31 Oct 2006
Posts: 909

Posted: Sun Mar 04, 2018 7:52 pm    Post subject:

Unlike John Campbell, I have a limited number of FTN95 releases installed. Here is the test code for someone to see if another version of SALFLIBC.DLL contains D1MACH:
 Code: program tmach implicit none double precision :: d1mach,xd integer :: i,i1mach ! print *,'           I        I1MACH(I)' print * do i=1,10    print *,i,i1mach(i) end do print * print *,'           I        D1MACH(I)' print * do i=1,5    xd=d1mach(i)    print *,i,xd end do end program tmach
mecej4

Joined: 31 Oct 2006
Posts: 909

Posted: Wed Mar 28, 2018 11:31 pm    Post subject: Re:

 LitusSaxonicum wrote: Interesting that 0 isn't preconnected. How do you do the test with * ? Provided you use 1 .. 6 and specifically OPEN them, FTN95 works just fine.

This question resurfaced after a couple of months, and there is some indication that Unit-2 and '*' are either the same or are related. A program opened an unformatted file with unit number = 2, and later tried to WRITE to unit = *. This failed.
 Code: PROGRAM ORD77       IMPLICIT NONE       WRITE(*,10)       call openu(2)  10   FORMAT(' PROGRAM SWORD (4 Mar 96) : ')       STOP       END PROGRAM !       subroutine openu(n)       implicit none       integer, intent(in) :: n       character*8 :: fname = 'FORT.   '       integer :: i       logical :: isopen,exists       character*10 :: act,frm !       write(fname(6:6),'(I1)')n       close(n)       open(n,file=fname,form='unformatted')       write(*,'(A,A,A)')'Opened ',trim(fname),' as unformatted'  ! <<<=== Error       return       end subroutine

The error message: " *** Error 90, File access and properties are incompatible" for the line with "WRITE(*,'(A,A,A)')...".
mecej4

Joined: 31 Oct 2006
Posts: 909

Posted: Sun Apr 01, 2018 4:02 pm    Post subject:

If the compiler sees an attempt to open a file with unit = 2, and the unit number is the literal constant 2, it issues a warning. Here is a test program.
 Code: program tst implicit none integer i,j,k ! open(2,file='fort.2',status='replace',form='formatted') do i=1,10    print *, 'i = ',i    j=i*i    k=i*i*i    write(2)i,j,k     ! *** ERROR ***: unformatted I/O on formatted file connection end do close(2) end program tst

The compiler says:
 Code: 0005) open(2,file='fort.2',status='replace',form='formatted') WARNING - Opening unit 2 may affect the operation of output to the default unit '*' - are you sure you want to do this? 0012) close(2) WARNING - Closing unit 2 may affect the operation of output to the default unit '*' - are you sure you want to do this?     NO ERRORS, 2 WARNINGS
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First
 All times are GMT + 1 HourGoto page Previous  1, 2 Page 2 of 2