NBSIR 74-633

The NBS Computerized Carpool

Matching System: Users' Guide

Judith F. Gilsinn and Susan Landau

Applied Mathematics Division

Institute for Basic Standards

Operations Research Section

National Bureau of Standards

Washington, D. C. 20234

Technical Report to The NBS Energy Taskforce

December 1974

Final

U.S. DEPARTMENT OF COMMERCE

NATIONAL BUREAU OF STANDARDS

NBSIR 74-633

THE NBS COMPUTERIZED CARPOOL

MATCHING SYSTEM: USERS' GUIDE

Judith F. Gilsinn and Susan Landau

Applied Mathematics Division

Institute for Basic Standards

Operations Research Section

National Bureau of Standards

Washington, D. C. 20234

Technical Report to The NBS Energy Taskforce

December 1974

Final

U S, DEPARTIWENT OF COMMERCE. Rogers C.B. Morton. Secretary

NATIONAL BUREAU OF STANDARDS. Richard W. Roberts. Director

TABLE OF CONTENTS

Abstract 1

1. Introduction 2

2. General Description 4

3. Data Base 7 3.1 Transportation Survey Responses 7 3.2 Coding Coordinates 7

4. The Carpool Matching Programs 17

4.1 Program EXTRACT 17

4.2 Program SELECT 21

4.3 Program GRID 21

4.4 Program POOLIST 25

A. Program Listings 34

B. Sample Runs t reams 54

C. Locating Coordinates by Interpolation: An Example .... 57

D. NBS Employee Transportation Survey Questionnaire 58

1
TABLE OF FIGURES

3.1 Data Format for the Locator File Tape 8

3.2 Maps Used in Coding Coordinates 10

3.3 Coordinates for Selected Gaithersburg Addresses 11

3.4 Coordinates for Rural Routes , 13

3.5 Format of Card for Adding Coordinates to the

Locator File 16

4.1 Flowchart of the Carpool Matching System 18

4.2 Flowchart of EXTRACT 19

4.3 Format of Each Data Record of the Carpool

Candidate File 20

4.4 Flowchart of SELECT . 22

4.5 Variables and Arrays in Subroutine SELECT 23

4.6 Parameters in the Calling Sequence of Subroutine

SORTP 24

4.7 Flowchart of GRID 26

4.8 Variables and Arrays in Subroutine GRID 27

4.9 Sample Output 29

4.10 Flowchart of POOLIST 30

4.11 Variables and Arrays Appearing Only in Subroutine

POOLIST 31

B.l Example Runstreams for Obtaining Carpool Lists . . . . .55

11
THE NBS COMPUTERIZED CARPOOL MATCHING SYSTEM:

USERS' GUIDE

Judith F. Gilsinn and Susan Landau

Applied Mathematics Division

Abstract : This report documents the NBS computerized carpool matching

programs and the procedures used in maintaining the coordinate data

base required by the matching system. The report includes flowcharts,

input/output formats, and program listings for the programs, plus

details of the manual process for coordinate coding. The matching

program produces, for each person desiring it, a list of other NBS employees

residing within a pre-specif led distance of him, and is thus applicable to a single work destination having primarily one work schedule.

The system is currently operational on the National Bureau of

Standards' UNIVAC 1108 computer and was run in March of 1974,

producing lists for about 950 employees in less than four minutes

computer time. Subsequent maintenance of the system will be carried

out by the NBS Management and Organization Division.

Key words: carpools; carpool matching; computer programs; transportation;

urban transportation.
1. INTRODUCTION

Mass transit is generally held to be the most efficient way of moving

large numbers of people between home and work, but this superiority

depends heavily on the spatial concentration of many trips' origins

and destinations to provide the assumed "mass." Where trips are more diffused geographically or in time, design of a mass transit system

may require circuitous routing and result in uneconomical load factors.

In addition, mass transit requires a large capital outlay for vehicles

and/or guideway, a requirement which normally implies long lead times

for implementation of major systems.

Carpooling, while less efficient on a cost per passenger-mile basis, avoids

these difficulties and may, by eliminating unusually circuitous routing

and low load factors, actually be more efficient for some trips. Also,

since in most cases it calls for little or no additional capital investment for vehicles or guideway, its implementation can be relatively rapid.

Until last year (1973), the major factors encouraging citizens to carpool

for work trips were economic: no need to own a second car, decreased

auto operating costs per participant because of decreased mileage, and

reductions (through sharing) of parking fees. Parking availability

itself was probably the most compelling factor which motivated many

companies and municipalities to promote carpooling. In addition, urban

areas had become Increasingly sensitive to the true costs of lengthened

travel times and air pollution resulting from vehicle congestion, as well as the losses implicit in dedicating large areas of valuable

urban land to auto-related uses. Despite special promotional programs

highlighting the advantages of carpooling, few cities were able to

increase average auto occupancy factors above 1.2 to 1.3 persons per

car during rush hours. The onset of the "energy crisis" last winter

changed the picture drastically; gasoline shortages and the resultant

long queues at gas stations vividly enhanced the desirability of

carpooling for many work trips.

Recognizing the desirable properties of carpooling at an early date, and

anticipating an increased awareness of this desirability in the face of

possible fuel shortages, in June of 1973 the Applied Mathematics Division

of the National Bureau of Standards (NBS) undertook a small-scale effort

to design and produce computer aids for carpooling. The effort was limited in the sense of being short term, low cost, and restricted in

application to NBS itself. The supervening fuel crisis of course added

urgency to this work. The primary output of this effort was a system

of computer programs and an associated data base for providing NBS

employees with lists of other employees who are potential carpool partners.

The system saw its first operational use on March 1, 1974, producing lists for

2
about 950 employees who had indicated a desire for such information on

a questionnaire distributed by the NBS Energy Task Force.*

The present report has been prepared to document the programs and

procedures used in that process, in order to facilitate maintenance

of the data base and future operation of the system. The report is

divided into three sections: the first gives an overview and general

description of the system and procedures, the second describes the data

base and provides instructions for maintaining it, and a final section

documents the computer programs. Program listings and a computer run stream for the operation of the programs are Included in Appendices,

as is an example of the interpolation process used in coding coordinates.

Although the system described in this report was developed for and has

been applied only at NBS, it has potential for use in other situations

as well. The current version is limited to one work destination and

does not take differences in working hours into account. These may

be handled by setting up separate files for different shifts and work

addresses, and running requests for lists separately for each place of

work and shift. The current version of the system handles up to 1,200

employees, but this is a function both of the size of computer and the

data retained concerning each person, both of which could be modified

as necessary. The philosophy and procedures have proved workable at

NBS, and much of the work is general in nature and can be adapted to

other settings.

* See Appendix D for a copy of the Questionnaire. No attempt has been

made to evaluate whether new carpools were in fact formed as a result

of the March distribution of lists, but increased carpool ridership

was noted from auto occupancy factor counts which rose from 1.2 in

the fall of 1973 to 1.4 in the spring of 1974.

3
2. GENERAL DESCRIPTION

Once it is decided that carpooling is to be fostered and encouraged,

the main technical requirement for its implementation is the capability

of matching-up compatible individuals with similar trips. Many

manual aids for this function are available, such as the carpooling

pin-in-map system long in use at NBS. In that system the person desiring

a carpool puts a numbered pin in a centrally located map display,

indicating the location of his home, and also leaves a card with his name and work address keyed to the same number in a cubbyhole below the

map. One can scan the map to locate possible carpoolers near one's home,

and then use the information on the number-keyed cards to get in touch

with them.

While this system might in principle be adequate for an installation

such as NBS, in practice it suffers from several drawbacks: 1) the

scattered nature of the NBS site, necessitating a special trip to the

centrally located map, 2) the frequent failure of those who have found

carpools to remove their pins and cards, and 3) the inclusion of only

those actively seeking carpools.

This latter drawback is particularly critical. Because of the paucity of

transit service available to NBS employees, those lacking an automobile

(and non-drivers) are in greatest and most immediate need of finding a carpool, and many of the map pins are placed by such people. Unfortunately

the process described above is slow, and an employee often cannot afford

to wait until someone happens to notice his or her need. In addition,

many drivers who, if approached, would be willing to accept riders or to

carpool, just do not think of using the pin map, since they do not need

a carpool. As a result, in the past most carpools at NBS were formed

through word of mouth. It seemed clear that real encouragement of

carpooling required a more aggressive, convenient , and comprehensive

matching system.

Several computerized carpool matctiing procedures were investigated, all

relying on the basic idea that potential carpool candidates are those

living near one another and traveling to approximately the same work

location. (This is, of course, somewhat of an oversimplification, since

some people may drive part way alone and carpool only for part of the

trip. Nonetheless it has generally proved a useful approximation.)

Computer carpool matching programs are therefore primarily programs for

locating neighbors with similar commutation travel characteristics, and

several procedures can be used for doing this. The simplest involves

matching on some piece of ordinarily available data which is correlated

with residence location, such as postal ZIP code or telephone exchange.

A postal ZIP matching was done on a limited basis for NBS employees

using an already developed data processing system and the NBS locator

file, but was dropped because over 700 employees lived in the single

Gaithersburg ZIP code 20760. Thus postal ZIP code areas are too large

for this process.

4
Telephone exchanges overlap geographically, and are thus also

unsatisfactory

The Federal Highway Administration has developed a computer carpool

matching program* using grid squares (about 1 or 2 miles wide). Each

employee desiring to form or join carpool locates the square in which

he he lives, and this square is uniquely identified by number, vrhich

is entered into the computer. The matching program then provides

lists to each person of all those potential carpool candidates within

his square, supplemented with those in squares to either side if there

are too few in the one square. This can result in people living near

the edge of a square receiving lists of only people who live in the same square but who are not as close as some person in the next square.

In addition, problems can arise if the variation in number of people

per square is very great, since the program only provides for 2 square sizes, one with side twice as long as the other. Inclusion of

a variety of square sizes intermixed geographically is much more

difficult, since the program must locate adjacent grid squares.

The NBS carpool locator system, described herein, avoids this latter

problem (particularly critical at NBS because more than 100 employees

live in a single one-mile square grid near the NBS Galthersburg site),

by using actual coordinates of employee home location. The coordinates

are obtained manually by locating the home address on a coordinatized

map. The computer uses the coordinate information to produce for each

person a list of up to 20 employees living within two miles**(and in

the Galthersburg area, within one mile) of him. It should be noted

that this procedure can also result in strange matches, since straightline distance may be very much shorter than actual road distance. For

instance, one NBS employee living in McLean, Va. , was perplexed that

his list contained the name of another employee living in Bethesda,

Md., indeed less than 2 miles away as the crow flies but in fact on the other side of the Potomac River. Such cases seem difficult to detect

automatically without referring to the actual road networks, a much

more cumbersome and complicated task, and in practice a list of 20

or so employees who are "neighboring" by a coordinate-based criterion

should contain many legitimate carpool candidates even though some poor selections may also be present. Alternatively one mipht use auxiliary information, such as ZIP code, as an additional key to weed

out unwanted matches.

Lew Pratsch, Carpool and Buspool Matching Guide, U.S. Dept. of

Transportation, Federal Highway Administration, Washington, D.C.

20590 (May 1973).

Non-metric units, miles and feet, are u-ed in this effort because

the scales of the maps available were in these units and they were

thus more convenient.

5
To avoid searching the whole file of potential carpoolers to find those

living near a particular person, the file of carpool candidates is

sorted into grid squares approximately 1 mile on a side. To locate

all carpool candidates within a mile of a specific person living in one square, only people living in that square and the adjacent ones need

be searched (as in the Federal Highway program), but actual distance

