Newsgroups: bit.listserv.sas-l
Date:         Tue, 5 Jan 1993 16:13:21 CST
Reply-To:     David Nasser <NASSER@UMSLVMA.BITNET>
From:         David Nasser <NASSER@UMSLVMA.BITNET>
Subject:      Reading Tricky Flat File

Content   : Question(s) / Inquiry
Summary   : How to read VeryStrange gummint file?
System(s) : Large IBM
Name      : David Nasser

The file in question is:
   "Thrift Financial Report Quarterly, June 1992"
supplied on tape from:
   US Office of Thrift Supervision, Wash., DC
   National Technical Info Service
   US Dept. of Commerce

The doc. for this file is very, *very* sparse: there is no record layout
as such (that we could find).  The data in this file represents
financial info (i.e. assets, net income, etc.) on Savings and Loan
Associations (SNLs) reported to one or more federal agencies.

The record length is 128 bytes. All data is character. There are >=180
records per SNL. The first 79 b.  of selected records for the first SNL
follow:

G0B192060034904SALEM CO-OP BK                       3 SOUTH BROADWAY
G0C1920600349030790000ROCKINGHAM                  07416033015
G0D192060034933010054110803N NNNNNPAAAAAAAAA     00  PPPPPPPPPPPPPXPPPNPP920731
G0I1920600349SC10   +0000073064SC110  +0000000781SC120  +0000006202SC132  +0000
G0I1920600349SC150  +0000000000SC162  +0000027884SC166  +0000000000SC170  +0000
G0I1920600349SC190  +0000000466SC198  +0000000000SC20   +0000000000SC210  +0000
G0I1920600349SC220  +0000000000SC223  +0000000000SC226  +0000000000SC23   +0000
G0I1920600349SC24   +0000001251SC240  +0000000600SC250  +0000062805SC253  +0000
    (172 similar "G0I" records omitted here)                              +0000
20S1920600349CSS020348053S.C.B., INC.                         3 SOUTH BROADWAY
20S2920600349CSS020348053SALEM                       NH000003079
20S3920600349CSS020348053020187470SALEM CO-OPERATIVE BANK              10001A24
20S4920600349CSS020348053120+0000000102130+0000000000140+0000000102150+00000000

The first 3 recs (starting with "GOB", "G0C", "G0D" resp.) contain
data for identifiers (i.e. name, address, etc.) and are not a problem.
The following 177 "G0I" recs have:
   ID info in the first 13 bytes
   Six repetitions of:
     A  7 b. field with a variable name
     A  1 b. field with a sign associated with:
     A 10 b. field with a data value
   7 bytes of apparent garbage at the end of the record

They Have Embedded The Variable NAMES In (nearly) Every Record (some-
thing I have never _ever_ seen before)!

For instance, var name SC10 (Cash less valuation allowance) can be read
from bytes 14-20 of the first G0I rec. Similarly, the positive sign and
the actual data value (+0000073064) can be read from bytes 21-31.
SC10=73064. Piece of cake, eh? eh? There are 6(177)=1062 of these
beauties.

After the 177 G0I recs are a variable number of 20S recs. These must
be flushed because there are no data definitions (in the non-existent
record layout).

It bears mentioning that we also use NTIS bank files which have
conventional record layout with 1 rec/bank, integer binary data rep.,
etc. The G0I recs for 1 SNL occupy 128(177)=22,656 bytes. If the SNL
file were designed like the bank files (they were, previous to 1990),
the same data would occupy 6(177)(4)=4248 bytes, a savings of around
80%. Say, did someone (i.e. Codd, Date) say something re conservation
of storage being the *essence* of good database design?? Naw, they
were probably just talking about &normalization& (hiccup!).

Two Questions:
 1.) Does anyone happen to have any particulars re this file? How was
     it *intended* to be read? Is there a relatively new language
     (i.e. COBOL II or ?) which is engineered to read both variable
     names _and_ values from the same file? Inquiring minds ....
 2.) Does it make sense to try to read / support this data with SAS,
     given that we dont necessarily have 40 daze/40 nites to hand-code
     everything (which will probably change with the next qrtrly file)?

Howard, are you out there???

TIA. All suggestions welcome.

Unrelated:
Has anyone been watching SI dev./testing/support of DEC Alpha AXP?
I will take this (very brief) moment to tip my hat in the direction
of Goodnight/SI.

  Prosit,
  David

 "I'm sittin' here wonderin',
  would a matchbox hold my clothes?
  I ain't got so many matches,
  but I got so far to go."
    from "Matchbox Blues", Blind Lemon Jefferson, maybe 1927.
Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU