[J3] EOF not detected
Van Snyder
van.snyder at sbcglobal.net
Mon Nov 10 20:51:46 UTC 2025
To save space I gzip-compressed a large number of data files.
Then to read them I create a FIFO (if it doesn't already exist):
inquire ( file='MyFifo', exist=exist )
if ( .not. exist ) call execute_command_line ( 'mkfifo MyFifo' )
open the FIFO, and start another process to decompress them:
call execute_command_line ( 'zcat ' // trim(file) // '> MyFifo ' )
The END= exit in the read statement isn't taken.
So I changed the code to detect "EOF" and pretend it's the end of file,
and instead do
call execute_command_line ( 'zcat ' // trim(file) // '> MyFifo ; echo
EOF > MyFifo' )
or
call execute_command_line ( '(zcat ' // trim(file) // ; echo EOF) '>
MyFifo ' )
"gunzip" can uncompress the files in one second.
The program processes uncompressed files in about two seconds.
Reading and processing the compressed files using the above methods
takes 25 seconds.
I also tried appending EOF to the files before compressing them and
then reading them using the first method, with the same result.
(1) Why does END= not branch when reading from a FIFO?
(2) Why does it run so much longer when reading from a FIFO?
(all of this with ifx (IFX) 2025.2.1 20250806; I haven't tried it yet
with gfortran or nagfor).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20251110/d360b301/attachment-0001.htm>
More information about the J3
mailing list