[Lazarus] reading FORTRAN-style input in Lazarus

David M. Lawrence dave at fuzzo.com
Fri Aug 5 16:46:39 CEST 2011



On 8/5/2011 4:15 AM, Lukasz Sokol wrote:
> So this is some kind of address database ? Any real-world example you 
> could provide with different field separators ? (data may be dummy, of 
> course) L.

Here's a few examples.  These lines are from a precipitation station 
inventory list:
1066054500  LAGHOUAT                   33.77    2.93 -999 1878 1989 16.3 0
1066055001  EL ALIOD                   32.90     .50 -999 1909 1961 35.5 0
1066055500  TOUGGOURT                  33.12    6.13 -999 1908 1990 34.1 0
1066055900  EL OUED                    33.50    6.12 -999 1904 1990 11.4 0
1066055902  EL ARFIANE                 33.60    5.90 -999 1935 1966   .0 0

The first ten characters are actually two variables: a three-digit 
country code and a seven-digit station ID code.  It is followed by 
station names, which may or may not have spaces in them.  The full name 
field is 25 characters long.  The remaining variables are latitude, 
longitude, elevation (missing in these cases), first year of record, 
last year of record, percent missing values, and some descriptor code.

The next example is from a file listing data flags:

10660680001967110001100011000110001100011000110001100011000110001100011000
10660680001968110001100011000110001100011000110001100011000110001100011000
10660680001969110001100011000110001100011000110001100011000110001100011000
10660680001970110001100011000110001100011000110001100011000110001100011000
10660680001971110001100011000110001100011000110001100011000110001100011000

The variables are a three-digit country code, seven-digit station code, 
four-digit year, and 12 five-digit flag codes.

Now here's an actual data file (in this case, sea-level pressure):

10260096001958101601016010160101601016010170101401013010140101601016010190
10260096001959101801020010170101601015010160101401012010140101601017010200
10260096001960101901016010160101501017010160101401013010140101601017010190
102600960019611021010200-99991015010150-9999-9999-9999-9999-9999-9999-9999

The variables are three-digit country code, seven-digit station code, 
four digit year, and 12 five-digit pressure measurements (-9999 means 
missing data).

Last night I tried the record idea suggested by Klenin and couldn't get 
it to work.  I kept getting "can't read or write variables of this type" 
errors.  It may be because I could not figure out how to read the data 
as a file as a "type of TInputLine."

Anyway, this is the problem.  Now I need to catch up on the follow-up 
posts and see if I can find something that works.

Dave

-- 
------------------------------------------------------
  David M. Lawrence        | Home:  (804) 559-9786
  7471 Brook Way Court     | Fax:   (804) 559-9787
  Mechanicsville, VA 23111 | Email: dave at fuzzo.com
  USA                      | http:  http://fuzzo.com
------------------------------------------------------

"All drains lead to the ocean."  -- Gill, Finding Nemo

"We have met the enemy and he is us."  -- Pogo

"No trespassing
  4/17 of a haiku"  --  Richard Brautigan





More information about the Lazarus mailing list