is used as the criterion upon which the chosen list is based. Thus

grid squares are introduced as an intermediate step to cut down on the

number of reasonable candidates for which distances to the current

person have to be calculated, but the list is based on actual

(Euclidean) distance.

The NBS carpool matching program uses the NBS locator file maintained

by the Management and Organization Division. This file includes, for

each employee:

' employee name social security number

NBS telephone extension

NBS division and section

NBS location

NBS mailing address

home address

home phone.

There has been added to the file, specifically for carpooling , the

coordinates of the employee's home address and his answers (coded)

to the transportation survey. Only persons who replied "yes" to

question 2 on the survey (i.e., those agreeing to he included in the

carpool matching system) are considered potential carpool candidates.

All of the carpool matching methods discussed above, including those

here at NBS, only provide information on prospective carpool candidates.

Actual carpooling arrangements must be made by the employees themselves,

since many personal preferences are involved in the choice of a carpool.

These may include: the flexibility of arrival and departure hours,

the driving habits of members, the size of cars used, the sex and age

of carpool members, whether smoking is allowed, the topics of conversation and preferred radio programs. (In all cases, punctuality and

courtesy toward other members are essential for success.) Since such

diverse factors affect actual choice of carpool members, the lists

produced by the NBS computerized carpool locator system contain up to

20 employees in the hope that such a number is sufficient for each

person to be able to identify a compatible carpool.

6
3. DATA BASE

The data base used by the NBS carpool locator programs is the NBS

locator file maintained by the Management and Organization Division

on tape in COBOL-readable format. Figure 3.1 indicates the format

of the data contained on this tape.

3.1: Transportation Survey Responses

The third and fourth coded answers* to the questionnaire sent out by

the NBS Energy Task Force are the only ones relevant to the carpool

matching program. The presence of a "Y" as fourth character in the

coded answer set signified that the person's address had changed

from the one originally in the locator file, thus requiring that new coordinates be determined. New coordinates were located for all

Y-responses, unless we had no new address for the employee, because

had not reported his change of address on Form NBS-390, (Directory

Information). Since from now on, address changes will be dealt with

as they are received, Y-responses to question A will no longer be relevant.

If the third character of the coded answers to the transportation

survey is a Y, the person requested a carpool list and agreed to be

included on others' lists. Any other character is interpreted as not

desiring to be included. The carpool candidate file is made up of

only those having a Y as third character. Thus any new entry to the

file will be included in the carpool matching (both to receive a list

and to appear on other lists) only if a Y is inserted as the third

character of the coded survey responses, whether or not this person

actually answered the whole questionnaire.

3.2: Coding Coordinates

The coordinates of the employee's home address appearing in the data base

are obtained by a manual process. The original coding of coordinates

for all employees was done by Applied Mathematics Division personnel,

with corrections to include in the file all changes received as of

February 26, 1974. It is expected that the present documentation will

enable further maintenance of coordinate changes, deletions and

additions by Management and Organization Division personnel.

The coordinates are numbers of up to 5 digits representing distances in

hundreds of feet east (x-coordinate) and north (y-coordinate) of an origin located approximately in Manassas, Virginia. The location of the

origin was arbitrary, chosen mainly because it was the lower left corner

of one of the sets of maps employed. Negative coordinates indicate

locations west (negative x-coordinate) or south (negative y-coordinate)

of the origin.

Two answers were coded for question 1 so that the third and fourth

coded answers refer to questions 2 and 3 on the form in Appendix D.

7
Figure 3.1

Data Format for the Locator File Tape

characters

Social Security number 1-9

NBS telephone extension 10-17

Name ;

' 18-43

Special employee code 44-A7

Division and Section , . 48-53

Building^ 54-58

> NBS office location

Room J : 59-63

Building 64-68

r NBS mailing address

Room J 69-73

Home address (street and city) 74-122

ZIP code of home address , 123-127

Home phone . / 128-138

x-coordinate of home address 145-149

y-coordinate of home address 150-154

coded answers to the transportation 155-166

survey .

8
The actual map sets used for locating the coordinates are listed in

Figure 3.2. The Alexandria Drafting Company maps were chosen because

(1) they were readily available from local drug stores, (2) they covered

the whole metropolitan area, (3) they contained sufficient detail

showing every street, (4) they are updated every year and thus contain

addresses in new subdivisions, (5) they all used the same scale, (6) they

each contained a street index to facilitate look-up, and (7) block numbers were given every few streets so that house numbers could be located at

least to the actual block. Unfortunately, we were unable to obtain a map of Frederick County possessing all of these properties, but the

State Highway Administration map is current and does show all streets.

The Alexandria Drafting Company maps listed in Figure 3.2 were already

overlaid with a grid of approximately 1 inch squares. The scale on all except the one depicting Frederick County is 2000 feet per inch.

We chose to represent our coordinates in hundreds of feet, meaning

each 1 inch equals 20 coordinate units. Coordinates of the grids

were then marked in the map margins. (On some of the maps the grid

marked on the map was not actually 1 inch square, but rather 1 inch

by about 19/20ths of an inch. We compensated for this discrepancy by

dully labeling the coordinates.)

To locate an address on the maps one must first know which map to use,

which requires knowing which area the address is in. The state Identifier

differentiates Northern Virginia and the Pistrlct of Columbia from

Maryland in most instances, although a mailing address in one jurisdiction

may actually be located in another. Locating addresses in the Maryland

counties becomes fairly routine with practice, using the city name and

in some instances the ZIP code zone (which is indicated on the map).

Addresses near map boundaries often appear on two sets of maps.

Once the correct map is selected one can look up the street in the index

(except for the Frederick County map, which has no index). Any street

not appearing in the main index may appear in the supplemental index

of new streets. The index gives the page number and grid square (for

instance 23C9 for page 23 grid C9) in which the street appears, possibly

listing several grid squares if the street is long. Special care must be taken when one name appears with several different qualifiers,

such as street, avenue, boulevard, drive, circle, etc.

Once the street is located, the block numbers can be used to locate

the actual address. Here again care must be exercised in detennining

the correct block, since many streets occur in several disconnected

segments. Most of Montgomery County and the District of Columbia are marked off in grid systems, so that for instance house numbers in all

blocks on east-west streets at the same longitude have roughly the same

number. Some local jurisdictions (such as the city of Gaithersburg)

may not conform to this numbering system. Thp county grid addresses

can be a valuable aid in locating rural addresses for rural routes which

include street addresses. The street addresses are also a valuable aid

in locating coordinates for addresses on streets not appearing in the

index, since the location can be approximated from the grid system and

ZIP code information.

9
Figure 3.2

Maps Used In Coding Coordinates

General Highway Map, Frederick County, Maryland, prepared by the

Department of Transportation, State Highway Administration, Roads

correct to 1/1/73, scale: 1 inch = 2 miles, obtained from

Frederick County Roads Board, Winchester Hall, Frederick, Md.

21701, price $.75.

Montgomery County Street Map,

Washington, D.C. and Vicinity Street Map,

Northern Virginia Street Map, and

Prince Georges County Street Map, all with scale: 1 inch = 2000 feet,

published by Alexandria Drafting Company, 417 Clifford Ave.,

Alexandria, Va. 22305, available from Byrrd Enterprises, 1126

Cedardale Lane, Alexandria, Va. 22308, price $4.00 apiece.

10
Figure 3.3

Coordinates for Selected

Gaithersburg Addresses

STREET X Y

King James Way 1021 1630

Lost Knife Circle 1038 1777

Quince Orchard Blvd. 960 1652

Walkers Choice 1026 1732

Westside Drive 1024 1600

11
The final operation in this process is to associate coordinates with the

map location found above. This is accomplished by estimating (or alternatively measuring) the actual x and y coordinates using the numbers listed for

that grid on the map margin, interpolating between those along the top or bottom of the page for the x-coordinate , and between those along the

left or right side for the y-coordinate . See Appendix C for an example.

There are some addresses which cannot be located by the above procedure.

In some cases the street cannot be found either in the map index or on

the map, usually because it is in a new subdivision. These cases are likely to

be few enough in number that the employee can be contacted directly to

obtain the location. In other cases the information in the locator file

is erroneous, which again can be ascertained by querying the individual

directly. Some addresses listed in the locator file are Post Office box

numbers which do not actually reflect the location of the home address.

Again the only source of better information is the employee himself.

Several apartment complexes in Gaithersburg have many NBS employees

residing in them. To ensure that people living in the same complex

receive lists containing others from that complex, each has been

assigned a single pair of coordinates. Figure 3.3 lists the street

addresses of those complexes and the coordinates chosen for people

living on those streets. ;

.

Many addresses in upper Montgomery County and Frederick County are postal rural route addresses. Recognizing the difficulty of locating

homes on rural routes, we wrote letters to several post offices requesting more detailed information about the addresses on these routes. Those

routes for which the postmaster supplied box numbers on each road segment

were coded using this information. Of course only approximate location

was possible, but it is hoped that any location is probably not more than

half a mile to a mile in error. For those places for which the information was not sufficient to locate an address with this precision, all

addresses for the same ZIP code were located at a single point, chosen

to be geographically representative. Figure 3.4 lists ZIP codes and the

coordinates chosen. Note that whenever more accurate information is

available it is used. For instance many Clarksburg addresses are listed as both rural route box numbers and street addresses. In these

instances coordinates for the actual location can be given. The

coordinates in Figure 3.4 for Clarksburg are used only if more precise

Information is not available.

The list in Figure 3.4 also contains some towns (such as Columbia)

for which it would have been possible to locate addresses exactly, but

which are far enough away from the NBS Gaithersburg site that employees

living in the area might be willing to carpool with others living more

than two miles away. To allow this, all in th-^ town are given a single

point, so that the carpool matching program will provide each with a list of the others in the same town or ZIP code.

12
Figure 3.4

Coordinates for Rural Routes

ZIP CITY X Y

20704 Beallsville 440 1782

20715 Bowie 2361 1025

20734 Clarksburg 818 2020

20753 Dickerson 403 1938

20837 Poolesville 416 1660

21043 Ellicott City 2203 2110

21043

21044 > Columbia 2033 1927

21045

21701 Lantz 340 2680

21710 Adams t own 258 2287

21713 Boonsboro -243 3004

21714 Braddock Heichts 168 279 3

21716 Brunswi ck -153 2332

21717 Buckevstown 358 2362

21740 Haeers t own -394 3506

21754 Ij amsville 710 2402

21755 Jefferson 108 2470

21758 Knoxville -278 2342

21761 La Gore 722 3164

21767 Maucansvllle -394 3550

21769 Middletown 55 2765

21770 Monrovia 835 2520

21771 Mt. Airy - city & box /' 1170 2520

rural route 1 rural route 2 1190 2570

rural route 3 1150 2460

rural route 4 1100 2670

rural route 5 1110 2510

13
7 TP n T TV

X Y

, .21773 Meyersville 0 3004

' 21776 New Windsor 1310 3130

21777 Point of Rocks 120 2181

21780 Sabillasville 320 3706

21787 Taney town 1115 3555

21788 Thurmont 447 3425

21790 Tuscarora 258 2332

21793 Walkersville 609 2933

21797 Woodbine 14 39 1589

21798 Woodsboro 720 3095

22075 Leesburg, Va. -14 1568

22080 Lovettsville , Va. -195 2150

2/110 Manassas, Va. 223 337

22191 Woodbridge, Va. 640

j -90

14
Coordinates were established in a similar manner for those living in "fringe"

commuting areas, that is, those not appearing on the maps or in the

list in Figure 3.4 but still considered within commuting distance of

NBS. Examples include people living in Annapolis, Baltimore, Westminster,

Harpers Ferry, and Winchester. These fringe areas are divided into two

segments which may be thought of as arcs of a circle. One of these

arcs runs from the Potomac River south of Washington to the east and

north up to Baltimore, including Annapolis. The second starts west of

Baltimore and runs counter-clockwise around again to the Potomac south

of Washington including Harpers Ferry and Winchester. The first fringe area receives coordinates (lAOOO , 14000 ) and the second (17000,17000).

People living in these areas receive lists of all others living in the same are of the fringe, most of whom will however not live very close by.

It is felt that even though people in fringe areas receive many incompatible names, it is better to have them included since some names may

actually be compatible for carpooling.

Some people included in the locator file have addresses that are clearly

outside commuting distance. In most cases these are consultants who

visit NBS for short periods and whose home addresses may be anywhere.

These people are not included in the carpool file. They are given coor- dinates (99999, 99999). Employees for whom the locator file contains no address also receive coordinates (99999, 99999).

Once coordinates for an employee's home address are determined, they are punched on a computer punch card in the format given in Figure 3.5, and

are added to the locator file. Coordinate changes are made in the same way as initial coding, and are accomplished with the same type of card. The

cards then become input to a file update program maintained by the

Management and Organization Division.

15
Figure 3.5

Format of Card for Adding Coordinates

to the Locator File

cols . contents

1 the letter C

2-10 employee Social Security

Number

12-16 x-coordlnate (right justified)

18-22 y-coordlnate (right justified)

24-47 employee name (not required

but useful If there Is an error)

80 the number 3

16
4. THE CARPOOL MATCHING PROGRAMS

The data base described in the previous section is input to the carpool

matching programs described below. Figure 4.1 is a flowchart of the

procedures and programs involved in the NBS carpool locator system.

The programs are all operational on the IINIVAC 1108 under the EXEC 8

operating system at NBS.

The file updating program was written and is maintained by Karen Burke

of the Management and Organization Division. The coordinate update

cards described in Figure 3.5 are input to this program, as is the

locator file also maintained by Mrs. Burke. The updated locator file

then becomes input to the extractor program, EXTRACT, a COBOL program

written by Patricia McGuire and Alfred Redstone of the Computer

Services Division to extract the data on those who have agreed to be

included in the carpool file (currently those with Y for the third

coded answer to the transportation survey, see section 3.1) and output

them in FORTRAN readable form. This file is first input to program

SELECT, which selects those to receive lists this time (usually those

who have received new coordinates in the latest locator file update,

but not limited to these alone). The carpool candidate file is also

input to program GRID, which sorts all candidates into grid squares,

computing the position in this list of the ends of the sublists

corresponding to the individual grid squares. The final program,

POOLIST, uses outputs from both SELECT and GRID to produce carpool

lists for those desiring them. Descriptions of the programs EXTRACT,

SELECT, GRID, POOLIST, and other subroutines required by them appear

below. Program listings appear as an Appendix, as do sample control

card streams for run setups. All programs use Social Security numbers

to identify employees; alternate identification numbers could be used

if privacy considerations warrant.

4.1: Program EXTRACT

Program EXTRACT is a COBOL program to read the locator file, extract

only those who have the third coded answer to the transportation survey

equal to Y (those who agreed to be in the carpool candidate file),

and write them out on a FORTRAN readable file. EXTRACT calls two

FORTRAN subroutines: FORWRT to write out data for each person in

the carpool candidate file, and FOREND to endfile the candidate file.

A flowchart of EXTRACT appears as Figure 4.2.

Input to the program is the updated locator file on tape in COBOL

accessible format and assigned to unit B. The contents of this tape are described in Figure 3.1. Output from EXTRACT is the carpool

candidate file, which must be assigned to unit 7, and which is described

in Figure 4.3. The program also prints the number of employees in the

17
Figure 4.1

Flowchart of the Carpool Matching System

COORDINATE

UPDATES

SELECT SELECT

THOSE TO

RECEIVE LISTS

FILE

UPDATING

PROGRAM

EXTRACTOR

PROGRAM

EXTRACT

SORT INTO

GRID SQUARES

GRID

PRINT CARPOOL LISTS

POOLIST

LIST OF

CARPOOL

CANDIDATES

FOR EACH

DESIRING

18
Figure A .

2

Flowchart of

19
Figure A .

3

Format of Each Data Record of the

Carpool Candidate File

characters contents

1-9 Social Security numher (SS*)

11-36 employee name (NAME)

38-42 NBS mail address building (BLDG)

43-47 NBS mail address room (RM)

49-52 NBS phone extension (EXT)

54-59 NBS division and section (DIV)

61-65 x-coordinate (X)

66-70 y-coordinate (Y)

72-125 home address (ADDR)

*Refer to Figure 4.8 for array names used in the programs.

20
locator file (MASTER-RECS) and the number of employees in the carpool

locator file (SDF-RECS).

4.2: Program SELECT

SELECT is a FORTRAN program which selects those for whom lists are to

be obtained. Input to the program is the Social Security numbers of

those desiring carpool lists, one to a card in columns 2 through 10.

Since this is compatible with the format in Figure 3.5, the locator

file update cards can be used for this purpose. It is expected that

people will often desire lists when an update has been made, and the

same cards or duplicates can be used in the two processes. SELECT also

requires as input on unit 7 the carpool candidate file described in

Figure 4.3. Output from program SELECT is a file on unit 8, containing

those desiring carpool lists in the same format, that is given in

Figure 4.3. It should be noted that the data contained in this file are the same as those contained in the carpool candidate file for

each candidate (with the exception of home address), but in a slightly

different format. Output also includes a printed list of any duplicate

input Social Security numbers, a list of any requested Social Security

numbers not found in the carpool candidate file, and the total number

of people actually selected.

Figure ^.4 is a flowchart of program SELECT. It can be seen from

this flowchart that SELECT expects the carpool candidate file to appear

sorted in order by Social Security number, with those "numbers" beginning

with the letter A appearing first. SELECT does not call any other

subroutines, but does refer to the UNIVAC 1108 FORTRAN V function

FLD (i, j, k) which is used to pick j bits from the word k, starting

with bit i, with bit 0 being leftmost. This function is required in

the sorting procedure, because of the mixture of alphabetic (the

letter A) and numeric characters in the leftmost position of the

Social Security number. Figure 4.5 lists the variables and arrays

appearing in SELECT. A listing of the program may be found in the

Appendix.

4.3: Program GRID

GRID is a FORTRAN program which sorts the carpool candidate file into

grid squares, so that all employees living in one square appear together

in the file. GRID calls subroutine SORTP, written by Dr. James Filliben

of the Applied Mathematics Division, to do the sorting. The calling

parameters for SORTP are described in Figure 4.6. Input to program

GRID, and assigned to unit 7, is the carpool candidate file whose

format is given in Figure 4.3. Output from GRID consists of two files:

on unit 8, the file of carpool candidates sorted into grid squares in

the same format as the carpool candidate file (Figure 4.3), and on

unit 9, the list giving the index of the last person in each grid

square, 20 indices per record, six characters per index number.

21
Figure 4.

A

22
Figure 4.5

Variables and Arrays In Subroutine SELECT

Name

Dimension

or value,

(if Parameter) Description

CAND 23 array containing all information for

a person in the carpool candidate file

INSEL number of employees to be selected

(note that the input list may have

duplicates or erroneous Social

Security numbers, so INSEL may be

greater than NSEL)

MSEL = 1000 maximum number to be selected

NEXT MSEL array used in sorting the Social

Security numbers to be selected.

NEXT (i) is the index of the next

largest Social Security number

beginning with "A" precede those

beginning with a numeral.

NSEL number of employees selected to

have lists printed (see INSEL)

SS MSEL X 3 Social Security numbers to be

selected

23
Figure A .

6

Parameters In the Calling Sequence

of Subroutine SORTP

SORTP (ILIST, N, JLIST, INDX)

where

:

ILIST - the list to be sorted

N - the number of entries in ILIST

JLIST - the ILIST in sorted order

INDX - INDX (1) is the position in ILIST

of the i^h entry in JLIST.

24
Figure 4.7 is a flowchart of program GRID. Variables and arrays used

in the program appear in Figure A. 8. The grid system used in the

carpooling effort is determined by the coordinates of the lower left

corner, (MINX,MINY) , which are (-400, -100), and by the width DELX

and height DELY of each rectangular grid element, both 50 coordinate

units here (making the grid units square). The entire main grid is

68 squares wide and 82 squares high (NY), with the two fringe area arcs placed in the two "squares" following square number 5576 (68 x 82)

.

The squares are numbered from bottom to top and left to right, so that

the grid square number for an employee with coordinates (x,y) is given by

[(x-MINX)/DELX] *NY + [ (y-MINY) /DELY ] + 1,

where [x] denotes the greatest integer not exceeding x (e.g. [3.9]=[3] = 3.)

Coordinates for fringe areas are handled separately. The program calculates this grid number for each employee in the carpool candidate file,

sorts the employees on their grid numbers, and calculates (and stores

in LASRSQ) the position of the last employee of the sorted list in each

grid square. If there are no employees in a square i then LASTSQ(i) «= LASTSQ(i-l). Therefore employees in grid square 1 appear in positions

LASTSQ(i-l) + 1 to LASTSQ (i) , but if LASTSO (i-1) = LASTSO(l), square

i is empty.

4.4: Program POOLIST

POOLIST is a FORTRAN program which prints out the lists of potential

carpool candidates for each person desiring such a list. POOLIST also

calls subroutine SORTP, described above in Figure 4.8. Input to

POOLIST consists of the file of those to receive lists on unit 5 and on unit 7 the file of carpool candidates sorted into grid squares, both in

the format given in Figure 4,3, and on unit 8 the grid index list file

described in the previous section. A sample output is reproduced as Figure 4.9. Home address is not given in the carpool list since some employees might consider it an Invasion of privacy.

A flowchart of POOLIST appears as Figure 4.10, and variables and arrays

used in the program are described in Figures 4.8 and 4.11. For each

person desiring a list, POOLIST first calculates the grid square in which

he lives. If he lives in an area containing many employees close to NBS

(the area with x-coordinates between 950 and 1150 and y-coordinates

between 1550 and 1750), then POOLIST will provide a list of those not more than one mile (actually 5000 feet) from him. If he lives outside

this area, the acceptable radius is 2 miles (or 10000 feet). POOLIST

actually calculates the square of the distance between the person

requesting a list and others, and this is compared with 2500 coordinate

units (the square of 50, which is 5000 feet expressed in coordinate

units) or alternatively with 10000 coordinate units, which is the square

of twice 50 units.

25
Figure A .

7

Flowchart

FOR EACH EMPLOYEI

READ

EMPLOYEE

DATA

COMPUTE EMPLOYEE

GRID SQUARE NUMBER

SORT E!1PL0YEES BY

GRID SQUARE NUMBER

FOR EACH

GRID SQUARE

WRITE OUT

EMPLOYEES

IN

GRID

COMPUTE NO. OF LAST

EMPLOYEE IN GRID

NO

WRITE OUT

)T EMPLOYEI

\NUMBERS FOR,

EACH GRID

GRID

26
Figure 4.8

Variables and Arravs in

Subroutine GRID

Name

uxuiension ^.ur

- Value,

if Parameter) Description

ADUK employee home address

HT 'HP iNDo DUiiuinf.^ vmaij auuress^

wiGcn oi a j^ria square

(in coordinate units)

r\I77 V Ur.Li -50 height of a ^^rld sauare

DIV MCAND NBS Division and section

EXT MCAND NBS phone extension

FRING 1 =14000 fringe area 1 coordinates

FRING 2 =17000 fringe area 2 coordinates

riL.AiNU prici square numner

GbUKi NLANU grid square numbers in sorted

order

INDX MCAND index of emplovees sorted by

grid square number

LASTSQ NXY 2 position of the last employee

in each grid square

MCAND = 1200 maximum number of employees

In the carpool candidate file

MiNX = - AUU minimum allowable x-coordinate

MINY =-100 minimum allowable y-coordinate

NATlfi nLANU X J employee name NCAND number of employees actually

in the carpool candidate file

NX =68 number of grid squares horizontallv

NXY =NX*NY number of squares in the main

NXY2 NXY + 2 number of souares in the main

grid plus fringe areas

NY = 82 number of grid squares vertically

27
Name

Dimension (or

Value

,

If Parameter) Description

RM MCAND NBS room (mail address)

.\ ;ss-^ . MCAND X 2 emplovee Social Security number

- MCAND x-coordinate of employee home

address

MCAND y-coordinate of employee home

address

28
Figure 4.9

Sample Output

******************************

* _ * * DOE JOHN *

* - * * DIV. 850.00 *

* *

* ADMIN A1200 *

* * ******************************

IN RESPONSE TO YOUR REQUEST FROM THE TRANSPORTATION SURVEY,

BELOW IS A LIST OF NBS EMPLOYEES WHO LIVE NEAR YOU AND ARE

INTERESTED IN CARPOOLING. THIS INFORMATION INCLUDES DATA

FROM THE PERSONNEL LOCATOR FILE WHICH CONTAINS PERSONNEL WHO

REQUESTED THAT THEIR HOME ADDRESS NOT BE PUBLICIZED. ALSO IT

HAS COME TO OUR ATTENTION THAT PERSONNEL HAVE MOVED BUT HAVE

NOT NOTIFIED THE MAIL SECTION OR PERSONNEL DIVISION OF THE

CHANGE. CONSEQUENTLY THERE WILL BE PERSONNEL WHO REQUESTED

LISTS BUT WILL NOT RECEIVE THEM OR WILL NOT BE LOCATED

CORRECTLY.

NAME DIV. EXT.

BEE ALBERT 700.01 5213

DEE CARL 802.00 5347

EFF ELLEN 703.00 5222

AICH GAYLE 750.01 5764

JAY IRA 702.00 5916

ELL KAREN 801.00 5111

ENN MARTIN 803.00 5328

PEA OTIS 701.00 5514

ARR QUENTIN 704.00 5998

TEA SAMUEL 750.04 5769

VEE URIAH 700.01 5146

EX WAYNE 801.00 5224

ZEE YOLANDA 704.00 5165

29
Figure 4.10

1 Flowchart of

READ

EMPLOYEES

SORTED BY

GRID

READ NUMBER

OF LAST

I EMPLOY EE IN/

EACH GRID

P 0 0 L I S T

READ PERSON

DESIRING

CARPOOL

YES

ik

COIIPUTi: WHICH GRID SQUARES

SHOULD BE EXAMINED FOR

THIS PERSON

EXAMINE APPROPRIATE GRID SQUARES,

STORi: ALL i:MPLOYEES CLOSE

ENOUGH TO THIS PERSON

30
Figure 4.11

Variables and Arrays Appearing

Only in Subroutine POOLIST

Name

Dimension or Value

(if Parameter) Description

CAND MCAND X 9 Carpool candidate data

CAND (i,l)-CAND(i,5) : name

CAND(i,6): division and section

CAND(i,7): NBS phone extension

CAND(1,8) ,CAND(i,9) : x and y

coordinates

D MNEAR the sorted DIST array

DIST MNEAR the distance of each person

in NEAR from the current

person desiring a list

INDX • MNEAR the index of those in NEAR

sorted by DIST

IX x-coordinate of the current

person desiring a list

lY - y-coordinate of the current

person desiring a list

LFOR 8 the information about the

current person desiring a list

LF0R(1)-LF0R(5) : name LFOR(6)-LFOR(7) : NBS mail address

LF0R(8) : NBS phone extension

MAXX =MINX + NX*DELX

Maximum x-coordlnate in the main

grid

MAXY =MINY + NY*DELY

Maximum y-coordinate in the main

grid

MILESQ =2500 a conversion factor equal to the

square of 5000 feet in coordinate

units

MNEAR = 500

31

maximum number of employees within

an acceptable radius of the one desiring a list
f

Name

Dimension or Value

(If Parameter) Description

MPRINT =20 maximum number of employees

appearing on any list

NEAR MNEAR X 7 information about those living

within an acceptable distance

of the current person desiring

a list (similar to CAND)

MNEAR number of employees within an acceptable distance of the

current person desiring a list

- _ NPRINT number of employees actually on

32
One could search the whole coordinate file, computing the (squared)

distance between each person and the current person desiring a list,

but this would be quite time-consuming. It is to avoid this complete

search that the grid system has been introduced. Note that the grid

squares are only used internally to the locator system and because

actual coordinates are recorded for each employee, the choice of grid

system is essentially arbitrary and can be changed if desired (for

instance to agree with a grid system used by another agency). In

addition, the grid system does not in any way determine whether or not

a person will appear on a list; it is simply an intermediate dataprocessing tactic which allows the program to avoid considering employees

who could never be included on the current person's list because they are clearly too far away.

The list contains up to 20 potential carpool candidates. The person

receiving the list will usually find his own name included, so that in

most cases the number of candidates is actually ^9. This also means that

people who do not live sufficiently close to any other employees included

in the carpool system (recall that an employee must have consented to

inclusion) will receive only their own name. The limitation of inclusion

to consenting staff members may, of course, result in the omission from

a person's list of a neighboring employee known to him.

If a list contains fewer than 20 people, they will be listed in

essentially random order, but if more than 20 were found living within

an acceptable radius, POOLIST sorts them in increasing order of distance

from the person whose list is being created. Only the 20 closest are printed. Since (as noted in Section 3.2 and Figure 3.3) all addresses

in several apartment complexes in the Gaithersburg area are given one coordinate set, it is possible that more than 20 people will have the same coordinates. Special procedures are used to insure that these will

receive different lists. In this case the next 20 names following the

person receiving the list are selected. If necessary remaining

candidates are selected from the top of the list.

POOLIST was put through its first application run on March 1, 197A, and

printed lists for about 950 employees in about 2 minutes CPU time.

Listings of programs EXTRACT, SELECT, GRID, POOLIST and SORTP are included in Appendix A. Appendix B contains runstreams for running

these programs on the NBS UNIVAC 1108 computer.

33
, APPENDIX A

Program Listings

3A
F X T P A T

I ^F^|T I r 1 r AT I O'l OfVT'^iniM.

ppnf,PAM-in. F)fTP«fT AND PKOmiCt FILF FOR CARPOOL.

AllTHOP. PAT MCClMPF.

DATE WRITTFM, FFP, 197M,

FMVIPOMMF^JTnIvlSIn^l,

COMFIfiURATinK) SFCTinw,

cOHPfF-C'^MPllTFP , UN I VAC- 1 1 Ofi .

I NPIIT -OUTPUT <;FCT!0M,

FIl. F-rONTRni . SFLECT LOrATOR-FILF AS5IGM TO UNISFRVO B.

n ATA 0 ! V T S T OM , FTLF «^FCTIOM.

FO LOC ATOP-F I I F LAREI prropn<; apF OMI TTFO DATA RECORD

n 1 LOC -PFC PIC X < PIM ) . COMM OM- STOP AGF SFCT I ON . n ! S TO -TAMO-PFC,

0 r A N n - «; s PIC X ( 9 ) . n;^ F 1 LI FP PIC X VALUE SPACE

.

rA^I^_^JAMr PIC X ( 2 h ) * F I LI FR PIC X V A L U F SPACE . 03 fAN'^-'^LOr, PIC X (10).

oi FILLER PIC X V AHJf SPACE , 03 rANH-rxT PIC X ( M ) . 0 3 F ILLFP PIC X V A L UF SPACE . "3 r A -n I V PIC X ( 6 ) . 03 F I LLFP PIC X V AH'F SPACE , 03 r A MO _ » PIC X ( S ) . P •» r A NH - V PIC X ( S ) . 0 3 r u 1 TP PTC X V AL UF SPACE . 0 3 (- ANP- ADf^P PIC X ( c, M ) . 0 3 F I LI PIC X ( 7 ) V ALUF SPACE . 'VORtf I NT -c;TO'^ft';F '^Fr T I ON , 7 7 L OC -PFC PTC 9 ( ^ ) , 7 7 raMD-RFc^ pir 9(6).

1 nc -<;w I Tr M P I C 9 V A L U F 0 . Rfl L Of -r np VALUE 1 . n 1 STO -LOC-Pf='C . 0 T <;s P I C X ( 9 ) , 03 •m-PMOMF . 0^ f I LI FP

f - F X T P I C P I C

X ( M ) . X ( M ) . 03 M A r P I C X ( 76 ) . 0 3 T YPr P I C X X X X . 03 n ! v-«;fc P I C X ( 6 ) . 03 LOC .

1 -RLnr,

OS 1 -RM

P I P 1

C X X X X X . C X X X X X . 03 MAIL.

OS M-RLor,

n C, M _ p M P I P I

C X X X X X . C X X X X X . n 3 A OOP . OS «;tpfft P I C X ( ?fl ) . 05 C I T Y-ST PI C X ( 70 ) . OS F I LL FP P I C X .

35
PIC X X X X X ,

0 T n ^

n ^

XXX.

X ( « ) . X ( 6 ) . X ( S ) . X ( «^ ) . occurs I ? PIC X ( 68 ) .

P I C P I C P I C P 1 C P I C

D'^ 7 I P H-PHHMF,

OS HP- AT A nc, HP-MtiM

f" I LL TP

ir OOP

Y - r n n o ANS^fS PIC V OCCUPS I? TIMFS,

F I LL

PPncFPUPr DIVl<;iOM,

A-T^JlTiALlZr SFCTIOM.

AH I 0 ,OPFN INPUT LCiC A TOP-F I LE

MOVE 7FPns TP IOC-«ECS CAND-PFCS.

An7q .prpFPRM R-9F AfS- I NPUT . IF L^C-For

Cl'^'^r L^CATOP-FILF

MOMITOP Lnc-PFCS CAND-PTCS

FNTFP FnOTPA^' rnPEND SUBPOUTINE

STOP PUN

.

PFRFOPM C-RUUn-nitTPUT,

PTPfroRM n-wRiTF-niiTPUT.

GO jn A n 7 n , p-RFAO-I^iPIIT <;FCTinM.

RH I n

.

PFAO LOrATOP-FlLF IfjTO STP-LOC-PFC

i«TFMnGOTnr»n?P.

APr, \ J n LOC-PFCS .

I F AMSWFDc; ( 3 ) - » Y

t r,OTPn-FXIT.

GP T n RO f 0

,

RO?n .

• ' MPVE I TP lPr-<;ilVITCH, , R-F X I T

.

FX I T . r - R I ) I I n _ p 1 1 T P M T S F C T I 0 ^1 . cn 1 0

.

MP VE SS TO C A ^JU -ss

.

MP Vt N A M F TO C AND - N A M F . MP v E M A I 1 TP C AND -RLDG

.

MOVE i^-F V T T P C AND -FX T .

r< P V E n I V - s F C TO C AtlD -D I V . MOVE X-C<^'^R TO C AND - X . MP V F Y-CPPR T 0 C A N 0 -Y . MP VE A PPP TO C A NU - ADDP , C-F X I T , F X I T . ; —

n-WRlTF-PlJTPUT SFC T I P^' .

''^ \

