Information Technology Reference
In-Depth Information
3. File makeup
Before proceeding with a simple computer program, let us look at how data is
organized. All information is stored in files or databases, which strictly speaking are one
and the same. A file consists of various elements or records. Thus a personnel file will
have records that match individuals. Each record consists of fields or variables. Our
personnel file might have records that include some identification number such as a social
security number or the like, name, address, city, state, zip code, telephone and date of
birth. There may be other fields as well.
Each field is a variable, which has a value, and each individual field has some
kind of limit. The identification number might be limited to nine numeric digits and
nothing else. It cannot be all zeros or all nines and there could be further restrictions. The
name will be limited to letters of the alphabet - upper and lower case - the period,
apostrophe and hyphen. I don't know many people who have a name with $, %, a number
or @ in it, so I think our restriction is valid. There is allowance made for hyphenated
names to accommodate women who marry and want to somehow keep their maiden name
as well as an Irish name like O'Brien. Granted, there are taxi drivers in New York City
who have the letter O with a slash through it in their name, but we won't concern
ourselves with that possibility.
Other fields will have different restrictions. Zip code can be one of a few formats,
such as five digits, nine digits or alternating digits and letters to accommodate our
neighbors north of the border. Dates have to be in a specific format, mostly all numeric
but all spaces could also be acceptable, as could an entry of all zeroes. This would
accommodate a date to be entered later. Our language will require all dates to be in
yyyymmdd format, that is, four digits for the year and two each for the month and day. If
the date is neither zero nor spaces, MM, DD and YYYY have to be such that their
combination is a valid one. MM = 02 with DD = 30 would be unacceptable since
February 30th is not a valid date. Later we will develop a date check to handle this.
Other fields will have restrictions as well. The state has to be a valid two-
character combination, which represents one of the fifty states. City can be no more than
fifteen characters and these can only be letters of the alphabet, the hyphen, the period and
a space. Amount fields will always be numeric and some can be negative, such as a bank
balance. Thus some amount fields need to be able to be positive or negative. This is
handled by including a sign in the field. Amount fields have decimals in them, such as
current balance, so that will must be taken care of as well. There will be no need to put
the decimal point into any file just as we don't need to include a dollar sign for a
withdrawal or deposit. Since we are talking about money, the $ is assumed.
Having delved into the structure of a file, you can probably see that the makeup is
not unlike the topic we talked about in the English language. Each has basic elements that
make up words or fields. These pieces in turn then get grouped together to form sentences
or records. English then combines the sentences to get a topic while the combination of
our data records makes a file. In each case there are rules that need to be followed. If we
fail to follow the rules for either, there will be problems.
Search WWH ::




Custom Search