Microsoft KB Archive/32705

FORTRAN-80 Record Delimiters (CR Only Versus CR/LF)

PSS ID Number: Q32705 Article last modified on 08- 1-1988

3.42 3.43 3.44 CP/M-80

Summary: Versions of FORTRAN-80 prior to Version 3.42 used carriage return-linefeed (CR/LF) record delimiters. FORTRAN Version 3.43 and prior inserts (and wants) only a carriage return (CR) between records. There are two methods to insert a linefeed at the end of a record so that the file can be edited in a word processor or other editor.

More Information: The two methods are as follows: 1. If the text/word processor can accept the sequence LF/CR, use the following: LOGICAL LF LF = 10 WRITE (lun,###) var1,var2, … ,LF ### FORMAT(..,.., … ,A1) 2. To cause a CR/LF sequence, use the following: LOGICAL LF LF = 10 WRITE (lun,100) var1,var2, … ;first write 100 FORMAT(..,.., … ) ;no LF WRITE (lun,200) LF,var1,var2, … ;all but last 200 FORMAT(A1,..,.., … ) ;writes… WRITE (lun,300) LF ;last write 300 FORMAT(A1) The opposite problem is how to remove linefeeds (or ignore them) when taking data from a file with CR/LF delimiters, as follows: READ (lun,###) var1,var2,. ### FORMAT(1X,.., … ) You may want to create a BASIC program that massages the file and discards LFs as it makes a new file. You need to open the file in the DIRECT mode.