' D 0 I n ,FMTFP FORTRAN FPP'^'KT SUBPOUTINF.

APP \ TP ''ANP-PFCS,

n-F X I T

.

X I T .

36
CnMMOM OIJMM Y , C AHD ( ) MO]jr (7,900) < r AND ( T ) , T = I , 7?

)

900 FOP^^AT (??AA)

R P T • I P M

F MO

E N 0 r I I F 7

END

37
C THIS PnilTIMF SnPTS THT nrMrfiTS OF TNT INPUT VECTQP X ANO PUTS THE

C FLF^^PMTS IMTO Tur VFCTOP Y. IT ALSO ^arpjes aLOMG THF INDEX NUMBE

C OF FflCM npOFRFn OPSFPVATTnN--TUAT IS, IT CAPklLS ALONG TMF POSITIO

C THF I-TH ORDEPf^n ORSFPVATIO^' (FOP FAfM I) AS IT WAS IM THE ORIGINA

C UNOPDFPFO DATA VFCTOP X. TMFSr POSITIONS ARF PLACED IN THE VECTOR

C THIS PnuTIMF IS MSFFUL IH ATTF"PTIMG TO LOCATE THE MINIMUM, THL MA

C OP SOME OTHFR OPOFPFP n 0 <; F R V A T T o M or INTFREST IN THF ORIGINAL UNQR

C • INPUT VFCTOP X.

;C THE INPUT TO THIS ROUTINF IS Tmc SI Mr, IF PRECISION VECTOR X OF

C (UNSOPTFO) OBSrP\/AT I HNS , THF IMTFGFP VALUE N (= SAMPLE SIZE)*

G AM FMPTY SIM GIF oppcjc;iON Vf'CTOP Y INTO WHICH THF SORTED OBSERVATI

C 'MLL PF PLACED, AND an tmpty SINr,LF PPFCTSION VECTOR XPOS INTO WHI

C POSITIONS OF TMF SOPTFD OOSFRVATTOMS *i][,L BE PLACED.

C THF OUTPUT FROM THIS POUTINF IS TrF STNGLF PRECISION VECTOR Y INTO

C THF SORTFO ORSFPVATIONS MAVF RPTN PIACFD, AND THF SINGLE PRECISION

C XPOS INTO WHICH THF POSITIONS or THF SORTED ORSFPVATIONS HAVE BEEN

C RFSTRICTIOMS ON THF MAXIMUM ALLOi^APIF VALUE OF N--THE DIMENSIONS

C OF VFCTORS U) AMD IL (DEFINED A NO u<;Fn INTERNALLY WITHIN THIS ROUT

C- DETFPMINE THF MAX|mum ALLOWARLF VAIUF OF N FOR THIS

C ROUTINE. IF lU AND IL EACH HAVf DIMFNSION K, THEN N MAY NOT EXCEE

r p.tfk'+n - I. FOP THIS POUTINF AS WRITTEN, THE DIMENSIONS OF lU A C HAVE RF^N SET TO T/,, THUS T^F "AXIMIim ALIOWAHLF VALUE OF N IS

C APPROXIMATEIY \M RitLION. SI'ICF THIS FVCFEOS THE MAXIMUM ALLOWAB

C VALUE FOP AN M'TFGFP VAPIABI*^ TN MANY COMPUTERS, AND SINCE A SORT

C PILLION FIFMFNTS IS PPFSTNTIY ImpraCTICAI AND UNLIKELY, THEREFORE

C TEST FOP WHFTHFP THF INPI'T SAMPir s I 7 F N EXCFLUS 137 BILLION HAS B C ptCOPPOPATFO INTO THIS ROUTINE. IT IS THUS ASSUMED THAT THERE IS

C (PRATTICAL) PFSTPirTlON ON THF MAXIMUM VALliE OF N FOR THIS ROUTINE

C PRINTING-- NONE UNL'^SS AN FRPOP CONDITION EXISTS

C THIS POUTINF IS SINGLE PPFC'SIOn in I N T E N A L OPERATION.

C SUBROUTINES N E F 0 r D - - N 0 N

»^ C SORTING MfTH0O--olNAPYSORT

C RFFFPFNCF--CACM MAPCH 1PA9, PAG"" JRA f^INARY SORT ALGORITHM BY RIG

C C . S I MGI FTO^i , C _-CAC^* JA^UIAPY 1970, PAGE SM.

C. --CACM OCTOPFR 1970, ^AGF

C --JACMJA^UIARY|96^,PAGF^1.

G WRTTTFN RY JAMFS J, FILIIBEN, STATISTICAL ENGINEFRING LAPORATORY ( C NATIONAL RltPPAU op STANDARDS, * a

c; ^ I N G T O N , O.C. 7023M JUNE 19

C

DIMFNSION X(l),Y(J),XPOSf|)

DIMENSION IU(3A),lLriA)

IMPLICIT INTEGER (A-7)

38
c

C CHFrK'THr!\'F'nTARr,ijMrfjT<^FOPrppoPS

c

I PP = A IF(n,i T. I )GOTrmn

ir{n,rQ,i)GnTn«;^

HPLr> = x ( I )

6nC^^|TTNl^F

WP I TF: ( I PP , P ) HOL n 006 I I = 1 ,

N

Y ( I ) = X ( I ) XPOS ( I ) = T 6 1 continue:

R F T 1

1 p N =;0«PITF(IPP,1C,)

WP I TE ( I P" , M7 ) M

RETURN

SSWPITE(IPP,I«)

Y ( ! ) =X ( I ) X POS ( 1 ) = I , 0

RETURN

90 CONT I NOE

9 E0PMAT(1H ,I0«M«»««« NON-FA'^AL nTAr,NOSTir--THE EIRST INPUT AR6UME

INT (A VrCTOP) TO THE SOPTP SUnPOtjTINE HAS ALL ELEMENTS = ,El5.fl,6

1 H ••••)

\c, poPMAT(|H , 9tH««««» FATAL rppnP--THE SECOND INPUT ARGUMENT TO THE

1 SOOTP SDRPOUTINE IS N ON -POSITIVE •••••)

!R F0PMAT(1H ,inOH«»»»« NON-FaTAL '^TA';nOSTIC--THF SECOND INPUT ARGUME

\ UT TO THE SORTP SURPODTINE MA9 TH^^ V*LUE I •••••)

m EOP"AT(|M , 3SH«»«»» TMF VAMIE nF THE ARCUMFNT IS ,18 ,(SH »••••)

c

r COPY THE VECTOR X INTO TMF vEC^np y 0 O 1 0 O I s I , N

Y ( I ) aX ( I ) ino COhiTiNUE

CC DFFINE TMF XPnt; (POSITION) VECTOR, PFEOPE SORTING, THIS WILL

C RE A VECTOR^MOSE I-TME|FMFNT TSFQMAL TO I,

C no I S-^ I = I , N

X po-:; ( I ) = I I5OC0NTINUF

CC CHECK- TO SEE IF THE INPUT VECTOR IS ALPEADY SORTED

C MM 1 r »!- I 007001 = 1, fgHf

1 P ! = I I If^(Y(l).LE.YMPn)C,OTO?PO

G 0 T 0 7 S 0

7 0 0 C 0 M T I N 1 1

E

RETHPN

39
I = 1 J = M

Tin XT = I M I n = ( I

-t. ) ) / ?

' A M r o = Y ( M I n )

IF(Y(I).LF.AMrr))r,nT0'<7 0

Y ( M I n ) s Y ( I )

Y ( T ) = ft MF n

X P o ( I ) = P M F n

A MF 0 = V ( M I n ) B M F D = X P 0 S ( M I D ) 3 ?n L = J

IF(Y(j).rTF.«Mrn)r,OTn-^Mn

Y(MTn)=Y(j)

XPOS(Mir))=XPO«^(J)

Y ( J ) = AMrn

.XPOSJJ)=RMFn

AMFn= Y ( M I n

)

qMFn=XPOS(MIO)

ir(Yr F ) .I F.AMFD)^. nrniMn

Y ( M I n ) = Y ( I ) xpo^ ( M I n ) = xpns ( I ) Y ( I ) = A M F n AMFn=Y(Mjn)

B M F n = X P n S ( M T 0 )

3 in Y ( I ) = Y ( K ) X p o ( I . ) = X p n ( x'

) Y ( r ) =T T

X P n S ( K ) = I T T

3 M n L = L - I IF{Y(L ),r, T,AMFn)rTnTmMri

T T = Y ( L ) ITT = XPO<^(L)

r, Q K = K 1 IF(Y(K').LT,ftMFn)'',OTOit;n

IF(K.LF.l ) ("1010330

L M I = L - I JMK = J-K

I F ( L M I , t r . J M K ) r, 0 T n 3 6 n

I L ( M ) = I

I U ( M ) = L _

1 = K M = M+ I G 0 T 0 3 n n

3 ^ a I L ( ) =

J = L M = M 4- 1

r, 0 T 0 3 P 0

3 7 n M = M - 1 ir(M,FQ.O)RFTI)PM

I = I L ( M )
1 « n JM I = I- I

I F ( J M I , r, r . M ) r, n T n "5 1 o ir( I .FQ. I jCnTO^nfi

1 = 1-1

39n 1=1+1

IF(I,FQ.J)r,OTn-i7n

AMFOaY { 1 1)

RMFn = XPOS M M

lF(Y{i).LF.AMF-n)r,oTniPn

< = I Y(K*1)=Y(K)

XPOSfK*! )=XPOS(t<r)

K =1^ - 1 ircAMFO.LT.YfK-) )r,nTn3<?'^

Y ( k: I ) = AMEn

XPO«; ( K •» 1 ) =P Mf n GOTO 190
f ••«*»«••••••••«••«•••••••••••••••••••••••••••••

r • • r • THIS PPO^PAM SElFTTc; tmOSF f 0^ i«;mom (jctc; ar[^ , r e TO RF "-lAOF, D'^INf, O C I A L S F f U " I T Y mijMRFP • r » « C •«•• ••••»• ••«

c . c

c

r THF MAXIMUM ^Jt)MnER TO rt SFLFCTFD IS MSFL

cc

C ARPAYS APPF APING IM THF P P O G P A M

:

CC ss - snriAi srriiPiTY numpe" of fath pepson to bf selfctfd

r NEXT - ARPAY HSFO !M SOPTING SOCJal SFTURITY NUMBFPS.

C NFXTM) IS TMF TNOFX nr THF MFXT LARGEST SOCIAL SECURITY

C

'

. NDMrER fM SS AFTER SS(T». (MOTF NUMRFRS BFGINNING T

H

r THF I ETTEP A WILI APPEAR BEFORE fJUMERIC 0NF5.)

C- CAMO - ARRAY HSFn IN PFftOIMG THE FIIE. CAMD CONTAINS ALL NEEDED

C , INFOPMATtOM FOP EACH PERSON,

Cc««»««**«*««***«**««*«*«*******«**«**«*«**««««**«***«******«««*««*** *.* « * c PARAMETER MSEL =»inn

DIMENSION SS(MSEL,.l),NfVT(MSEL),CANn(73)

I MPL I C I T I NTEGFR ( A-7

)

C

r • •

C • READ SOCIAL SECURITY ^i•)MRERS OF THOSF TO RE SELECTFQ • C »

c N= !

