Published on March 9, 2014
Basic Scientific Programming File Processing
File Processing Applications involving large data sets can be processed more conveniently if the data is stored in a file. The data in the file to be used as an input file must be arranged in a form suitable for reading by a read statement. These values are read during program execution, just like data entered by the user from the keyboard.
Opening Files form OPEN ( open_list ) opens the file associated with specified unit number so that Input/Output can take place.
Open List Open_list includes: 1) a unit specifier indicating a unit number connected to the file being opened. The unit specifier has the form described for the write statement. 2) FILE = Character_expression giving the name of the file being opened.
Open List 3) Status = character_expression where character expression is one of the following “old”,”new”, or “replace”. *Old means the file already exists. *New means the file does not yet exist and is being created. *Replace creates a new file, replacing the old one if one already exists, and changes its status to old
Open List Action = i-o-action where i-o-action is a character expression whose value is one of the following: “Read”: file opened for reading only “Write”: file opened for writing only “Readwrite”: file opened for both reading and writing.
Open List Position = character_expression where the character expression is on of “Rewind”: position the file at its initial point. “Append”: position the file at the end of file. “ASIS”: leaves the position unchanged..
Open List IOSTAT = Status_variable where status variable is an integer variable to which the value zero is assigned if the file is opened successfully and a positive value is assigned otherwise.
Ex: To open a file named info.dat from which data values are to be read: open(unit=12,FILE=“info.dat”,status=“old”,& action=“read”, Position=“rewind”,& IOSTAT = OpenStauts) where openstatus is an integer variable equal to zero if the file is successfully opened or some positive value if the file cannot be open.
If the program is to used with various data files, it’s better not to assign the file name directly but to use a character variable. Character(12):: filename Write(*,’(1X,A)’,ADVANCE=“NO”) & “Enter name of data file” read *, filename open(unit=12,FILE=filename,status=“old”,& action=“read”, Position=“rewind”,& IOSTAT = OpenStauts)
To open a new file named Report to which values are to be written; open(unit=13,File=“Report”,status=“new”,& action=“write”, IOSTAT= openstatus) To write values to the file, we use the write statement Write(13,’(1X,I3)’) Code
Closing Files The CLOSE statement has a function opposite that of the OPEN statement and is used to disconnect a file from its unit number. Form close (unit_number)
Notes After a close statement is executed, the closed file may be reopened by using an open statement; the same unit number may be connected to it or a different on may be used. All files that are not explicitly closed by means of a close statement are automatically closed when and End or Stop statement is executed.
File Input/Output Once a file has been connected to a unit number, data can be written to or form that file using the general WRITE and READ statements. A general read statement may contain an IOSTAT= clause to detect an end-offile condition or an input error.
IOSTAT = status_variable, Status_variable is assigned A positive value if an input error occurs. A negative value if the end of data is encountered but no input errors occurs. Zero if neither an input error not the end of data occurs.
Ex: Do Read(12,*,IOSTAT= Instat) pressure if (Instat >0) stop “ input error” if (Instat <0) exit !end of file ! Otherwise continue processing data sum = sum + pressure End Do
An alternative method of detecting an end-of-file condition is to use an END=clause in the control list of a general read statement. Form END= statement_number.
Ex: Do Read(12,*,End=20) pressure sum = sum + pressure End Do 20 Continue . . .
File Positioning Statements Rewind Statement: Rewind unit_number positions the file at the beginning. Backspace Statement: Backspace unit_number positions the file at the beginning of the preceding line.
7-Zip. 7-Zip is a file archiver with a high compression ratio. ... 7-Zip works in Windows 10 / 8 / 7 / Vista / XP / 2012 / 2008 / 2003 / 2000 / NT.
7-Zip is a file archiver with a high compression ratio. Choose a download format. Download links redirect to a download page on SourceForge.net.
Willkommen auf der offiziellen 7-Zip Webseite! 7-Zip ist ein freies Datenkompressionsprogramm mit einer hohen Kompressionsrate.
An abstract representation of file and directory pathnames. User interfaces and operating systems use system-dependent pathname strings to name files and ...
Learn how to recover files that have been lost, deleted, or accidentally changed.
Learn about files, folders, and libraries, including how to copy and save files, and how Windows organizes your files for you.
In Windows XP we can search for files that contain a defined keyword (inside all files types). Windows 7 can look inside files for a keyword, but only for ...
To view .hlp files on Windows 7, you need to install this application. Details. Note: There are multiple files available for this download.
Opens a file, returning an input stream to read from the file. The stream will not be buffered, and is not required to support the mark or reset methods.
Download kostenlos sicher. Name: A.F.7 Merge your files Hersteller-Link: Offizielle Webseite Sprache: Deutsch Betriebssysteme: Windows 95, 98, ME, NT, 2000, XP