2 ! PR42090 Problems reading partial records in formatted direct access files
3 ! Test case from PR, prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org>
11 open( 10, file
= 't.dat', form
= 'formatted', access
= 'direct', recl
= 12 )
12 write( 10, rec
= 1, fmt
= '( f6.4, /, f6.4 )' ) a
, b
18 open( 10, file
= 't.dat', form
= 'formatted', access
= 'direct', recl
= 12 )
20 read( 10, rec
= 1, fmt
= '( f6.4, /, f6.4 )' ) a
, b
21 !write( *, '( "partial record 1", t25, 2( f6.4, 1x ) )' ) a, b
25 read( 10, rec
= 1, fmt
= '( f6.4 )' ) a
, b
26 !write( *, '( "partial record 2", t25, 2( f6.4, 1x ) )' ) a, b
27 if (a
/= 1.1111 .and
. b
/= 2.2222) STOP 1
31 read( 10, rec
= 1, fmt
= '( f12.4, /, f12.4 )' ) a
, b
32 !write( *, '( "full record 1", t25, 2( f6.4, 1x ) )' ) a, b
33 if (a
/= 1.1111 .and
. b
/= 2.2222) STOP 2
37 read( 10, rec
= 1, fmt
= '( f12.4 )' ) a
, b
38 !write( *, '( "full record 2", t25, 2( f6.4, 1x ) )' ) a, b
39 if (a
/= 1.1111 .and
. b
/= 2.2222) STOP 3
43 read( 10, rec
= 1, fmt
= '( f6.4, 6x, /, f6.4, 6x )' ) a
, b
44 !write( *, '( "full record with 6x", t25, 2( f6.4, 1x ) )' ) a, b
45 if (a
/= 1.1111 .and
. b
/= 2.2222) STOP 4
49 read( 10, rec
= 1, fmt
= '( f6.4 )' ) a
50 read( 10, rec
= 2, fmt
= '( f6.4 )' ) b
51 !write( *, '( "record at a time", t25, 2( f6.4, 1x ) )' ) a, b
52 if (a
/= 1.1111 .and
. b
/= 2.2222) STOP 5
54 close( 10, status
="delete")
55 end program da_good_now