1 RFAO ( , 9no , ENn= 7 ) STFMP , SS ( N , ' > , SS ( N , 3 ) 900 FORMAT ( I X , A I , ?A M ) 5S(N,!)=FLD(0,^,STEMP)

N = M-H ^ . i GO TO I 2 I N5FL = NI

C . ^- •-

c * •

'

C • IF INSFL IS ZFRO» SELFCT ALL TO HAVE Ll*^TS PRHJTED • C «

* Q »»»»»»•««••»•••••••••••••••••••••••••••••••••••••

c

cC NSFL COUNTS THE NttMRFR OF PEOPLF ACTitALL>^ SELECTED

C NSEL =0 , ; IE (INSEL.GT.O) GO TO M 3 RFAD (7,9n|,ENn=72) (rANn(j),Jsl,?3)

901 FORMAT ( A 1 , ? A** , I X , M A A , A ? , I X , ? A S , I X , A H , I X , A6 , ! X , 2 I S , 1 X , 9 A A ) i;vRiTE (9,901) (rArjn{j),jai,?3)

NSEL=MSFL*I.

GO TO 3 ^2
PAGE

NO(S)^s-^v

MISSING
I *,

1
GR 1 n

C • • r • TMI^ poo GRAM SOPy; THnsr orSIoi'JG CARPnOLS INTO GRID SOUARFS • r • •

TMF GRIf^ SOHARF'^ 'WIPTM D^Lt ftMO MTIGHT nFLY, THF LOWEP

IFFT rOPNF" OF TH^ WMOLP" GRID SYSTEM is (WIK'X.MINY). THFRE ARE NX

GPinS AfPOSS ANH NY GRIDS MP, mak-tng A TOT/IL OF NXY SQUARFS IN THE

MAIN r,PTn, Twn FPfNGF AP^aS ARt^ I^ri. unpn, MAKPjG a total of NXY2

5FCTI0NS IN ALL. THF MAXIMUM fjnMRTP qf FMPLOyEFS IN TMF LOCATOR

SYSTEM T S MCANH .

PAPAMFTFP nfi x=^n

PARAMFTFP f^EI Y = sn PARAMFTFR MjMXr-MOf^

PARAMETTR MiMY=-|nn

PARAMFTFP NX=Afl

PARAMfTTP MY=«7

PARAMFTFP MXY=NX»MY

PARAMETFR N)(Y7 = ^.'XY7

PAP4MFTFR MCAKin=|7nn

PAPAMFTfP FPT^|r, » = iMnnn

PAPAMFTFP Ff??MG7=»700n

r

r APPAYS APPFAPING T*^' TMF PROGRAM!

CC NAMF -THFFMPiOYFF'SNAMF

C EXT -THFFMPLOYFF*SMP5FXTFNSION

C OIV - THF fMPLQYFF'S MRS 01 VISION AND SECTION

C BLDG -NR*^ MAILING AODRES'^Ri'TLniNG

C RM - N«S MAILING AODRFS*^ POOm

C ADO(V - THf fMPinYFF'S MOMF snnRfSS

C SS - THF FMPLOYFF'S SOCIAL SFCHPITY NUMBER

C X - X-rf)OPDlNATF OF FMPLOYFF'S HOME ADDRESS

r Y - Y-COOPDINATF OF FM^'LOYFEtS HOMF ADDRESS

C GPI*^ - GRID SOI'ARF mijmrfr IN W'MICH THIS EMPLOYEE LIVES

r r^snPT _ FMPL^YFF r;R|n snuAf'F numrfps in sorted ORDER

C P'DX - INr^fX OF FMPLOYFFS IN SOPTFO OROER

C LASTSQ - THF PosITIO^| OF THf" LA*^T tmpiOYFE IN EACH GRID SQUARE.

C FMPLOYFFS LIVING I^' GPIO SOtlAPF N APPEAR IN THE SORTED

r LIST IN RFCOR'^S rA'^TS0(N-M*1 THROUGH LASTSQ(N).

C

• • ••••

C DIMFNSIOn NAMF(MCANO,s) ,FXT(MrA>Jn) ,niv(*^CAND) .RLDGCMCAND) ,

\ PM(MrAND),y(MrAN'^),Y(MCANn),GPID(MCAND),GSORT(MCAND),

2 TN0X(MCANn),L*ST«;Q(HVY2),ADnR(MCAND,*')|SS(MCAND,?)

IMPIICIT INTFGFR rA-7)

45
r • • . C • PFAO TMPL nvFE*^ nrsiPirjr, tappools and • c»coMPUTrr,Pinsfvii(APrFOPEArH • c • • cc N=l '

1 RFAO (7,9nO,E:Nn=?) (SSrM,I),I = I,7),(MAME<N,I),l = !,5),nLDri(N),RM(N)

I ,rxT(M),r)lV(N),X(N),Y(N),(AnnP(N,I),I = 1,9)

900 rORVAT (AA,Al,|y,MAA,A2,IX,?A';,M,AM,IX,A6,lX.2IS,lX,OA6)

C ' _ , c*»*«*«***««»«*«**»« «•«•••• •••••••••*•••• « c

C I NPiJT/OiiTPDT FIIE "^OPMAT (! PFTOPn PFR FmployEE)

C

C COL*^ . , rONTFMTS '

c \

- c 1 9 «;0C I AL SFfKR ITY *MIMO F P

"

c 1 i 16 FMPl 0 YFE • N A HE

c 18 M7 NB^ M A I 1 ! N'G A nnpF ss P 1 1 I L n I M Ft c M 3 M 7 W B S M A I L I M fi AnOKESS

c M9 NPS F X TENS I 0 M

c M R «=; n I V ! S I 0 AND «^FC T I ON

c 6 1 6B X-CnnpDif^ATE OF MOMF A DDPFSS

c 66 7P v-rnOPOINATF OF MOMF A DHPF*;*;

c 72 1 7S HOME AOnpFSS

GPin(N)=((X(N)-MINX)/DELX)«MY*(Y(N)-MlNY)/DELY*l

IF (X(N).FQ.FPTMGI) '-nPIOfMjrMXY+l

IF r y ( N ) . E 0 . EP I Nr, ? ) r,p i n ( n ) =n x y ? r€•»•*••*••••• «••••••••••••• ••••••• ••*••

c

C If^ THE rALCniATFn r,Pin NiiMOrp !«; TOO lAPr,r PRINT OUT THE EMPLOYEE DATA

C

c IF (GRIO(M>.LE.MXY?) GO TO

WPITE (6,99r») ( *^ ( M , ) , = I , 7 ) , ( N A M E ( N , K ) , K = 1 , S ) , BL D G ( N ) , RM ( N ) ,

I EXT(N),DIV(N),X(M),Y(N),(ADnP(M,<),r=I,9),GRID(N)

990 FORMAT (IX,A(S,A1,!X,MA6,A?,1X,7AC,,|X,AM,|X,A6,1X,2IS,IX,9A6,

1 I M ) 5 N = N + I GO TO I , ? NC ANOsN1

«P I TF ( 6 99 I ) 9 9 1 E 0 P M i T < • I • )

46
c • • C • SORT rMpLOYFF«: RY GRfO SQUARF NOMRFP • C« • C •••••••*••••••••*•••••••••••••*••••••••«

c C*LL snPTp ( r,R I n , Nc Awn , GSOPT , I Nn X ) r

r •«••••«••••••*•••••• ••^••••••••••••••••••••••••••••••*««*»»««*»*«««*««

r • • r • COMPUTF GRID INrVFX wijMqFRS ANO "^PITF OUT FMPLOYEES IN SORTFO ORDER • C • r ••••«***•••••««•••••••««•••••*••••••••••••••••••••«•••«•••••••••••••••

c j= I B A C K aO

0OMI=I,MXY2

LA<^TSQ ( I ) =RACK

3 IF (GSOPT(J),GT.l) GO TO q LA5TSQ ( I ) =L ASTSO f I ) I L=IMny(J)

WPITF (fl,90n) (S5(L,*:),K'»I,7),(WAMF(L,K),K = I,S),RLDG(L),''M(L),

I FXT(L),DIV(L),X(l),Y(L),(AnnR(l. ,r),re|,9)

C *PITF (A, 990) (SS(L ) ,7) , {MAMF(L,tf) ,K=1 ,S) ,BLDG(L) ,PM(L) ,

I FXT(L),DIV(L),X(L),Y(L»,(Ano''(l,K),tf.1,9),GSORT(J)

J = J*»

I F ( J , L F , M ) f, O T O 1 J*J-I

GSORT ( J ) =990999

M BAr<«L ASTSO ( I ) C

c ••*••••••* ••••• •••••• •••••*•*••«•••«••«

c •

r • W9ITF OUT POSITION OF LAST PERSON IN FACM GRID SQUARE • C •

•

c ••••

c WRITF (9,907) (LA«;TSO(M,|«|,NrY?)

QO? FORMAT (?016)

WPITF (A, 903) NCAMO.l AST<;0(MXY7)

903 FORMAT (« 6PI0 SnpT f 0 M P l F T «^ •

, I 6 , • F«PLOYEES IN»,I6,» EMPLOYEES OU

I T • ) STOP

END

47
c «•*•••••«••••*••••«•••••«•••••••••••••••••«•*•

c • • r » THIS PROGRAM PRINTS LISTS OF fA«»POOL CAMDIOATES •

C • • C *«••**• *•*«*••**•••• ••*•••••••••••• • c PARAMFTFR npLXssn

PARAMFTFR PEL Y = sn

P ARAMFTFR N X = 6 n PARAMFTFR M y a fl ? PARAMFTFR N X Y X W X • "lY PARAMFTFP M X Y ? = N XY + 7

PARAMFTFR M 1 NX=-

PARAMFTFR M I NY=- 1 on

PARAMFTFR MAX X=M lNX + NX«rtFLX

PARAMFTFR MAX YsM I NY+NY«nFL

Y

PARAMFTFR MC ANDe 1 ?nn

PARAMFTFR M I LFSQ «7snn ^ PARAMFTFR MNF AR=

PARAMFTFR MPR I NT • 70

PARAMFTFR F R I M r,

1 = 1 Mono

PARAMFTFR F R I M n 7 « 1 7000

c

c

C TMOSF DFSIRING TaRPOOLS ART SORTED TNTO GRID SQUARES OF *IDTH AND

C HEIGHT DFLX A ^^ D DTLY R F S p F C T I V E I Y . THERE ARE NX SQUARES ACROSS

C AND NY SQUARES UP. THE LOWER LEFT CORNER IS (MINX.MINY), THE

C TOTAL NUMBER OF GRID SQUARES IS NXV7, 7 MORE THAN NXY TO INCLUDE THE

C TWO FRINGE AREAS WITH COOoniNATFS ( F R I N G I , F R I N G I ) AND ( F R I N G 7 , F R I N G 2 ) • r MILESQ IS A CONVERSION FACTOR EQUAL TO

C THE SQUARE OF THE SMALLFP PAOIUS FOP THE ALLOWABLE DISTANCE IN THE

C UNITS OF THF COOROINATF SYSTEM, (HERE I UNIT IS 100 FEET, AND THE

r SMALLER RADIUS IS SOOO FEET, OR AROUT I MTLE.) THE NUMBER OF PEOPLE

C IN THF FILE IS AT MOST MCANO, THF MAXIMUM EXPECTED TO BE*CLOSE ENOUGH

C TO ONE PERSON IS MNEAP, AND THF numrfR IN THE LIST PROVIDED IS MPRINT

Cc *•••••••••••••••••••••••••••••»•••••••••••••••••••••••••••••••••••*••••

c DIMENSION L ASTSQ ( NX Y 7 ) ,C ANO ( MC A ND , R ) , NE AR ( MNE AR , 7 I , D ( MNFAR ) ,

1 D I ST { MMF A" ) , I NO X ( HUE A» » , L^OR ( P

)

IMPLTCITINTEGER(A-7)

48
cC ARRAYS APPF:*''INr, ]H THF PRO'^PAM?

C LASTSO - FNTRY POINTS IN TH^ LIST OF fARPOOL CAN0I0ATF5 FQR EACH

C GRID SOilARF, L A S T S *^ ( N ) IS THF LAST ENTRY FOR GRID SQUARE

C M. THFRFFORF FNTRIFS FOR GRID SQUARE N GO FROM

C LASTSO(N-|)*| TO AND INCLUHING LASTSQ(N),

Q CAMO - THF LIST OF ALL THOSE WISHING CARPQOLS, SORTED INTO GRIDS

C CAWO(I,n - CANri(i,S) IS THF PFRSON'S NAME

C CA^JD(T,4.) IS THF DIVISION A NO SECTION

f CANDM,?) IS THF NPS PHONE EXTENSION

C CAND(T,f<) AND CAND(I,<») APF THF X AND Y COORDINATES

C NEAR - THF PEOPLE LIVING CLOSF FMOUGH TO THE CURRENT PERSON

C DIST - THE OISTAMCE FROM THF CMRRFNT PERSON OF EACH OF THOSE

C OTHfRS STORED IN NEAR CO - THF SORTED HIST ARRAY

C INDX - THE INDICES OF FMTRIES IN NEAP SORTED PY DISTANCE

C LEOR - THE INFORMATION ABHMT THE CURRENT PERSON DESIRING A LIST

C LEOP(|)-LFOR(S) ISTHEPFPSON»SNAME

C LEOR((<,) - LE0R(7) IS THE NPS MAILING ADDRESS

C LEOR(R) TS THF NBS PHONE FITTENSION

C

• • ••••

CC

cc •••• •••• •••••••••••••••••••••••••••••••••

c • • C REAP THOSE DESIRING CARPOOLS, SORTED INTO GRIDS • C • r ••«••••*•••••••««•••«•••••••*••• •••••

c N=I

7C0 RFAO (T.POl.ENns?^!) (CAND(N,I),I = l,c,>,CAND(N,7),CAND{N,6),

I C A NO ( N , fl I , C A MO ( N , 9

)

90 3 FORMAT (I0X,MAA,A?,I7X,A«4,|¥,AA,»X,?IS)

C

c*«««*«**«««« •••«••«•••••••«•••••••••«•*»••••••••••*••«

cC CARPOOL CANOIDATF FILE FORMAT FOR EACH EMPLOYEE

C

C COLS. CONTENTS

C

C 1 9 SOCIAL SFflJRITY MUMPER

c 1

1

^6 EMPLOYEE NAMF

c 38 NBS RHILOING FOK MAILING ADDRESS

c «43 M7 MBS ROOM FOR MAIIIMG ADDRESS

c S? NBS PHONE EXTENSION

c SM S9 NBS niviSION AND SECTION

c 6? AS X_r00RDINATE OF HOMF ADDRESS

c 66 7? Y-COORDINATE OF HOMF*ADDPESS

c 72 1 ?S HOMF ADDRESS

cc**» •••••

c NeN* 1 GO TO ?00

?0I NCAND«N-I

49
r • ' •

r • • C •

rpo") RTA-^ (<^,9nn) (LA^Tsn(r),iai,MxY7)

c

'

r ••«••••«•*«•••••••••••*••«•••••••••••••

r • • r « PFAn PfrpsoM nrSIfPlG A CAPPOOI I'^^T • r • *

r ••#*«•••••••••**••«*•••*«*•••••••**••••

r

\ RFAH (q,pn|,F^J^'='|^n) (irnpjTj.iri.pj.fjf.iY

9^! FORMAT (!nx,MAA,A?,ty,7AC,,6y,AA,tX,?I«">)

Cr«**»«*«**«*«**«*«*««*«****«*«»«* •«••••• ••••••*••«••••««***•

r

r IMPDT rno TMOSF ^Fc;I''I^^^, LI«^T^ ?S «;i"Il*P TO THE CARPOOL CANHIDATES

C OMIY FMPLOYTF MAHF, MRS MAIIIMG AO^^fFSS, Mr»S DIVISION AND SFTTION, AND

r X ANn Y rOOPOlNATFS APF AfTIUlL^' PFAO AM^ HSFO.

r(-«*•••••*•«••«•••«••«••••«•••••««••••••••••••••««•••••••«•*••••««*••••«•

c IF ( ( IX,r,F.»^INX,ANn.TX.LF.MAXX).OP,IX,FQ,FRirjGI.0R.IX,E0.FRIN(j2)

I GO TO -^0 GO T n I ^O IF ((IY.GF.MIMY.AN0.IY,|F,MAYX),0P,IY,FQ,FRIMGI.nK.IY,FQ,FRlNG2)

! G 0 TO I GO TO 1

50
r • •

C • rnMPuTT LO-^/FP iFFT GPin A NO ^il)MR^I» of • C * npin"^ TO t^F ^l'^Fn fop this pfk^^om'^; li«:t • C • • c **•••••«•••««•••«••*«•*••••• ••••

C -

'

c

r

r <L IS IMF LOWFR Lf^fT r^Pin to R£ INniinFO FOR THIS PFPSON

r FNOX AN)n F-'JOY At'F THF MUMRFP OF GPIOS TO HF iNCLUDEn ACROSS AND UP

C FOP THIS PFPSOri. MAXP IS THF OAOfuS FOP THIS PERSON'S CARPOQL.

C SFVFPAL FLAT, VAPIA«IF<; APF ')<;fo IN CALHLATINf- THESE - FLARL, FLACjR,

C FLAGR, FL*GT ARF c;FT ir THF Pfrk<:,nu nrsTPlNT, A LIST LIVES IN A GRID

C SQIJAPF AT THF L^FT SIOF, Pir,HT e;ir)«", flOTTOM, OK TOP OF THF WHOLE

C r-iQin, FLAr,^| I«; SFT if TH^ PFW^ON I ?VFS IM a PWF-SFT HIGH OFNSITY

r ARfA (FOP THIS CA«;f Afj APFA IN f, AITHERSPKPr, NEAR N8S).

Cr««**«»*«««»«*«««««*«***««««»««*»»*««««.«««****«« ••«•••*»«*««•

r

3 1 J= I IFrix.L'T.FR'iMr, Mr, OTOM

F ^'0 » = I E N n Y - I K I = M X Y I IF (IX,FQ,F«IMr, 7) ifLsNxY?

KlTFMPsk-L

GO TO 7

M F L A G I X t F L A G fl = 1 F L A G R = O

F L A G T a O

Fl A GN = 0

KL=^'Y( ( I X-»'INX ) / OFL X )( TY-'>'IMY) / DFLY*I

KL TFMp-x-l

IF (MOnftCLTrMP.MYJ.FQ.M GO TO «; F L A G R » a KL =t^L- 1 S IF(M00(»^|TrMP,MY).FQ.':^)FLAGT=1

I F ( tC I T F M p , I .

f

, Y ) f, 0 T n FLAGL=0

K L = L - M Y

f> IF (KLTFMp.rr.CMXY-NY)) FLA^^Prl

IF (APS(lX-IOSO),LF.!no.AMD.AR«^MY-|#»'^0),LE.lOO» GO TO 61

E M D X = S

IF (^JXY-K'L.LT.^•NY) FM0Xa(NXY-»<l)/NY*1

EMO Y = S

IF (NY-MOn(ti'L,MY),LT.M) FNUYx^V-MOOf*'! ,NY) + l F L A G M = ! GO TO 7 A I E M n X = 3 IF (iclTFMp.r, T.MXY-NY) EMOXs-'

EMnY=3

IF <M0O(K'LTF"P,NY),FQ.'-») FNOYa?

F L A G K) = 0

7 MAXPaMiLFSR«(FLAr; 'J

51
r • • r • FxAMiMT APPRO p'RIATr r, Pio «;onAPr«; - • C • STQRf ALL WITH I M MAXR OF TMI5 PPPS^KJ IM MfAR •

c «•*•«•••**•••••«•••••**«»•«*•••«•••••«•••••«••••

r

ory in I = 1 , FNOX

IPF''i=LASTSQ(Kl - ! )!

ir(tfL.F"0.i)lPFr,= i

I rMn = L AST50 ( Kl. -t-FMHYM

IF" (IFMO.LT.iRFf, ) r, n m fn

on p I I = I R F r, , I F M

n

9 3 nTFM=(CAND(II,«)-!X)««7*(rAMn(!I,9)-IY)«»2

IF (OTFM,GT.MAXR> r,0 TO 0

D0QMW=I,7 '

9 * N F A P ( J , A) ) = C « N 0 ( I I , ^ ) 0 I S T ( J ) = n T F J = J* I _

9 C f^M T ? MUF ;

1 ^ K L = t< L N Y

'

' NMF AR = j- ! ;

; ; NPR I M T =MME A C

C ««•••«**••»*« • • r • • f«WPITr|I«:;TFORTHl«:PFRSriM«

C • • .

C

.VP?TF (/S,90'^) ( L Fnp ( I ) , 1 = 1 , r

) , L F OP ( 9 ) , I F OR ( I 0 ) , LFOR ( & ) , L'^OR ( 7 ) 90*4 FORMAT («|«***«*««**«**«*****««********«* /• ••,?8X,»»«/* • '.HAS,

F A7,» •»/• ••,7flX,»«»/» • 01 V, •,?A"<,t^X,««»/« ••,2flX,»«»/« •

• F , A , I X , A c,

, 1 c, X ,

• « • / • «»,7RX,»»»/« •••••••••»••••••••••*•••••••

///////

?• RFSPON'^F TO YOIJP RFOUF«;T FPOM THF TRANSPORTATION SUPVEY,*/

3« RFLOW IS A LIST OF MRS FMPLQYFFS KMHO LIVE NEAR YOU AND ARE'/

M» niTFRFSTTO IM rAPPOOLU"",, tmjs ImFOPHATION INCLUDE*? DATA*/

S» FPOM THF PF»'S0^)^1FI LnrATQP Fllf *MirH CONTAINS PFRSONNFL WHO'/

/,» PFQUFSTFO THAT THFIP HOHF AOHPFSS MOT PE PUBLICIZFO. ALSO IT*/

7* HAS COMF TO OI)P ATTFMTION THAT PFPSnMNFL HAVE MOVED RUT HAVE*/

R» MOT MOTIFIEH THF MAIL SFCTJOM OP PFPSONNEL DIVISION OF THE*/

9* CHAMr,F, rON<;FQ|jrMTL Y THE^'F »* T L L RF PFf?SONNEL *H0 RFQUFSTED*/

A* LISTS RUT ^'?LI NOT PFCFIvF THTM OR WILL NOT RF LOCATED*/

R»CORRFCTLY.»////

CI|X,'NAMF«,t9X,»'^iy.',3f,*El'T.»//)

IF (MNFAP.L'^.MPPINT.OP.lX.Gr.FPIMGI) CO TO !8

52
c

r '=,097 TMOSF WITHT^/ THF ArCFPTAPLT RADIUS, IF THERE ARE MOPE THAN MPRINT

r OF THEM

Cc****«»»«»*«*«««»**«*««***«««*«* •••*••••••«•••»•«»•*•*••«•«•••«•««

c CAIL SORTP(niST,NNEAR,D,IMDX)

j = n IF (r)(|).NE.O(MPPlNT*l)) GO TO l"^ C

c ••«••*•«•«« •••••• •••••••«••••• «••**••••*•««•«••

c

C ir MORE THAN MPPINT OF THOST 1^ I T H I N AN ACCEPTABLE RADIUS ARE AT THE

C SAME PLACF, PICK A SUBSET OF SI7E MPRINT IN SUCH A WAY TO ENSURE THAT

C DIFFERENT PFOPLF GET niFFFRFNT LISTS

C

C

00 1? Ilal.MNEAR

I = I NOX ( I I ) DO 1 1 J Ja 1 , S

IF (NFAR(I,JJ).NE.LFOR(JJ)) GO TO 1 2

1

1

CONT I NUF

GO TO 1 M

1 2 CONT I NUF

WPITF (A, 990) ( LFOP ( JJ ) , J J= 1 , S

)

990 EORMAT(»0»»» ERROR ••• *

^ ^ A f> ^ ? X , • NOT FOUND IN E I LE • ) NPRINT«MPRIMT

GO TO IR

IF ( n ( I I 1 ) .ME .n ( I ! ) ) GO TO IS

J = J* )

I T = ! I 1

I = 1 NOX ( I I ) WRITE ( A ,920 ) ( NF AR ( I ,LL ) ,LL» 1 7 ) 9?0 FORMAT ( SX , MAA , A 2 , 2X , A6 , 2X , AM

)

IF ( J.LT .MPR I NT ) GO TO \^

\ S NPRI^!T«MPRIMT-J

IF ( MPRINT-I ) 1 , 20, 1 A

1 6 DO 17 I » 1 , NPR I NT

I I = I MDX ( I )

1 7 WRITE (6,920) ( NF AR ( I I ,Ll ) ,1 L «

1

.7)

GO TO 1 C

c

C IF FEWER THAN MPRINT A^E WITHIN AN ACCEPTARLF RADIUS OR IF THE PERSON

C LIVES IM A FRINGE ARFA, INCLUDE ALL

r IN LIST

c

!fl DO ! 9 I « 1 , NPR I NT

19 WRITE (6,920) (NFAR( I ,LL) ,LL«I , GOTO 1 20 WRITE (6,921

)

921 FORMAT (• NO EMPLOYEE DESIRING A CARPOOL LIVES WITHIN 2 MILES OF Y

I OU. • ) GOTO I

1 00 STOP

END

3^
APPENDIX B

Sample Runs t reams

The programs described in Section IV are in file CARPOOL*PROGRAMFILE

in symbolic, relocatable and absolute forms, so that they may be executed

directly from the absolute elements in this file. Six data files are referenced in the runstreams in Figure B.l:

LOCATOR - the updated locator file on tape

CANDIDATE - the carpool candidate file

GETLISTS - the file of those to receive lists

SORTEDCAND - the file of carpool candidates sorted into grid

squares

GRIDTNDEX - the grid index list file

LISTS - the breakpointed output tape containing lists to

be printed off-line.

The programs would normally be run in the sequence shown, so that each

time a file is first referenced it is a3signed as a new file to be

catalogued as publicly accessible (option UP on the ASG card). I"

subsequent runs, it must be referenced as already catalogued (option A

on the ASG card). All programs for these runs are stored in the file

PROGRAKFILE with qualifier CARPOOL.

54
Example

Figure B.

1

Runstreams for Obtaining Carpool Lists

To Run Program EXTRACT:

(aRUN,N/R POOL01,99999-POOLEX, CARPOOL, 5, 50

@ASG,TJ LOCATOR. ,8C, 99 99

@ASG,UP CANDIDATE.

(aUSE B., LOCATOR.

@USE 7. , CANDIDATE.

@ASG,A PROGRAMFILE.

(aXQT PROGRAMFILE. EXTRACT

@FIN

To run program SELECT:

{aRUN,N/R POOL02,99999-POOLEX, CARPOOL, 5, 50

@ASG,A CANDIDATE.

(3ASG,UP GETLISTS.

@USE 7. .CANDIDATE.

@USE 8., GETLISTS.

(SASG.A PROGRAMFILE.

@XQT PROGRAMFILE. SELECT

[Data cards containing Social Security numbers to be selected]

(aEOF

@FIN

To run program GRID:

(3RUN,N/R POOL03,99999-POOLEX, CARPOOL, 5, 50

(aASG,A CANDIDATE.

@AGG,UP GRIDINDEX.

@ASG,UP SORTEDCAND.

@USE 7. , CANDIDATE.

@USE 8. , SORTEDCAND.

{3USE 9. , GRIDINDEX.

(aASG.A PROGRAMFILE.

(3XQT PROGRAMFILE. GRID

@FIN

55
To run program POOLIST:

T'lRUN , N/ R POOL04 , 99999-POOLEX , CARPOOL , 5 , 2000

(lASG.TJ LISTS. ,8C,0000W

@ASG,A GETLISTS.

0ASG,A SORTEDCAND.

@ASG,A GRIDINDEX.

(auSE 7. , SORTEDCAND.

@USE 8. , GRIDINDEX.

(aASG,A PROGRAMFILE.

@BRKPT PRINTS/LISTS . @XQT PROGRAMFILE. POOLI ST , (SADD GETLISTS. ' c

' (3E0F / : (SBRKPT PRINTS

(apiN

Ask to have Breakpolnted reel number 0000 printed on 8 1/2 X 11

white paper.

56
APPENDIX C

Locating Coordinates by Interpolation: An Example

We wish to obtain coordinates for the point shown below in a section

of the maps having the displayed coordinates in the margin. (It should

be noted that the vertical lines are one inch apart which equals 20

coordinate units, and the horizontal lines are only 19/20 of an inch

apart or 19 coordinate units.) The position of the point is 5/8 inch

from the bottom of its square and 7/16 inch from the left edge.

Interpolating using 20 units per inch yields an x-coordinate of

[5/8 inch • 20 units per inch] + 680 units = 693

and a y-coordinate of

[7/16 inch • 20 units per inch] + 421 units = 430.

459

440

421

402

s

1

1

5 / " /8

660 680 700 720

57
APPENDIX D

Staff Transportation Survey Questionnaire

58
STAFF TRANSPORTATION SURVEY

The NBS Energy Task Force is seeking to assist employees with transportation problems

and to reduce fuel consumption in travel to and from work. Carpooling is being encouraged;

improved bus and train service are being sought. The accompanying questionnaire was

designed to obtain the information that is needed to enable the Transportation Task Group

to determine the feasibility of public transportation and to plan possible routes of travel.

Your cooperation is requested in filling out this questionnaire and returning it to your

Division Administrative Office by January 9, 1974 . Thank you,

J. D. Hoffman, Chairman

NBS Energy Task Force

Enter Social Security No. (will be used as a key field

identifier for survey control piorposes; will not be

printed in conjunction with name for distributicr.)

1. How do you get to work now? (circle appropriate letter at right) A C W M O

A = drive alone; C = carpool; W = walk; M = netrobus; O = other

If Other, describe

CARPOOLING (circle Y = Yes; N = No on right)

2. Please send me a list of up to 20 NBS employees who live nearest me.

I understand that my name , address and work phone number will be

sent to NBS employees who live near me.

3. Has your home address changed in the past 10 months?

4. Are you willing to take turns in carpool driving?

5. Are you interested in riding only? . ,

6. Would you consider driving only and picking -p riders?

BUS SERVICE Buses may be chartered to provide express service

between NBS and central pick-up points in the meiiropolitan area

(up to 40 miles away)

7. Circle the appropriate letter: A B C

A = am not interested in bus service

B = may use bus if it becomes available

C = will definitely use bus if it is at all convenient

8. Maximum distance I would travel to a bus pic>-up point is: A B C D

A = walking distance only

B = longer distance, if safe parking is provided

C = longer distance, need no parking

D = can't answer now

9. Maximum daily round trip bus fare I would pay is: 1 2 3 4 5 X

1 = $1.00 3 = $3.00 5 = $5.00

2 = $2.00 4 = $4.00 X - can't answer now

Y

Y

Y

Y

Y

N

N

N

N

N

59
TRAIN SERVICE There is a commuter line from Martinsburg, West Virginia, to Washington D.C.

This line has stops at Brunswick, Point of Rocks, Dickerson, Barnesville, Buck Lodge, Boyds,

Germantown and Gaithersburg , Maryland. The monthly fare from Brunswick to Gaithersburg is

$37.50. Assuming adequate transportation between Gaithersburg and NBS (for example, shuttle

service), answer the following: (Y = Yes; N = No)

10. If service were improved (for example, better schedules) , would you use

the existing commuter line? Y N

11. If service becomes available from the other direction,, that is, from

D.C. to Gaithersburg with stops in-between — would you be interested

in using it? Y N

OTHER Answers, comments, or suggestions in the appropriate sections below, will be welcomed

12. Please suggest convenient bus pick-up points in your area with adequate parking, for

example, a large shopping center. Name each point (shopping center), nearest town,

and road intersection, sufficient to fully identify its location.

13. What are the principal reasons you have, or would have, to join a car pool?

14. What obstacles keep you, or would keep you, from joining a car pool?

15. Please write in any suggestions or comments you may have on staff transportation to

and from work. (Attach additional sheets if necessary)

USC0MM-N8S-DC 60
NBS-114A (REV 7-73)

U.S. DEPT. OF COMM

BIBLIOGRAPHIC DATA

SHEET

1. IM IM.If \ 1 ION ( )K KI!I'()R I N(>. NBSIR 74-6332, Ci(.)v*t Accfssion

No.

3. Recipient's Accession No.

4. i iTi.i-; AND sunn 11.

1

The NBS Comouterized Carnool Mutrhi-no <^^7c^<anl • Tloo-rca ' r^tiA^

5. Publication Date December 197"^

6. Performing Organization Code

7. AUTHOR(S)

Judith F. Gilsinn and Sii.q;in I.^nH^n

8. Performing Organ. Report No.

9. PERFORMINCi ORdAN l/.A I NAMi: AND ADDRKSS

NATIONAL BUREAU OF STANDARDS

DEPARTMENT OF COMMERCE

WASHINGTON, D.C. 20234

10. Project/Task/Work Unit No. 2050151

11. C ontract /Grant No.

1/. Sponsoring ( )rf;an izat lun Name .uui < i.niplitc AJdrcss (Strei-t. City. State, ZIP)

Same as No, 9

13. Type of Report & Period

( overed Final

14. Sponsoring Agency Code

15. SUPPI.KMI-NTAKY NOIhS

16. Alt^IRAf I (A 200-word or less (actual summary ol most sif^fiidcant information. If document includes a significant

bibliography or literature survey, mention it here.)

This report documents the NBS computerized carpool matching programs and

the procedures used in maintaining the coordinate data base required by

the matching system. The report includes flowcharts, input/output formats,

and program listings for the programs, plus details of the manual process

for coordinate coding. The matching program produces, for each person

desiring it, a list of others residing within a pre-specif led distance

of him, and is thus applicable to a single work destination having primarily

one work schedule. The system is currently operational on the National

Bureau of Standards' UNIVAC 1108 computer and was run in March of 1974

producing lists for about 950 employees in less than four minutes computer

time. Subsequent maintenance of the system will be carried out by the

NBS Management and Organization Division.

17. KEY WORDS (six to twelve entries; alphabetical order, capitalize only the first letter of the first key word unless a proper name; separated by semicolons

)

Carpools; carpool matching; computer programs; transportation; urban transportation,

18. AVAILABILITY ( X' Unlimited

[

' For Official Distribution. Do Not Release to N TIS

1 J Carder f- rom Sup. of Doc., U.S. dovernment Printing Office Washington, D.C. 20U)2, SD Cat. No. (1 ^ Order l-'rom N.itional Technical Information Service (N TIS) Springfield, Virginia 22151

19. SHCURITY CLASS

(THIS RLPORT)

UN( L ASSIFIED

21. NO. OF PAGES

65

20. SF< URH Y f LASS

(THIS PAGE)

UNf LASSIITED

22. Price

$4.25

USCOMM-DC 29042-P74
)

!

I