geofile: an interactive program in basic for creating and editing data files

37
Compulers& Geosciences Vol. $, No. 3..4, pp. 285--321. I~2 00~.-3eO~7.)030285-37503.W/0 Printed in Great Britain. © I~2 ~ Prims Ltd. GEOFILE: AN INTERACTIVE PROGRAM IN BASIC FOR CREATING AND EDITING DATA FILES A. D. M. BURWELL and C. G. TOPLEY Department of Geologyand Physical Sciences, Oxford Polytechnic,Headington,Oxford, OX30BP (Recei~d 25 November 1981) Abarsct-.GEOHLE is a versatile, interactive program in BASIC for the creation and editing of data files. These files consist of a two-dimensional array of numerical values, rows corresponding to different parameters, and columns to different samples. In addition to numerical values, the files also contain strings corresponding to sample numbers, sample labels, and parameter symbols.Rapid and successful file creation is assisted by the large number of error-trsps in the program and comprehensivefile editing is accomplishedpartly through a simple routine which uses an alphanumeric grid to identify data items. Files created and/or edited may be stored on disk for subsequent use in a variety of other programs such as graph plotting or statistical analysis. Key Words: File creation, F'de editing, Interactive. INTRODUCTION GEOFILE is a versatile program, written in BASIC, which allows both creation and editing of data files. The files produced may be used as data sources for a wide variety of purposes, for instance, in graph plotting, sta- tistical analysis, normative mineral calculation, general- ized mixing models, etc. The structure and use of GEO- FILE are described later. In two future papers, we will describe programs, which use data files created by GEOFILE, for plotting graphs and ternary compositional diagrams." PROGRAM I]~q.IDdI~TATION The system requirements for running the program are: (i) a computer with at least 64 Kbytes of RAM and one disk drive; (ii) a VDU (preferably with 24 lines × 72 columns format); (ili) a printer. GEOFILE has been written in BASIC using, as much as possible, standard BASIC as defined by ANSI (1978) and ECMA (1978). This should ensure that the program can be implemented with little or no modification. However, it should be noted that string-handling func- tions are essential to program implementation. Details of string-handling functions and other departures from standard BASIC are given in Appendix 3.1. A number of steps have been taken, in writing the program, to ensure that GEOFILE can be adapted to the requirements of different systems and different users (see Appendix 3.5 and 6). For example: (a) only two program lines need to be altered to provide properly formatted output for a variety of printers with different character spacings and lines per form; (b) as the program was written originally for the creation of geochemical data files, the two prompts "OXIDE/ELEMENT" SYMBOL and "CONCENTRATION" VALUE occur frequently during file creation. For other uses these may be altered to more suitable prompts simply by altering two program lines. DATA FILE CO~ The main body of data in the files created by GEO- FILE can be thought of as occupying a two-dimensional "array". Each row of this "array" contains data values associated with the particular parameter for that row (for example, length, density, SiO2 weight %) and each column contains data values for the particular sample associated with that column. A typical "array" of data is illustrated in Table 1. In addition to the main data values, the file also contains: the parameter-symbols' associated with each row (for example, SiO2, A1203, Fe203 ..... ); sample numbers (for example, SKI, SKI9, SK33 ..... ), sample labels (for example, L,M, U .... ), paired label- sample types (for example, L= Skaerganrd Layered Series). The parameter symbols and sample numbers are self explanatory. Sample labels are used to discriminate between sample types, for example on graphical plots of the data. Each sample on the file is given a label which consists of a single alphanumeric character chosen to identify some particular atm'bute of the sample. Thus, for example, all basalt samples on a file might be labelled "B', all granites "G". The paired label-sample type data on the file simply ree.ord all different labels declared on the file and their corresponding sample types (for exam- pie, B: basalt; G: granite). I~'TAII,S OF TIlE PltOGIIAM Use of the program will be described in terms of file creation, file printing, and the editing and saving of files. File creation The first main block of GEOFILE is concerned with generating a data file in the computer's memory. The file may be generated in memory either by creating a new file via the keyboard or by reading in an existing file from disk. Keyboard creation of a new file involves three stases: (i) input of a list of parameter symbols (SiO2, Al203, Fe203 .... ); (ii) input of sample numbers, data values for the parameters declared, sample labels (this stage is executed sample by sample); Cdi) specification of sample types corresponding to labels declared. A specimen file creating session is shown in Figure 1. 285

Upload: adm-burwell

Post on 25-Aug-2016

224 views

Category:

Documents


10 download

TRANSCRIPT

Page 1: GEOFILE: an interactive program in basic for creating and editing data files

Compulers & Geosciences Vol. $, No. 3..4, pp. 285--321. I~2 00~.-3eO~7.)030285-37503.W/0 Printed in Great Britain. © I~2 ~ Prims Ltd.

GEOFILE: AN INTERACTIVE PROGRAM IN BASIC FOR CREATING AND EDITING DATA FILES

A. D. M. BURWELL and C. G. TOPLEY Department of Geology and Physical Sciences, Oxford Polytechnic, Headington, Oxford, OX30BP

(Recei~d 25 November 1981)

Abarsct-.GEOHLE is a versatile, interactive program in BASIC for the creation and editing of data files. These files consist of a two-dimensional array of numerical values, rows corresponding to different parameters, and columns to different samples. In addition to numerical values, the files also contain strings corresponding to sample numbers, sample labels, and parameter symbols. Rapid and successful file creation is assisted by the large number of error-trsps in the program and comprehensive file editing is accomplished partly through a simple routine which uses an alphanumeric grid to identify data items. Files created and/or edited may be stored on disk for subsequent use in a variety of other programs such as graph plotting or statistical analysis.

Key Words: File creation, F'de editing, Interactive.

INTRODUCTION GEOFILE is a versatile program, written in BASIC, which allows both creation and editing of data files. The files produced may be used as data sources for a wide variety of purposes, for instance, in graph plotting, sta- tistical analysis, normative mineral calculation, general- ized mixing models, etc. The structure and use of GEO- FILE are described later. In two future papers, we will describe programs, which use data files created by GEOFILE, for plotting graphs and ternary compositional diagrams."

PROGRAM I]~q.IDdI~TATION

The system requirements for running the program are: (i) a computer with at least 64 Kbytes of RAM and one disk drive; (ii) a VDU (preferably with 24 lines × 72 columns format); (ili) a printer.

GEOFILE has been written in BASIC using, as much as possible, standard BASIC as defined by ANSI (1978) and ECMA (1978). This should ensure that the program can be implemented with little or no modification. However, it should be noted that string-handling func- tions are essential to program implementation. Details of string-handling functions and other departures from standard BASIC are given in Appendix 3.1.

A number of steps have been taken, in writing the program, to ensure that GEOFILE can be adapted to the requirements of different systems and different users (see Appendix 3.5 and 6). For example: (a) only two program lines need to be altered to provide properly formatted output for a variety of printers with different character spacings and lines per form; (b) as the program was written originally for the creation of geochemical data files, the two prompts "OXIDE/ELEMENT" SYMBOL and "CONCENTRATION" VALUE occur frequently during file creation. For other uses these may be altered to more suitable prompts simply by altering two program lines.

DATA FILE C O ~ The main body of data in the files created by GEO-

FILE can be thought of as occupying a two-dimensional "array". Each row of this "array" contains data values associated with the particular parameter for that row (for example, length, density, SiO2 weight %) and each column contains data values for the particular sample associated with that column. A typical "array" of data is illustrated in Table 1. In addition to the main data values, the file also contains: the parameter-symbols' associated with each row (for example, SiO2, A1203, Fe203 . . . . . ); sample numbers (for example, SKI, SKI9, SK33 . . . . . ), sample labels (for example, L,M, U . . . . ), paired label- sample types (for example, L = Skaerganrd Layered Series). The parameter symbols and sample numbers are self explanatory. Sample labels are used to discriminate between sample types, for example on graphical plots of the data. Each sample on the file is given a label which consists of a single alphanumeric character chosen to identify some particular atm'bute of the sample. Thus, for example, all basalt samples on a file might be labelled "B' , all granites "G". The paired label-sample type data on the file simply ree.ord all different labels declared on the file and their corresponding sample types (for exam- pie, B: basalt; G: granite).

I~'TAII,S OF TIlE PltOGIIAM

Use of the program will be described in terms of file creation, file printing, and the editing and saving of files.

File creation The first main block of GEOFILE is concerned with

generating a data file in the computer's memory. The file may be generated in memory either by creating a new file via the keyboard or by reading in an existing file from disk.

Keyboard creation of a new file involves three stases: (i) input of a list of parameter symbols (SiO2, Al203, Fe203 . . . . ); (ii) input of sample numbers, data values for the parameters declared, sample labels (this stage is executed sample by sample); Cdi) specification of sample types corresponding to labels declared. A specimen file creating session is shown in Figure 1.

285

Page 2: GEOFILE: an interactive program in basic for creating and editing data files

286

C SI02 D &L203 ( FE203 F FEO G NGO H CAO J NR20 K K20 L T I 0 2 R P 2 0 5 N nNO P TTD! O OZ~ R NEI g OLO T 0 | )

A. D. M. Buaw~ and C. G, TOPLeY

Table I. Hard copy print-out of 8 typical "array" of data created through GEOFILE.

2 3 4 5 6 7 0

SK1 BK2 SK3 SK19 $K20 SK33 SK34 L L L N N U U

4 5 . 4 8 3 9 . 6 5 5 0 . 6 5 4 8 . 0 8 4 8 . 0 1 4 8 . 5 5 5 7 . 0 1 S I02 C 16 .41 3 . 2 9 2 5 . 5 4 1 7 . 2 2 19 .11 1 9 . 9 0 1 3 . 0 2 AL2U3 0

2 . 0 9 2 . 6 8 1 .11 1 . 3 2 1 . 2 0 2 . 3 3 2 . 1 5 F ( 2 0 3 E 9 . 2 9 2 2 . 9 3 4 . 0 7 8 . 4 4 8 . 4 4 8 . 2 3 9 . 2 5 FEO F

1 1 , 6 5 2 5 . 8 4 1 . 9 0 8 . 6 2 7 . 7 2 5 . 8 5 2 . 6 4 NGO G 1 0 . 4 6 2 . 2 9 1 1 . 7 4 1 1 . 3 8 1 0 . 3 3 9 . 1 3 5 . 7 5 C A O H

2 . 0 6 0 . 4 8 3 . 5 4 2 . 3 7 2 . 3 4 3 . 5 3 3 .~0 NA20 J 0 . 2 7 0 . 0 8 0 . 3 6 0 . 2 5 0 . 1 7 0 . 2 9 0 . 9 6 K~O K 0 . 9 4 1 . 3 0 0 . 5 0 1 . 1 7 1 .51 0 . 8 7 1 .78 1102 L 0 . 0 5 O.OG 0 . 1 & 0 . 1 0 0 . 0 7 0 . 0 7 2 .11 P205 M 0 . 0 6 0 . 3 4 0 . 0 9 0 . 1 6 0 . 1 2 0 . 1 1 0 . 1 2 H,O N

1 9 . 0 3 4 . 5 3 3 2 . 0 8 2 1 . 5 3 2 0 . 8 0 3 1 . 5 0 5 2 . 2 8 TTDI P 2 2 . 5 0 1 5 . 4 5 4 9 . 0 0 3 1 . 6 4 4 1 . 0 0 3 6 . 7 4 7 7 . 3 0 GZ~ 0 1 8 . 9 3 2 . 5 0 3 4 . 6 0 1 9 . 5 5 2 0 . 7 5 2 5 . 1 8 8 . 2 0 NEB R 4 2 . 9 9 7 9 . 4 1 1 1 . 5 2 3 0 . 3 2 2 9 . 9 3 30 .51 1 4 . 5 0 OLB g 1 5 . 5 8 2 . 6 5 4 . 8 7 1 8 . 4 9 8 . 3 2 7 . 5 5 0 . 0 0 O~B T

L I S T I H G OF LABELS

L ~ SKAERGAARD LAYERED SERZES R - H&ROINAL )ORDER GROUP U ~ UPP(R |ORD(R GROUP

In each routine, termination of input is effected by typing "E". The character "C" ("correction") may be typed to denote a previous input error. Error correction during input is effected through use of the code numbers displayed on the VDU to the left of each entry--see Figure 1. The character "N" also has a special significance because, if "N" is typed in place of either a data value entry or a label entry, the computer will assume a default value or label. In the situation of data values, the assumed default value is " - 3 " , which is taken by the program to indicate "not determined". This default ( -3 ) can be readily changed to some other convenient value. The default label is an asterisk (*) and this too may be changed (see Appendix 3.4).

Many error-traps are built into the file creation routine, for example the lengths of sample numbers and parameter symbols are checked (> ~ and = < 9 charac- ters); the length of each label is checked (1 character only allowed) and the labels entered are checked against forbidden labels ("! . . . . . . . . - " "/ . . . . \' . . . . . . . . + . . . . E" "C" "N") which are characters with special meanings in graph plotting, triangular diagrams, and file handling; all numeric values are entered into string variables and checked for nonnumeric characters before being assig- ned to numeric variables.

Existing data files may be read into memory from disk. The program listing (Appendix l) shows the routine used for reading files using the CPIM operating system com- mon to a number of microcomputers. Details of file structure are given in Appendix 3.2 for the benefit of users with systems not supporting CPIM.

File printing Having loaded the file into memory, either from key-

board or from disk, a hard copy print-out may be obtained (see Table I). In addition to all the data con-

rained in the file, the print-out also shows a row of numbers (1, 2, 3~... ), one number above each "column" of each block of print-out, and a column of alphabetical characters (A, B, C . . . . ) on the extreme left and r iot , one alphabetical symbol per row. These numbers and alphabetical characters thus form a two-dimensional grid through which any data item may be identified. This grid is used to specify data items to be altered in the file modification routine.

File edi t ing

The greater part of GEOFILE is concerned with file editing. A number of different editing options are avail- able and Figure 2 shows the information which is dis- played on the VDU concerning these options. In order to enter the routine for any particular editing option, the user simply types a single letter (for example, O, S, A . . . . . ). The options may be selected in any order although it is obviously more efficient to effect any deletions that are required, before specifying any ad- ditions. A brief explanation of each editing option is given below.

Option "O'--parameter symbol deletion. In this rou- tine, specification of preexisting parameter symbols results in those parameters and all associated data being deleted from the file. An error-trapping routine checks for the existence of the specified parameter(s). Deletion takes place en b loc only after all required deletions have been specified. Th/s allows any parameter erroneously specified for deletion to be reinstated by typing "C ' , for correction (see File Creation section). The program protects the user against inadvertently deleting the entire file should he attempt to delete all the parameters.

Option "S"-~similar to option "O" except that sample numbers and associated data values are deleted. It is possible that this routine may result in the complete

Page 3: GEOFILE: an interactive program in basic for creating and editing data files

GEOHLE: AninteractiveprograminBASICforcreafi~ a~ editi~ ~ta files

PART 1) - INPUT OF OXIDE/ELEMEHT SYMBOLS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

REMEMBER: *E" TO TERMINATE INPUT "C" FOR ERROR CORRECT)PN

1 OXIDE/ELEMEnt1 SYMBOl 1 '~ ~:~I02 . ~ . . . . OXIDE/ELEMENT SYMBOL ~ ? A L 2 0 3 F E 2 0 3

<~BELL>> OXIDE/ELEMEHT SYMBOL STRIH6 TOO I.ONG ( ' ? CHARACTERS)

2 OXIDE/ELEMENT SYMBOL 2 ? AL203 3 OXIDE'ELEMENT SYMBOL 3 ? F r203 4 OXIDE/ELEMENT SYMBOL 4 ? E

PART 2) - INPUT OF SAMPLE NO. - CONCENTRATIOH VALUES - SAMPLE LABEL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . T . . . . . . . . . . . . . . .

REMEMBER~ "E' TO TERMINATE INPUT "C e FOR ERROR CURRECTION PRESS ~ETURN FOR DEFAULT LABEL OR WHERE NO UALUE DETERMINED

1 SAMPLE 1 9 SKI 2 SI02 ? 45.48 3 AL203 ? 16.E1

<<DELL~k ILLEGAL (NON-NUMERIC) CHARACTER ENTERED

16.E1

3 AL203 ? 16.41 4 FE203 ? 2.09 5 LABEL FOR SAMPLE SKI? L

6 SAMPLE 2 ? SK19 7 S I 0 2 ? 4 8 . 0 8 8 A L 2 0 3 ? 1 7 , 0 2 9 FE203 ? 1 , 3 2 10 LABEL FOR SAMPLE SK197 C

CODE MURDER OF INCORRECT INPUT?

R E - I N P U T DATA STARLING MITH SAMPLE S K I ? 8 A L 2 0 3 ? 1 7 , 2 2 9 FE203 ~ 1 , 3 2 10 LABEL FOR SAMPLE SKI?~ H

11 SAMPLE 3 ? E

PART 3 ) - S P E C I F I C A T I O N OF SAMPLE TYPES CORRESPONDING TO LADELS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

SPECIFY SAMPLE TYPES CORRESPONDING TO LABELS ADDED IN ROUTINE ABOVE ( N , B t ANY INCnRRECTLY DECLARED LABELS CAN BE ALTERED THROUGH USE

OF THE E D I T I N G ROUTINE LATER)

SAMPLE TYPE CORRESPONDING TO LABEL ' L ° ~: 7SKAERGAARD LAYERED SERIES SAMPLE TYPE CORRESPONDING TO LABEL °M ° = ?MARGINAL BORDER GROUP

Figure 1. Specimen file creation session using GEOFILE. Data created are part of set shown in Table 1.

287

deletion of a preexisting label through loss of all samples with that label. Any label lost in this manner is noted and deleted from the paired label-sample type data.

Option "A"--addition of parameter symbols and/or sample numbers. The parameters and/or samples to be added are specified first, and this automatically results in a request for additional data values and, in the situation of added samples, associated labels. Any previously un- declared labels which are added are noted and the user is

asked ultimately to declare "sample types" for these new labels.

Option "R"--allows redefinition of sample types cor- responding to existing labels.

Option "M"--allows the alteration of any preexisting data item on the file, except the sample types associated with labels (see option "R" above). The item to be altered is specified by an alphanumeric editing code (see File Printing section). Figure 3 shows the way in which

Page 4: GEOFILE: an interactive program in basic for creating and editing data files

288 A. D. M. BL~WeLL and C. G. TOPL~f

YOU ARE NOW IN THE FILE EDITING PART OF THE PROGRAM THE EDITING OPTIONS ARE LISTFD BELOW. THEY MAY BE EXECUTED IN ANY ORDER.

O OXIDE/ELEMENT SYMBOLS DELETION (RESULTING IN LOSS OF ALL DATA FOR OXIDE/ELEMENT(S) SPECIFIED)

S SAMPLE NUMBER DELETIO~ (RESULTING IN LOSS OF ALL DATA FOR SAMPLE(S) SPECIFIED

A ADDITION OF OXIDE/ELEMENT SYMBOLS A~D/OR ~AMPLE NUMBERS (REOUIRING INPUT OF ADDITIUNAL CONCENTRATION VALUES AND P~SSIDLY LABELS)

R REDEFINITION OF SAMPLE TYPE(S) GIVEN AT BOTTOM OF PRINT-OUT OF FILE

M NODIFICAIION OF DATA TO ALLOW CHANGES TO BE MADE TO EXISTING SAMPLE NUMBERS, LABELS, OXIDE/ELEMENT SYMBOLS A~D CONCENTRATION VALUES

F FINISH, I . E . NO (FURTHER) CORRECTIONS - DATA MAY THEN BE SA':ED Oil DISK FILE

p PRINT-OUT OF CURRENT DATA

INPUT ORE FRON O~S,A,R,MpFpP ?

F~pJre 2. VDU dispby ~ edit~ op~o~ availab~ m GEOHLE.

DATA FILE MODIFICATION . . . . . . . . . . . . . . . . . . . . . . . .

THIS ROUTIHE IS FOR ALTERATION OF EXISTING DATA

THE FOLLOWING MAY DE ALTERED: O~IDE/ELEMENT SYHDOLS SAMPLE NUMBERS SAMPLE LABEL5 CONCENTRATION VALUES

SPECIFICATION OF WHICH DATA TO ALTER IS INDICATED BY ALPHANUMERIC CODES

ON THE PRINT0UT OF DATA, ROWS HAVE ALPHABETIC CODES ( A , B , C . . . ) AND COLUMNS HAVE RUNERIC CONES ( 1 , 2 , 3 . . . )

THUS: TO ALTER OXIDE/ELEMENT SYNBOLS, USE CODES SUCH AS C1,D1,E1. . . TO ALTER SAMPLE RUHBERS, USE CONES SUCH AS A 2 , A 3 , A 4 . . . TO ~LTER SAMPLE LABELS, USE CODES SUCH AS D2,B3,B4. . , TO ALTER CONCENTRATION VALUES, USE CODES SUCH AS C 2 , D 3 , E 4 . . .

NOTE THAT THE ALPHABETICAL CHARACTERS MUST BE SPECIFIED BEFORE THE NUMERICAL CHARACTERS

Rgure 3. VI)U ~s~ay w~ch describes use of ~phanumeric e~ting codes during file ~od~don routine of GEOHLE.

these codes are used (refer also to Table 1) and Figure 4 shows a specimen session using this routine. Again, there are many error-traps, mostly concerned with identifying invalid codes, and routines to check whether previously undeclared labels have been input or preexisting labels completely deleted.

Option "F"--the option to terminate execution of the program. Three suboptions are available: (i) to abort the "F" option and return to selection of editing options; (ii) to "save" the data on a disk file and return with the subsequent option of further editing of the data; (iii) to terminate execution of the program without saving data on file. If the last option is selected, a further check is made to ensure that the user appreciates the implications of the choice, that is the current version of the data file will not be "saved" on disk.

Option "P"--hard copy print-out of the file. A hard copy may be selected after an edit has been made, that is as soon as the most recent hard copy becomes outdated.

In certain circumstances, a hard copy is provided automatically after file modification, before any further editing can be undertaken. This is to ensure that the user is aware of the current contents of the file.

CONCLUDING REMARKS

The size and complexity of GEOHLE require that some description is given of overall program structure and of the modifications that might be necessary for implementation on systems that differ from the one for which the program was written originally. These two descriptions are given in Appendices 2 and 3, respec- tively, and the program is listed in Appendix I.

The program has been implemented and run on a Rair Black Box microcomputer (using CP/M and Microsoft MBASIC), on an Apple II microcomputer (using DOS and Applesoft BASIC) and on a 750 Prime super- minicomputer (using PRIMOS and Prime BASICV). The minor changes necessary for each implementation were

Page 5: GEOFILE: an interactive program in basic for creating and editing data files

GEO~LE: An inte~ctive program in BASIC for creating and editing ~ files

DATA FILE MODIFICATIOtJ . . . . . . . . . . . . . . . . . . . . . . . .

IN THE FOLLOWING ~OUTINE, SPECIFY THE ALPHANUMERIC CODES n|F EACH ITEH TO ~C CORRECTED

REREMBER: " E ' T O TEK'MIHATE IHPU1 PRESS RI£TURN WHERE NO UALUE DETERMINED F'F:['S¢~ F,'F-'IUI~:N FOl~: DEFAULT L.~D[L

<£UDU P r o m P e $ ~ ::2User R e ~ l i e ~ : : :

289

• ::i< BELL'> >

::i ::2DELL i~ ":

::i .::2 BELL i~; ~'..

SPECIFY ALPHANUMERIC CODE~ A

CODE INCOMPLETE

SPECIFY ALPHANUMERIC CODE? A5 SAMPLE NUHBER TO REPLACE S K I 9 = ? SK1

SAMPLE NUMBER ALREADY EX ISTS

SAHPLE NUMBER TO REPLACE SK19 = ? SK30

SPECIFY ALPHANUMERIC CODE? D1

CODE ' D I " NOT PERMITTED

SPECIFY ALPHANUHERIC CODE • B3 NEM LABEL FOR SAMPLE SK2 = T U

SPECIFY ALPHANUMERIC CODE~ DB NEW AL2O3 VALUE FOR SAMPLE SK34 = • 1 2 . 5

SPECIFY ALPHANUMERIC CODE? P1 OXIDE/ELEMENT SYMBOL TO REPLACE TTDI = ? D I F F IND

SPECIFY ALPHANUMERIC CODE? E

Figure 4. Specimen file modification session. F'de being modified is that shown in Table 1.

effected rapidly through use of the relevant systems editor. Copies of the program, on tape or disk, may be obtained from the authors on request.

We believe that it should be possible, with only minor modifications, to implement GEOFILE on any system which has the rolnlmum requirements outlined in the early part of this paper (see Program Implementation). Furthermore, GEOFILE is suitable for creating and edi- ting data files for a wide variety of purposes.

Acknowfiedgments--We would like to express our thanks to: Nick Butler for cri;k-------aHy reading the maauscript; Dermot Allen for photolFaphing dialpams; Margaret Rowe and Anne Lloyd for typing the manuscript, Financial a.isumce from the Oxford Polytechnic Microcomputer Fund is gratefully acknowled~.

i U ~ American National Sumdards Inrdtme, 1978, American National

Standard for minim=l BASIC: Am. Natl. Standards last. X3.60- 1978, 39p.

ECMA, 1978, Minima] BASIC: Sumdard ECMA-55, 35p.

Listing oJ program

I ~ R B

200 REM . -~n. . . . - -~- - ~ ILE PROBl~ . . i~ - - -~ - 201 REM

2O2 REM 210 FOR I=1 TO 24 22O PRINT 230 NEXT I 240 PRINT TP$(ll);'BEOFILE PflOEK~ ImITTEN BY ADfl BURI~LL t (:6 TOPLEY'

PRINT T~(~)i'~T OXFORD POLTrECHNIC - 1981' 251 L'I.E~ ~ 2 REN A r ras used as f o l l w s :

RDI 05(I) - Pit;meter $~mbols " 254 REN Nt(1) - r~mPle numbers .'~5 ~ N$(I) - s t o l e labels

256 REN D(I ,J) - data values, I corresponds to m P l e s , J to Parameters

Page 6: GEOFILE: an interactive program in basic for creating and editing data files

290 A. D. M. Bu~w~L and C. G. TOPLeY

257 REIt Y$(I) - alehatxetical editins codes 258 REll L$(I), 55(I) - eaired labels - saoele t ~ e s resnectivelw

~ 095(I), ~(I) - ~ar~rs amd s~le r~bers res~ctivel~ to 260 RDt be added ~KI/or deleted 261 REll SS(I,J) - ~ in routines for deletins Paraeters and sable numbers.

R£ll SS(I,l) ~ f ro l 0 to 1 d.m Ith elel~nt of 05(I) or N$(1) 263 ~ L-qlcified for deletion, ~( I ,2 ) records order in which Ith eleMnt 264 R~ s~c i f t~J for deletion. 2 ~ 1 8 L3(I) - contains ~CII values of disalloved labels 266 REN E$(I) - alphmetieal cl~racters eorreseondinl to editinS oetions 267 ItEM E19(I) - error m ~ in smele number validation sub-routine 268 I1~ FI$(I) - contains 'REAO' am~J ' S ~ ' ~ ' - used in f i le r~ in~ sub-routine 269 RE]I L15(I) - error mr~ les in la~el v~lidation sub-routine 270 DIN 05(20),N$(60),II$(60)~D(60~70hY$(48) ~L$(15) ,S$(l~) ,09$(10) ,$?$(30) ,$8(60,2) 290 Dill L~(lI),E$(7),EIt(2hFl$(1)~LI$(3) 215 R~ I2 " uxtma~ n~ber of w l e s 290 I2-60

I ~ .12 - ~mxiw~ ntmber of varamter s~bols 30Q J2=20 305 ~ N3 - ~ x i ~ number of different l~bels 310 N3-1~ 315 ~ X2 - ~xi~,m n u ~ r of varanster deletions/~lditions allowed ear edit 320 X2=IO 325 I ~ S2 * ~x i~m n~abet of sNele deletions/additions ~llo.ed ear edit 330 S2=30 335 ~ NI - number of different labels on data f i l e 340 It1 --'0

345 I ~ F2 - 0 in i t ia l ly , set to I once ~e~or~ contains a date f i l e 3~0 F~=O 3 ~ I ~ !15 - date values (D(I,J)) which have not been determined are set to

375 REll C2 - number of characters nee line on ~ i n t e r 380 C2=132 385 RE~ L2 - nuiber of lines Per fo~ on e r i n~ r 390 L2~64 3~ REH RO - ~ x i ~ number of Parameters ear block i f 2 blocks erinted 3% I ~ Per ~a~e 400 I~INT((L2-24)/2)

CO - maximum number of sa~mles vet blocl~,.of J~ri~-out RTJI

410 CO=INT((~-20)/lO) 415 RE~ R1 - determines whether earameter s~bols reprinted at r i ~ t mar~in 416 I~1 of vrint-out 420 RI=INT(C2/2)~IO 425 RE~ E2 - set to I in f i l e ~mdification routine so that return ~ to this 426 ~ routine after vrint-out 430 E2=O 435 ~ F5 - number of disallowed l~e l s 440 P5=9 4~0 P1$m'OXI~E/ELEllBIT' 460 DIt='CONCENTR#TION" 470 P~=LEN(P1$) 480 D3=LEII(DI$) 490 ES~XR$(34)~'E' ~CX1~(34) 500 C55=0tR$(34) ÷'C' ~CHR$(34) 505 ~ ~ - instruction for default label or 'not determined' data value 510 D2$='PRESS RETURN' 520 LI$(I)='NO LABEL BTERE~' 530 LI$(2)='SIX6LE CHARACTER ONLY ALLOWED FOR LhBEL' 540 LI$(3)='THIS LAIEL IS NOT PERHITTED' 550 EII(I)='NO S~PLE NUMBER ENTERED' 560 EI$(2)='NO NORE TIMN 9 CId~R#~CTER$ ALL.El) IN S~%E NOHBER'

~ F55 - s~lbol .sad for default label 570 PJ$='¢° 580 FI$(O)='REM)' 590 FI$(I)='Sd~UED'

B7$='YOU ARE EINO E ~ D TO THE BEGIHiIITI6 OF THIS ROUTINE' 605 L3(I)=A~(F5$) 610 MTA 33,43,45,46,47,~,94,69,67,78

620 FOR I.--2 TO F5÷2 630 READ L3(1)

Page 7: GEOFILE: an interactive program in basic for creating and editing data files

GEOFILE: An interactive program in BASIC for creating and editing data files

640 NEXT I 650 ~TA O~$1R~R~H~F~P (~0 FOR I=1 TO 7 670 READ E$(I) 680 NEXT I 690 DATA ArB,C~D,E,F,BpH,JtKpL,H,NtPfD~RrS~T~UFUtgtX~YtZ 700 DkTk ARrBD~CC,PDgEEtFF~SGtHHwJJ~KKtLL,HI~IIN~PPIOQ~RR~SS,TT~UU,VU,I~XX,YY,ZZ 710 FOR I=1 TO 48

~ Y$(1) 7) IEXT I 740 F~ I=1 TO 24 750 PRINT 76O ~Xl I

770 PRINT '~S ln lZ~SS lZF ILE CRF..ATION ~ E])ITIN6 PE'O6Rk.HI;:S:SSS/ZXllrSI(~Zlz/fllzU' 780 PRINT

~INT'~N INPUT IS ~I~ ~ THE KEYDON~D, SIH~Y TYPE IN k REPLY ~D' 800 PRINT'PRESS RETURN TO 8E~ i~TR TO THE COHPUTER' Me [c01t ] l | TO 7'2 120 lqlllT'lll' ; D0 IEXT I 1140 ~ !=1 TO 4 IIM I~INT l e Hz3fr I r/o l e l t 2330# I o PRINT IP/O FLINT

PII]Iwr'11GS PIOBIM N.L0ii YOU TO EDll~ C IB~ t I D FILE ~ BIT NP 710 PRIIIT*EXlSTIH6 FILE' 92O PRIm 930 t t ~'° 94)0 ]IP41T*ZlIPUT.N l i l t ~11 FILE 0R E Felt EXI~TIN6 FILE';M ~0 IF Me'R: IIIII-1200 910 IF kt**[' TNElt 1000 970 PRINT

PRINT CIII~IT);*NI~[I E ~ N' I ~ IOTO ~ZO 1NO ~ l l l 24000 1010 i119 2100

1030 ~ Lines 1200-7.~: teet ie , for c ~ t t i ~ nov ~ f i le 1040 IE~ . . . . : . . . . . . . . . . . . . . . . . . - ~ 1200 ~ lltT~ 1210 Fill l=l TO 20 1220 PIIIIO 1230 II~ I 1235 i)1 Lines 1240-1130: ~ i f i c z t i e m of earme~r swbols 1240 PRIIIT'IMIIT 1) - IIIPUT OF ' tPI IP SYffil0LS' 1250 F01t I-1 TO 27H~3 1244 PRINT'-'! 17/0 lilt I 1210 PRINT 1290 PRINT 1300 PRINT'IEIEIBER: ' ; E ~ ; ' TO ~tl~lNtl~ INPUT' 1310 ~INT T~( l l ) ICSII ' FOIl EIUIIIt ~.~E~.TION'

1330 PRINT 1340 I'I 1350 PRINT I;TNtIS)tPI$t' SYII~L';I; 1360 O~ '° 1370 INPUT 05 1nO eOS~ 20eO0 13~0 IF P4-1 THEN 1350 1400 05(I ).-'05 1410 IF 05(I)=°[ ° THEN 1600 1420 IF Ot(I)<;.'C' THEN 1460 1430 __m~jm_ 17300 1440 PRINT 1450 BOTO 13'30 1460 IF I=l THEI~ 1550

291

Page 8: GEOFILE: an interactive program in basic for creating and editing data files

29"2 A. D. M. BURWeLL and C. G. TOPLeY

1455 RE]I Lines 1470-1540: checks ~ r earmter seecifi~J alreads exists 1470 Lzl 1400 IF 05(I)005(L) THEN 1530 1490 PRINT IS50 PRINT CII1~(7);P15;' ~ J ~ Y EXISTS' 1510 PRINT l~q) 80TO 1350 1530 Lst4.1 1540 IF L'(I-I THEN 1490 1~,0 I-I4"1 1560 IF I,,<,12 THIN 1350 15'70 PRINT 1~0 PRINT IM~O PRINT CHRt(7);'N~ B E ' ;P i l l 'S MY ~ ~CCOi~OD~TED ON THE FILE' 1 ~ I ~ II - numer of earaMtees 1500 IlaI-I 1510 IF IOzl THEN 1640 1520 ~MI~ 23500 1530 ~0T0 1240 16~ I ~ Lines 1640.-2510: p~ i f i ca t ion of ~ l e r~eber - data val~s - 1636 RBi umle label 1640 PRINT 1650 PRINT 1650 PRINT'IMRT 2) - INMJT OF SAMPLE ~ . - ';D15;' WII.UES - SMM.E LABEL' 1670 ~ I - l TO 544"~ 1680 PRINT'-'; 1690 MEXT I 1700 PRINT 1710 PRINT 1720 PRINT'IENEISER: ';E55;" TO TEI~II~TE INPUT" 1730 PRINT TM(I1)ICSt;' FOR ~ C~IECTION ° 1740 PRINT T Q ( 1 2 ) ; ~ ; ' FOR DEFAULT LAIEL OR iiHEAIE NO PN.~ DE~R~IIIIB' 17~ PRINT 1750 PRINT 17"/0 C,1 1790 Isl 1795 IMll Lines 1790-2030" input and validation of ~ l e ~ r 17'~ I ~ °° 1800 PRINT CITM(5);'MNPLE';I; 1810 IIIMJT I~ 18~0 IF Mr,'[ ° THEN 2390 1830 IF N$O'C' THEN 1910 1840 IF COl THEN 1890 1~0 PRINT 1864) PRINT CHI~(F)I°ILLE6N. INMJT ° 1870 PRINT 1880 80TO 1790 1890 60SlB 177OO 1900 6010 2430 1'10 BUlB 15900 1920 IF CIK4 THEN 1790 In0 N$(1)=I~ 1940 IF I-1 THIN 2030 1945 El l Lines 1950-2020: I ~0 L.1 1960 IF m(I)Oln(L) THEN 2010 1170 PRINT l'mO PRINT CIII~(7);'SkNPLE ~ N~J~DY EXISTS' 1MM PRINT 2000 9NTO 1790 2010 L~4.1 20"20 IF L-( I - I THIN 1950 2910 C,C÷I 2035 ID Lines 2050-21M: input of data valc~s 2040 Jl=l 2O5O 3.31 2060 k4~.'ll" 2070 PRINT CITM(5)IO~(J);TU(ll); 20~ IlffUT kS

checks uaethee smele mmNr seecifi~J alceld~ exists

Page 9: GEOFILE: an interactive program in basic for creating and editing data files

GEOFILE: An interactive program in BASIC for creating and editing data files

2090 IF l l~'C' THEN 1890 2100 IF k10' l i ' THEN 2130 2110 |( I ,J lqlS 2120 90TO 2160 2130 __~9~__ m_ 18100 2140 IF V4zl THEN 2060 2150 |(I)J)-t~L(k$) 2160 C~C~I 2170 JmJ~l 2180 IF J-~ll TIEN 2060 21~ lib Lines 2190-2310: in~t and vili~ti¢~ of iewle lalml 2190 C~'I(' 2200 PRINT C;T40(5);'LMEL FOR S~IPLE ' t l l t ( I ) t 2210 IIPUT CI 2220 IF Ct,'C' THEN 1890 2230 IF C$O'N' TIIEN 2260 2240 M(I),,FS$ 2250 OOTO 2310 2260 ~ 1550O 22"/0 IF CI)z(F5 ~ 2190 2200 BDOIB 21600 22~ IF C8zl THEN 2190 2300 m(I),CS 2310 C=Ctl 2320 PRZItT 2330 PRINT 2340 lzI,l.1 2350 IF I=<12 THEN 1790 2360 PRINT 2370 PRINT 2380 PRINT CII~(7);'NO IIOIIE ~JPL.E$ CAN lie ACCUHONTI~ 01( TIlE FILE' 2385 l a 112 - m J e r of smeles 2~JO I ~ I - I 2400 'IF 112~1 THEN 2520 2410 __nO~_~ 23600 2420 80TO 1660 2425 I R LiMs 2430-2SI0' t~tablislli m-t~trv point ~ input e~eor dlecl|ted 2426 RE)~ I~ user 2430 PRINT" 2440 PRINT 24~0 I'INT( (1t-1)/(li12))÷1 246O C~ 2470 Jl=ll-((I-1)$(N~2)fl) 2480 IF Jl,O THEN 1790 2490 PRINT'RE-IIIfl~ D~Tk STk~I'ING tilTH SklqPLE ';ll~(I) 2500 IF ,.I1,1~1 THEN 2190 2510 60TO 2050 2515 I1£11 Lines 2520-2640: s~ecificetion of saele tm~es coeeN~ndins to 2516 ~ I ~ I $ decle~,~ 2520 PRINT 2530 PRINT 2540 PRINT'PART 3) - SPECIFICATION OF S4MqI~ TYPES i ~ I ~ TO ~ItELS'

FOR I=1 TO 63 PRINT'-' ;

2570 ;E~ l 2'380 PRINT

PRINT 2600 IF NI>zl THEN 2630 2610 PRINT'NG LA]RL$ US~ IN P~T 21' 2620 DOTO 2960 2630 ~ 22900 26~ DOTO 2860 2650 R E I ~ m ~ . ~ ~,~ ~ , ~ 1 ~ , . ~ ~.(..~.L-.~(-~ ~ ~ ~.~ ~.~ ~ ~ ~ t ~ l ~ 2660 ~ Lines 2800-4080: routine for printins-~ file 2670 REM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2800 PRINT 2810 PRINT 2820 PRINT 2830 PRINT'DO YOU ~ A LISTING O~ THE tILE' ;

293

Page 10: GEOFILE: an interactive program in basic for creating and editing data files

294 A.D.M. B ~ w e ~ and C. O. To~.ev

2849 __~__"J 16~ 2850 ON X5 60TO 2860,4200,2820 2860 FOR I=I TO 4 2870 ~IHT 211~ IIEXT l

~INT°~TA WILL NOW BE LISTED ON PRINTER' 2?00 I~INT 2910 F~IHT 2920 MIIHT 2925 ~ Lines ~30-2970: calculates L? (nu~er of line ft~Js recuired to 2926 R(H centre 1 or 2 blocks of d~l~ m for~) 2930 IF IORO THEN 2970 2940 IF N2(COJl THEN ~70

L~INT((L2-1$-21~)/3) 2~60 60TO 2~0 29?0 L~llfl'((I.2-9-@)/2) 29110 IIfUT°EIII~ TITL£ F~ ~TA';T$ 2990 I~INT

PRINT 3010 T=I7fLEN(T$) 3015 ~ M and N ~ for fonmttirul mmrical :~rint.-cut

~ N9 - I~ 'ouu 1 ~ 1 data block has bran prinf, N on torn 1040 wp,,,0 3o4~ I B P9 - prom cg~ntar 3~0 M~I 3NO LI~UIT airS(12) 3t65 I Ig $ aid F - ~ thmlhout this ~utine: each peint~l block contains 3044 l i l t r o l e s Ill(S) - lit(F) 3070 S.l 30eO IF I12<C0 THEN 3110 3O9O F<O 3100 NTO 3120 3110 FuN2 3120 LPRINT'LISTIN6 OF NTA: ';T$; 3130 LMtlIIT T~(C2-O);'PME';I~ 3140 F~ 1-1 TO T 3150 LMtlIIT'-'; 3160 NEXT I 3170 LI~INT 3180 LPRIHT 31~ FOlt I=I TO L9 3200 LPRINT 3210 NEXT I 3220 LPfllIIT T~(7) ; '1 ' ; 3225 RE]IC - used as TAIl position counter throudh~ this routine 3230 C-16 3240 F~ I-S TOF 3250 LfltlNT TM(C);It l ; 32~0 C,C~IO 3270 NEXT I 3280 LPRINT 3290 LPRINT 3300 C-16 3310 LPRINT Y$(1); 3320 F~ J,,S TO F 3330 L~INT TAII(C);M(J); 3344 r.~C÷lO 33~4 N(XT J 3355 IEII I~I - see line 415 3360 IF C>R1 NEll LPRINT TA|(C÷11);~$(1); 3370 LPRINT 3380 C=16 3390 L~Zm Y$(2); ~DO0 ~l t J--'S ~0 F 3410 U~INT Tkle(C);M$(J);

C,C~IO 3430 NEXT J

Page 11: GEOFILE: an interactive program in basic for creating and editing data files

GEOFILE: An interactive program in BASIC for creating and editing data files

3440 IF C~1 THEN LI~INT TtB(C~ll);Yt(2);

3460 LI~INT 3470 L~INT 3400 Fire l - I TO N 3490 I.PRINT Yt(It2);Tk$(6)lOt(I); 3500 C-15 3510 FOR ~ TO f 3515 JD 115 - see line 355 3520 IF | (J , I )O;~ THEN 3~0 3530 LI~IIIT TkJ(C4"2);*N.D.'; 3540 BOTO 3610 3550 IF D(J,I)>IO0 ~ 3580

18 N and M - me line 3015 3 ~ 0 ~ 3b?O ~OTO 35W

3600 LI~INT i~llS P$;D(J,I); 3610 CaCtlO 3620 IIE~ J 3630 IF C~ql THEN LI~INT T~(C÷3)IOt(I);TN~(C~I2)IY$(I'~2); 3640 I f, e lm 36,q0 NEXT I

RL~ Lines ~'-3"/20: cheeks ~ r all d~a h~e teen er in t~ (F-'#2), 3656 I ~ otMevi~ ~ t ~ l i ~ l , ~ r ~ Smd F

3600 IF SO~ TEN 3710 ~ F-N2

3710 F ~ ~ ~ ~ 110 F,,IC~

RB~ RO ~ ~ - m lines 395-396 ~ 3035 ~.ectivelv 3730 IF ~ THEN 3760 374O 1F Jl~l 110 376O 3750 eOTO 3000 376O LPIUm CNI~(12) 3770 Ng=o. 370O Pg=P~I 3790 OOTO 3120 30O0 Je~! 3810 FOR 1,1 TO L9 38"20 LPRINT 303O NEXT I

]84'5 I B Lines ~150-3930: 3nO IF ~ THEN ~90

IF 112{COtl THEN 3870 IF J ~ l ~ 389O 300O OOTO 3910 309O LPRIIIT C;~(12) 3900 BOTO 3940 3910 FOR I=1 TO L9 39'20 LI~INT 3930 NEXT I

I B L i r a ~40.-4070: 3940 U~I~'LISTIW Of LMELS' 3VSO FOr I-1 TO 17 3960 I.PRIIIT'-'; 3970 l ia r I 3900 LPRINT 3990 LPRIIIT 4000 LPRINT 4010 IF NI>sl TIIEN 4040 4020 LPRI~'~ LNELS NCi.NED' 4030 601"0 4070 4040 ~ I=I TO NI 4050 LM~INT L$(1);* : ';S$(I)

establishes ~ether new foes m~ired for labels

l i s t s labels md r o l e trees

295

Page 12: GEOFILE: an interactive program in basic for creating and editing data files

296 A D. M. Bt.reWEX.L and C G. TO~LEY

,W~O NEXT I 4070 LI~IIIT CHR~(12)

18 L i ~ 4200-4480: wleetion of eCitin~ oetion 4100 BE~ 4110 REll F2 - m line 345 4200 F2-1 4210 l l= l 4215 R~I P8 - when PSsl, indicafas vrint-out is ue-to-dete 4220 MI~I 4230 E l - " 42~ ~ E2 - me lines 42'~-426 4240 IF E201 THEN 4270 4250 E2-O 4260 ~ 11270 4270 FOR I:1 TO 24 4280 PRINT 4290 IIE~ I 43OO ~OSUB 1~500 4310 PRIm 4320 PRINT 4334) PRINT E$;'II@UT ONE FR~ 0,S,k~RdbF~'; 4340 4 ~ 43~0 4 ~ 434O 4T/O 4310 439O 44OO 4410

444~

E~a ° *

I ~ P~ - set line 4215 IF PI~ ~ ;~INT'P';

Lines 4~0-4460:

1-1 E$(I )~I TIIElt 4470

I=I'1'1 IF 1=<7 THEN 4390 PRINT ~IWT PRINT CH~(7)

44S0 E$,'IWMJT EI~OR - 446O 801"0 43OO 4470

4491 4500

cheeks validits of s~eeified oetion

ON I BOTO 4600,~O0,4WiOO, lO4~t11000,12WO,21~¢

I ~ Lines 4600-53~: routine for deletin~ e~rue~ers and associated BE~ d~ta v~l~

BE~ 4600 PRINT 4610 PRINT ~20 PRINT P15;' S~NL DELETION ° 4630 FOR I=I TO 16~P3 4 ~ PRIWT'-'; 'W~O IIEXT 1 4(~0 PRIWI 4670 PRINT 4680 PRIWI'TIIIS ROUTINE DELETES SPECIFIED ' ;PI$; ' (S) AND ALL CORRESPI~IN6' 4690 ~IIIT B15;' WLUE$' 470O _M~_~ 152OO 4710 IF A~,°N ' THEN 4300 4715~ PR- m line 4215 47"20 PR-~ 47"30 PRIIIT'SPECIFY ' tPI$; ' (S) TO BE I)ELETI~| ' ;E55;' TO TE~INATE INMJT' 4740 PRINT TAB(30÷P3);CS$;' FOR ERi~R CORflECTIOR' 475O PRim 4760 PRINT 4770 FOR I=1 TO N 4775 REll ~ ( I , J ) - s~ lines 261-264 4780 SS(I,1)'0 4790 NEXT I 4795 1 8 Lines 4800-5110: routine for s~eciNinJ vaeneters to be delet4d 4000 1"1 4810 PRIWI IITMI(5);PI$;I; 4820 0l= '° 4830 Illl~I 05

Page 13: GEOFILE: an interactive program in basic for creating and editing data files

GEOFILE: An interactive program in BASIC for creating and editing data files

4040 IF Ot='E" THEN 5110 4850 IF OtO'C' THEN 4920 4860 60Sire 1730O 4865 I1[11 Lines 4870-4890: SS(IpJ) arra~ reset so t l~ t e a r i t e r s in~or~ctl~ 4866 REll specified for Ueleticm are re-instated 4870 FOR K.q TO N 4800 IF Se(Kt2))=I THEN Se(K~I)zO 4890 HEXT K 4900 PRINT 4910 60TO 4810 4915 HEll Lines 4~20-5050: ch~ks t ~ t etrameter for deletien hes not almMJw 4916 ~ been ~ t c i f i t ~ md that this t ~ r m ~ r exists in OS(I) srra~ 4920 ~1 4930 IF OtOOi(J) THEIt 5000 ~40 It~J 4~50 IF SB(J,I)=O THEN 5060 ¢960 PRINT 4970 PRINT CIIRt(7);'EI.ETIO~ OF THIS ' ;P i t ; ' tLRE~Y SPECIFID' 49OO PRINT 499O 60TO 481o 5000 J-J~l 5010 IF J=~f THEN 4930

PRINT 5030 PRINT Clgtt(7)lPl$;' NOT RECOeNISE]. TRY ~ I N ' 5040 PRINT 5050 OOTO 4810 5040 t ( M , l ) = l 5070 $8(R9,2)-I 500O IF I-N THEN 212OO 5090 I=I÷1 5100 IF I,<X2 THEN 4810 5101 PRINT 5102 PRINT CIII~(7);'NO IIORE ?HAll ' IX2;' ' ;PI I ; 'S HAY DE ~ FROH THE' 5103 PRINT 'FILE AT kNY ONE TIHE' 5104 PRINT 'IF YOU ~ TO DELETE ~ 'tPl$l 'St HE-ENTER THIS I~UTIHE'; 51~ PRINT ' lIEN BLUE] THE ~ITItG OPTIONS' 5106 m 51N I B lfl - mmiper of parimters to be ~ l e t ~ 5110 I~ I -1 ~120 IF X ~ TH~ 5150 51~ __~PR 23600 5140 ON X5 OOTO 4300,4730 514~ HE~ Lines 5150-5340:deletM5 pel'mleters fl'o~ 05(I) trr8~ itt~J 5146 RE]! corre~q~i~l da~ v~lu~ fe¢~ D(I~J) a r m 5150 l=I 5160 IF $8(I,1)=1 THEN 5190 5170 I'I÷1 5100 OOTO 5160 5190 IF ~ I ~ ~ 5200 K l ' I t l 5210 FOR K:I TO N-N5 5220 J"KI 5230 IF se(J~I)=O THEN 5"270 5240 JzJ~l 525O IF ,t..~ THEN 523O 5260 OOTO 5330 5270 K1~1 5200 FOR L:I TO N2 5290 ~(L,K)'D(L~J) 5300 HE1'T L 5310 Ot(K)eOt(J) 532e HE'XT K 5330 N.N-N5 534O 60TO 43OO

~ Lines ~i00-643O: routine for ckeletirm s~wles and ~ssoci~t, eU 5361 RB~ dote valees 5370 EN

PRINT

297

Page 14: GEOFILE: an interactive program in basic for creating and editing data files

298 A. D. M. BtmweLt and C. G. TOeL~Y

5510 PRINT 5520 PRINT'S~M.E N@t~t ~LIIIOW'

FOR 1,1 TO 22 PRINT'-'t

~50 HEXT I 5~0 PRINT 5~r/o PRINT 5580 PRINT'THIS ROUTINE I)ELETES SPECIFIED SAMPLE ;lUMBER(S: AND ALL CORRESPONDIt~' 5~90 PRINT Bi t ; ' VALES'

QO~B 15200 5610 IF AS='N' THEW 4300 5615 REM P8 - see line 4~15 5620 ~=,) 5630 PRINT'~PECIFY S ~ t E NI~I~.R(S) TO BE I)ELETEg' ';E5$;' TO TERMINATE I~,PUT' 5640 PRINT TA8(42);C5$;' FOR ERROR CORRECTION' 5650 PRINT ~ 0 PRINT ~70 FOR I=1 TO 5675 REM SS(I,J) - see hnes 261-264 5680 58(I,1)=0 5690 NEXT [ 5695 REH L~nes 5700-6010' routin~ for s~ecif~inJ saples to be delete~ 5700 I=1 5710 PRINT I;TAB(5);'SAI~E NUMBER';I; 5720 N ~ " 5730 INMJT 5740 IF Nt='E' THEN 6010 5750 IF ~<>'C' THEN 5820 5760 SOSUB 17300 5765 Rf~ Lines 5770-5790: SB(I,J) arra~ reset so th ; t sables incorrectl~ 57~ I ~ specified for ~eletzon a:e re-instated 5770 FOR K:I TO 5700 IF ~(K~2)>:I THE|! S8(K71)=0 5790 NEXT K

PRINT 5810 GOTO 5710 5815 ~M L-r~s 5820-5950: c,Secks that ~ l e nu~,ber for deletion h~s not 5816 ~ alread,~ been specified a~ that this ;aaple exists in H$(1) arra~ 5820 J=l 5830 IF NtOWI(J) THEN 5900 5040 llg=J 5850 IF 58(J,1)=0 THEN 5960

PRINT 5870 PRINT CHRt(?);'BELETIOW OF THIS S)~PLE ~LJ~IF, ADY SPECIFIED' 5800 PRINT 5890 60TO 5710 590~ J=J+1 5910 IF ~=<N2 THEN 5830 5920 PRINT 5930 PRINT CHR$(7);'S~WtPLE NI/~BER NOT RECISWISED, TRY ~ I I t ' 5940 PRINT 5950 WTO 5710 5960 ~(119,1)=1 5970 58(M,2)=I 59~0 IF I::W2 THEN 21200 5 ~ I=I+l

IF I=<~ THEN 5710 6001 PRINT

PRINT CHI~(7);'MO BORE THAN ' ;$2; ' ';'S~J~PI.ES MAY ~ DELETE9 FROM THE' 6003 PRINT 'FILE M ~NY OWE TIME' 6004 PRINT 'IF YOU WISH TO DELETE MORE ~PLES, RE-ENTER THIS ROUTItE' 6005 PRINT 'WHEN GIVEN THE E~ITING OPTIONS' 6006 60SIB 23300 6008 REN N5 - number of sameles to be delete~ 6010 NS:I-1 6020 IF i~O THEM 6050 6030 C, OSU~ 23600 6040 ON X5 GOTO 4300,5630 6045 REM Line~ 6050-6240: deletes saele nuWoers and associated l~Mls from

Page 15: GEOFILE: an interactive program in basic for creating and editing data files

6046 REfl 6047 REN 6050 I~1 6O60 6O7O 6O8O 6O90 6i00 6110

GEOFILE: An interactive prod-am in BASIC for creating and ~ i t i ~ data files

M~(I) and ~(I , ' arrays Peseectivel~; Oeletes corresPondir~ dat~ values fro~ DiI,J) z~ra.~

IF OR(1,1)=1 THEN 6090 1=I÷1 60TO 6060 IF ~-I<~ THEN 6240 KI=H1 FOR K=I TO N2-N5

6120 J=EI 6130 IF SS(J,1)=O THEN 6170 6140 J=Jtl 6150 IF J=¢n2 THEN 6130 6160 fiOTO 6240 6170 KI= J.l.l 6180 FOR L:I TO H 6190 D(K,L):O(J,L) 6200 ~t'~T L 6210-N$(K)--NS(J) 6220 ~(K)=ff$(J) 6230 NEXT r, 6240 t;2=R2-~ 6245 I~H Lzne~.. ~250-6430; checks ~hether ~e-existin~ labol$ have bee~ 6246 REH co~$etel~ eli~in~tod f~o~, H~(I) arra~. I f so, ~ndifies LI(I) and 6247 ~l~ St(1) arrays 6250 IF Nl<t THE~; 4300 6260 I=I 6270 J: l 6280 IF L$(I)=I~I(J) THE~ ~.~,00 6290 J:J~l 6300 IF ,J=~N2 THEN 6280 6310 IF I ' (~I THEN 6340 6320 NI=NI-I 6330 GOTO 4300 6340 FOR r~=l TO HI-1 6~JO LS;K'~=LI(I~+I) 6360 S$(K) :S$IK÷~) 6370 NEXT ,~ 6380 NI:NI~I 6390 GOTO 6270 6400 I=I÷1 6410 IF l~Itl ~ ~70 6420 BOTO 4300 643O 64~0

645O

RE]~ Liras 6600-10220: m~tim for ~ifvi~ ~Miti~nal P~mta. aed/or I ~ ~ l e s , kckJitional data values (rod labels) lee t ~ n ine~" R E I ~ - -

6600 PRINT 6610 PRINT 6620 PRINT'AmITION OF ";PI$; ' S~OL$ Nm/l~ SklIPLE NINERS' 6630 FOR 1.1 TO 42~P3

PRINT'-'; ~ ) #EIT I 6660 PRINT 6670 PRINT 6680 PRINT'In lliZ$ RgUTIHE, ADDITIONAL ' ;PI$ ; ' SYtlI~$ ANB/OR ~ NIIIIKRS' 66~ PRINT'ME SPECIFIED. ~|ITIOML ~T~ ARE THEN I I~T FOR THE ADDITIONAL' 6700 PRINT PI$;'(S) W/OR ~91.ES SPECIFIEP' 6710 BOSU~ 15200 6720 IF A$='N" THEN 4300 6725 R[~ PR - see line 4215 6730 P8=O 6735 REM Lines 6740-61390: cheeks uhether both parmt, ers ~ s ~ l e s m be 6736 REN ~ to the f i l e 6740 C~ 6750 IF N=J2 THEN C=C-1 6760 IF N~I2 THEN C=C-2 6770 IF C=4 THEN 6900 6780 PRINT CNRt(7)

CAGEO VoL 8, No. ~4- -E

299

Page 16: GEOFILE: an interactive program in basic for creating and editing data files

300 A. D. I~L BUeWeLL and C. G. ToPLEY

6790 ON C 50TO ~800,6870,6840 6800 PRINT'THE FIE IS FULL AND C.~OT BE ADDED TO' 6810 PRINT'YOU ARE BEItlG RE.TURNEP TO THE EDITING OPTIOtIS' 6820 6O~JJ 2~J300 6830 GOTO 4300 6840 MtINT'ONLY S~qPLES Y~Y BE ~I)ED TO THE ~ILE' 6850 A9=2 6860 6OTO 7900 6870 MtINT'ONLY ';P15;'S RAY BE ADDED TO THE FILE' 6880 A~t

GOTO 7110 6893 RE]q Lines 6900-7100: establishes o, tion (1/2/3) reou~reO, U~lue of o~tion 68'~6 ~ ~ s $ i ~ d to A9 6900 PRINT 6910 I~INT 6920 PRINT'SPECIFY ONE OF THE FOU.OWIS! 6930 PRINT 6940 PRINT T~B(6);'I ADI~ITI~ ~ ';PISP SYHI~OLS ONLY' 6950 PRINT T~(6); '~ AODITIO~ OF SAt~LE NIJIt~RS ONLY' 6960 l~I~ TAB(6);'3 ABBITI~ OF BOTH ';PI$;' SYIt~Ot.S ~I) ~E t~I~'

6970 PRINT 6911O k~'" 6990 INPOT'~CIFY h 2 OR 3';A1 7000 60SUB 18100 7010 IF P4=! THEN 6910 7020 ~W~.(~$) 7030 IF M<I THE~ 7070 7040 IF k9>3 THEN 7070 7050 IF A~>INT(Ag) THEN 7070 7060 I;OTO 7100 7070 PRINT 70~0 PRINT CHRI(7);'/~ER 1, 2 OR 3' 7090 G010 6910 7100 IF 49=2 THEN 7900 7104 REI! 7105 IU Lirmi 7110-7780: routine for s~ifwing parmters to be ~ to f i le 7110 I~INT 7120 PRINT 7130 PRINT'~ITION OF ';P15;' S/M[~OI.S' 7140 FOR I=1 TO 20~P3 7150 PRINT'-'; 7160 NEXT I 7170 PRINT 7t80 PRINT 7190 PRINT'IN THE FOU.OMIN6 ROUTINE*. °;E~$;' TO TERHINATE II~PUT' 7200 PRINT TAi(27);C55; ° TO COi~IECT E3~RORS ° 7210 PRINT 7220 PRINT 7'230 I=1 7'240 PRINT I;TAS(5);PI$!' SYMBOL ' ;

Or= °' 726O INPUT Ot 7'27O ~ 20800 ?280 IF P4=l THEN 7240 729O 09S(I)=05 7300 IF 09$(I)='E ° THEN ;'700 7310 IF 095(I)(~'C' THEN 7330 7320 60SUB 17300 7330 PRINT 7340 GOTO 7240

IF |:1 THEH 7440 7355 REM Ltne.¢ 7360-74~0; checks that aOdition of +,his parameter h~s not 73~ ~ alrea~ been SPecified 7360 L=I 7370 IF 095(I)<>095rL) TH[tJ 74;0 7380 PRINT 7390 PRINT CHR$(7);*Agl)ITION nF THtS ':P15;' ALF;EADY SFECIFIEP ° 7400 PRINT 7410 60TO 7240

Page 17: GEOFILE: an interactive program in basic for creating and editing data files

GEOFILE: An interactive program in BASIC for creating and editing data files

7420 L=L+1 7430 IF L=<I-1 THEN 7370 74315 REM Lines 7440-7510: checks that ~era~eter for ~ddiLior~ does not ~lreadv 7436 REN exist in ~(1) arra~.' 7440 L=I 7450 IF OS(L)<>0%(I) TEN 7500 7460 PRINT 7470 PRINT CHRt(7);PI$;' ALREADY EXISTS' 7480 PRINT 7490 SOTO 7240 7500 L~+I 7510 IF L=<N THEN 7450 7 ~ I=I÷1 ~ IF N÷I=(J2 TEN ~0 PRINT 75~ PRINT 7560 PRINT CH~t(7);'NO HOE ';P1$;'S CAN BE ACCONHODkTED ON THE FILE' 7570 60T0 7700 7580 IF I=<X2 THEN 7240 7590 PRINT 7600 PRINT 7610 PRINT CHRt(?);'THIS ROUTINE ALL~ THE ADHTION OF NO ~ THAN ';~;' ';PITT'S' 7620 PRI~'AT A TIME' 7630 X=J2-N-X2 76~0 IF X=O THEN 7700 76,50 PRINT 7660 PRINT'THE FILE MILL STILL #~eCONMO~TE t F~THE]~ ';X;' ';PI$;'$' 7670 PRINT'IF YOU ~OUIRE ~ ';P1t;'St ~-~T~ THIS ROUTINE ~N GIUEIV 7680 PRINT'THE EDITIN6 OPTIONS' 7690 60SUS 23300 7695 REM N5 - number of ea r~ te rs to be ~ d 7700 ~-'I-1 7710 IF ~>=1 THEN 7770 7715 ER Lines 7720-7760: if no permeters eM~cified for aKklition, checks 7716 ~N ~ t h e r this is inter4ed, If so, either returns to oditira option 7717 REfl ( i f Ag*I) or modifies #W ( f ~ 3 to 2) 7720 80SU~ 23600 7730 ON X5 BOTO 7740,7130 7740 IF A~I THEN 4300 7750 #t9=2 7760 GOTO 7900 7770 IF @P=1 THEN 8700 7780 RE~ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7785 REfl Lines 7900-~30: routine for pee i f¥ in l sample numbers to be ~Jded 7786 RE~ to f i l e 7900 PRINT 7910 PRINT 7920 PRINT'~ITION OF StIteLE Nt~BERS' 7930 FOR I=1 TO 26 7940 PRINT'-' ;

NEXT l 7%0 PRINT 7970 PRINT 7980 PRINT'Ill THE F~LI)I#I~ ROUTINE: ';k'5$;' TO ERHI~TE II@IJT' 7990 PRINT TkB(27);CS$;' FOR ~ ffJF~CTION' 8000 PRINT 8010 PRINT 8020 1:I 8030 Nt--" 8040 PRINT IITk3(5);'SANeLE ~ ' ; 8050 IIIPNT Nt 8060 IF Nt='E' THEN 8470 B070 If N40'C' THEN 8110 808O 80~B 17300 8090 PRINT 8100 GOTO 80~) 8110 OOS~ 15900 8120 IF C8<4 THEN 8030 .8130 Sg~(I)=I~

301

Page 18: GEOFILE: an interactive program in basic for creating and editing data files

A. D. M. BUXWeLL and C. G. TOPLeY

8140 IF I-I THEN 8230 8145 ~ Lines 8150-8220: cheeks ttmt additim~ of this s~mle nmiber h~s not 8146 ~ a l r , ~ beam seecified 81~0 L=I 8160 IF sg$(I)OS~$(L) THEN 8210 8170 PRINT 8180 PRINT CHR$(7)I'A~ITIO# OF THIS SAMPLE NUMBER ~I . I~Y SPECIFIE~' 8190 PRINT 8200 SOTO 8030 8210 L-LH

IF L=<I-I THEN 8160 822'~ REM Lines 8230-~00~ checks t~at this sable number does not already 8226 R(~ exist in #$(I) array 82.10 L=I 8240 IF S~( I )O~(L) 11~ 8290 8250 PRINT 8260 PRINT CHR$(7);'SNS~ NU~(R ~LRfd~OY EXISTS' 8270 PRINT r~80 EOTO 8030 8290 L=Ltl

IF L-<ir2 ~ 8240 8,110 I=IH 8,120 IF N2~I=<I2 TIER 8370

PRINT 8340 PRINT 83"50 PRINT L'I~R~(7);'~ MORE SAMPLES CM E ~'L'O~MO~TE3 OM THE FILE'

~TO 847O 8370 IF I=(S2 THEN 8030 8380 PRINT 83~0 PRINT 8400 PRI~ ~IR$(7);*THIS'ROUTINE AtLOUS THE ~DITION OF NO MORE THM ' ; ~ ; 8410 PRINT'SNIPLES AT A TIRE' 8420 X=I2-N2-S2 8430 IF X--O TREN 8470 8440 PRINT'TH( FILE IIILL STILL ACCDflIO~IT A FURTHER ' ;X; ' SAi~PLES" 8450 PRINT'IF YOU REQUIRE ~ SAItPI.ES, RE-ENTER THIS ROUTIRE ~EN GIVEN THE' 8qbO PRINT'E~ITIN6 OPTIONS' 8465 I B N7 - number of s~,~les t~ be added 8470 #7=1-1 8480 IF #7>:1 THEN 8700 8485 R~ Lines 849Q-8520: i f no s to les s~ci f ied for sddition, checks whether 8486 REIt this is intende~. I f so, either returns to e~itins option ( i f k9;2) 8487 ~ or modifies P,? (from 3 to 1) 849Q C~SIJIJ 23600 8500 ON X5 ~)TO 8510,7920 ~ 0 IF ~-2 THEN 43O0 ~20 A~I

8540 RE~ Lines 8700-10220: routines for in~uttin~ dita values (and labels) 8541 I ~ for edditio~I wraeLees and s to les 8700 L3-*O 8710 PRINT 87"20 PRINT 8730 PRI#T'I#PLIT OF A~DfTIOIML DATA' 8740 FOR I=1 TO 24 8750 PRINT'** ; 8760 I~T I 8770 PRINT 8780 PRINT 8790 PRINT'SINCE YOU H~E IIfUT ADDITIONAL ' ; 8800 IF A9-'-2 ~ 8840 8810 PRINT PI$;'S'; 8820 IF A9=I THEN 8850 883O PRINT' AND ' ;

PRINT*SI~tPLE NU.SERS'; NSO PRINT','

PRINT*YOU ItUST NO# IHPUT ~D~ITIONAL I~T4 F~ ' ; 8870 IF I~(>1 TREH PRIHT'LA~ELS AND ' ; 8880 PRINT DIS;' 91#.UES*

Page 19: GEOFILE: an interactive program in basic for creating and editing data files

GEOFILE: An interactive program in BASIC for creating and editing data files

8890 IF A9=2 THEN 9450 88~ REN Lines 890~-9440: ~ou~ir~ for in~uttiml data values for additional 8896 ~ ~armters (Pre-existinl sables only) 8900 PRINT 8710 PRINT 8920 IF A~3 THEN PRINT'I)';;TU(5); 8930 PRINT'ADDITION OF ' ;1}15;' VALUES FOR ADDITIONAL ' ;PI$;' (S)' 8940 IF i~F,~3 THEN PRINT TO(5); 8950 FOR I=I TO 38*B3÷P3 8960 PRINT'"; 897O HEXT I 898O PRINT B990 IF A9=3 THEN PRINI TAB(5);'(PRE-EXISTINB SNIPLES ONLY)' 9000 PRINT 9010 PRINT 9020 60SU$ 20500 9030 PRIm 9O4O PRINT

9060 I=I 9070 PRINT T~(5);'SAIIPLE: ';N$(1) 9080 Jl:I 9090 J=Jl 9100 A$='W' 9110 PRINT C;TQi5)iO~(J)iT@(ll); 9120 l#em ks 9130 IF A~O'#' THEN 9160 9140 IK I~ JHI)'M5 9150 601"0 9330 9160 IF MO'C' THEN 9300 9170 IF COl THEN 9220 9180 PRINT 9190 PRINT CHR~(7);'ILLEB~L INPUT' 92OO PRINT 9210 60TO 9100 9215 IB L i r a ~ ) - 9 2 ~ : establishes ~ e n t r v point when erro~ declmN b~ user ~ 0 60SUJ 1770O

C-M 9240 I=rJ(T ((1~-1)/li5)~1 9250 J I~ - ( I -1 )U5 9260 PRI#T 9270 PRINT'RE-INPUT ~TA STkRTIN6 WITH 6MPLE ';NS(I) 9"280 PRINT 92~0 80TO 90~ 9300 ~ 18100 9310 IF P4=l THEN 9100 9320 I)(I,JH~)mi)~IA$) 9330 C=C÷I 9340 J=J~I 9350 IF J=al~ THEN ~100 9360 PRINT 9370 PRINT 9380 I=I~I 9390 IF I=.~r~ THEN 9070 9395 ~ Lines 9400-9420: app~ds ~k~it io~l parameters to 0~(I) a r rn 9400 FOR Z=! TO 9410 0~( I~) '0%(I ) 9420 NEXT I 9430 Na,N÷N5 9440 IF A9=I THEN 4300 9445 REIi Lines 9450-I0i00: routine for ineuttins data value~ and lobels for 9446 REH a~dition~l sables 9450 PRINT 9460 PRINT 9470 IF A9=3 THEN PRINT'2)';TAI~(5); 9480 PRINT'ADDITION OF ' ;Dl$; ' 9RLUES ~ LABELS FOR ADBITIONAL SN@'I.E$' 9485 REM L3 - .$ed in 'DATIIISTR ° sub-~u~ine (line~ 20500-20530)

9490 L3=l 949~ REM Z - used in line 10140 to determine ~hether ~reviousl~ undecl~red

303

Page 20: GEOFILE: an interactive program in basic for creating and editing data files

304 A. D. M. OtmwSLL and C. O. ToPLzY

9496 ATE labels have been added to f i l e 950Q Z=N1 9510 IF ~=3 TH(N PRINT TAB(5); 9520 F~ I=1 TO 53÷B3 9530 PRINT'-' ; 9540 NEXT ! 9~0 f l t I ln 9560 MtINT

~INT 95~ ~INT 9604 C=1 9610 1,1 %20 PRINT TA|(5);'SNt~LE: ';S~t(I) 9630 Jl, l 9635 R81 Lines 9640-9840: routine for in~t t i ra ~to values 9 ~ J=J1 9650 ~*N" 9660 PRINT C;T~(5) ;05(J);T~(11) ; 9670 I#PUT AS 9680 IF AtO'H' 110 9710 9690 0(I4'W2, J).'e~5 9700 6011) 9710 IF A$<>'C' THEN 9790 97~ IF COl THEN 9770 9730 PRINT 9?40 PRINT CWRS{I);'ILLES~L INMIT' 975O PRINT 9760 gOTO 9650 9770 ~ 17700 9790 60TO I0030 9790 GO~NI 19100 980O IF V4=I TEN 965O 9810 D(I~,J)--Q~¢AS)

C-Ctl J=J+l

9840 IF J=<# THEN 9650 ~ Lines 9850-9970: input md validation of sa~le label

9850 C$='N' 9860 I~ I~ C;T~(5);'LAEEL FOR SAtl~E ';S95(I); 9870 IIIMJT C$

IF Ciz,C, THEH 9770 9890 IF C$<>'N' T~N 99O0 ~( IfN2)--F55 9910 GOTO 9970 9920 (~SUD 15500 99~0 IF (]:<F5 THEN 994O 99@ SOSUB 21~00

IF (:8=I THEN 9850 9960 ~) ( I~2)~$ 9970 CzC+I 9990 PRIIIT

~INT 10000 l=If l I~I0 IF I=(N7 THEN 9620 1~0 ~TO I0100 10025 RE~ Lines lOOZO=lO090: establi~h~ re-~mtr~ eoint w~n error decl~red 10026 ~ b~ user 100~0 C--M 10040 I=INT((II-I)I(II~I))÷I 10450 JI~-(I-I)S(IH1) I W M~IWT'~E-IWMIT DATA ST~TIiS WITH S ~ ';Sg~(1) 10070 ~IXT 10400 IF JI<IHI THEN 9640

10095 ~ Lines 10100-10120" m additional sN~le numbers to Hi(1) arraw 10100 FOR Izl TO N7 10110 18(I÷N2)sSV$(1) 10120 NEXT I

Page 21: GEOFILE: an interactive program in basic for creating and editing data files

GEOFILE: An interactive program in BASIC for creatiag and cditiag data fries

10130 N2,,N244~7 10140 IF ZaHI THEN 4300 IOISO PRINT 10160 PRINT 10170 PRINT 10180 PRINT'~ITION&L LklEI.S HAVE IEEN 9 E ~ ' 10190 PRINT 10200 _~La~ 22900 10210 60TO 4300

10230 1 8 Lines 10400-10680: rootine fop re-snecifvin~ ~mele trees eoPreseondir~ 10231 ~ go ~ l a r e d labels 10400 PRINT 10410 PRINT 10420 PRINT'IEHFIMITION OF SklIPLE TYPES' 10430 FOR I=1 TO 28 10440 PRINT'-'; 10450 #E~ I 1O46O PRINT 10470 PRINT 104~ PRINT'THIS ROUTINE PEIIHITS ALTERATION OF SAMPLE TYPES CORIESPOnlN6 TO' 10490 PRINT'BECL~.D L~IELS' IOWO __l~p_ m 1520Q 10S10 IF k$='#' THEN 4300 10520 IF N1>-1 THEN I0590 10530 PRINT CHI~(7)I'Jli.L LJ~ELS ARE DEFW.T LkiELS' 10540 PRINT'NO ~ I N 6 S~PLE TYPES C~ ~ DECLkI~' 10'~0 PRINT 10560 PRINT'TOU ARE BEIN6 ~ TO THE EDITI#6 OPTIONS' 105"70 80SUB 2~300 1058O 60TO 430~ IOZWO Czl 10600 PRINT 10610 PRINT 10620 PRINT'WeE IN ~ ~ I N 6 TO SalgR.E TYPE TO ~ ~H~6~' 10630 PRINT E55~' TO TERIIINATE II~' I0~40 PRINT IOgW FOR I=I TO N1 10660 PRINT L$(1);TA~(5);S$(I) 10670 NEXT I 10680 PRINT I0~90 II~T'SPECIFY L~L OF S~ TYPE TO BE CHA~'IA$ 10700 IF A$O'E' THEN 10740 10710 IF C>1 THEN 4300 10720 __mP_2~ 236OO 10730 ON X~ OUTO 4300,10620 10740 PRINT 10750 PRINT 10755 RE~ Lines 107~0-10r20: checks t3mt label ~ i f i e d exists in L$(I) arP~ 10760 I=1 10770 IF At=L$(I) THEN 10830 10780 I=I+1 10790 IF I=,Oll THE# 1077,0 10900 PRINT 10810 PRINT CHI~(7);'LkliEL DOES NOT EXIST' 10620 60TO 10640 10830 PRINT 10040 PRINT'RE-SPECIFY SNIPLE TYPE ~SPONOINO TO LA)EL ';CHI~(34);A$;CII~(34);' I0~50 INPUT S$(I) 1O136O C~÷I 10870 60TO 10400 I0880 R £ I ~ I ~ ~ ~ . . ~ T ~ ~ + ~ i ~ i i ~ ~ I0~0 ~ Lines II000-12~0: routine for alterin~ existi~ ~at~ items on Pile 11000 PRINT 11010 PRINT 11020 PRINT 11030 PRINT'~TA FILE HODIFI~TION' 11040 FOR I=1 TO 22 11050 PRINT'-' ;

305

Page 22: GEOFILE: an interactive program in basic for creating and editing data files

306 A. D. M. Bueweu. and C. G. TO~LE

11060 NEXT I II070PRINT 110~0 PRINT 11090 PRINT 11100 PRINT'THIS ROUTINE IS FOR ~I.TERkTION OF EXISTIN6 DATA' 11110 PRINT 11120 PRINT'THE FOLLOWINO MY DE ALTERED: 11130 PRINT TM(31)i'SMPLE NUNIIERS' 11140 PRINT T~(31)I'.TaIIPI.E ~ S ° 11150 PRINT T~(31);~15; ° t~.UES' 11160 PRINT 11170 PRINT 11150 ~ _ : | 15200 II190 IF ~$z'N' ]HEN 4300 11195 112O0 112~ 11210 11215 11220 11230 11240 11250 11260 11270 11275 11276 11280 1129O 1134)0 11310 11320

11340 113~0 11~0 11370 1 1 ~ 1 1 ~ 11390 11400 11410 11420 11430 1144O 11450 11460 11470 1140O 11490 1150O

' ;P I t ; ' S~OLS'

RE]I L4 - beo~ws set to 1 i f i l ibel is c h ~ l ~ L4~O

PR - see lir, e 4215 IF Mlzl THEN 11270

E2 - see lines 425-426 E2.1 PRINT PRINT CH~(7);*SlNCE kLTERATIONS ~ 1SEN ~ TO DATA SINCE LAST LISTING IMS" I~INT'PImWC~3 A k~l PRINT.-OIJT NUST IE 6IUEN IEFORE E~ITI~ CAN PROCEED' MTO 2160 PR=O I~ l T - inc~mmted e~-h t i u e ¢hfta i t u wd i f i~ l , Used to detemine i f

ecmNf~rt n i t ~ f m t~is rou t i~ ( l i ~ s 113d~11380) TsO

PRINT PRINT ~ , o

T=Tf.I I~Pt~'SMECI~ ~t3HMU~RIC ClUE';At IF ~$O'E' TIEN I I~0 IF 1>1 110 1 9 0 _m~_~ 23~00 ON ~J 601"0 4300ei1320 REN Lines 11390-11890: routine for checkins val id i ty of ; l ~ r i c co~e L=LIEN(ki) IF l J l THEN 11440 PRINT PRINT CHI~(7);°CO~E INCOIIM.ETE' BOTO 11310 IF ~='AI ' THEN 11470 IF k~ '~ l " THEN 11470 60TO 11500 PRINT PRINT C~I~(7);'CI~E ';CHR~(~4);A$ICHR$(34);' NOT PE~IITTED' WTO 11310 IF k~C(kl)(65 THEN 11530

llSlO IF ~C(A$)>90 THEN 11530 11520 60TO 11560 11530 PRINT 11540 PRINT CHRS(7);'FIIGT CIMRACTER ?AJST ~E A LETTER' 11550 60TO 11310 1 1 ~ l i b Lines 11560-11610: 11560 L3=I 11570 ~C(N I~ (Mt2m l ) ) 11580 IF B(~ THEN 11610 115~ IF |>90 THEN 11610 11600 L~2 11605 IF L=2 THEN 11410 11610 ~I.E~$(ASeL3) 11615 ~ Lines 116,~)-117001 11620 Izi 11630 IF ~OY$(1) THEN 11660 11640 Agzl 11650 60TO 11710

assi~ms a lvh~et ic l l p l r t of code to v;riable B$

checks that el~hal~ticll vart of code is valid

Page 23: GEOFILE: an interactive program in basic for creating and editing data files

GEOHLE: An interactive program in BASIC for creating and editing data flies

11660 I=I÷1 11670 IF I=(N~2 THEN 11630 11680 PRINT 11690 PRINT CHR$(7);'~.PHUETICAL PART OF CODE INCORRECT' 11700 60TO 11310 11705 ~ Lines 11710-11930: routine for chect:irel valldit~ of numerical 11706 REN ~art of code 11710 I=L3÷I 11720 X=~C(MI~(A$t I,I)) 11730 IF I<>L3÷I THEN 11780 117~0 IF X048 THEN 11780 11750 PRINT 11760 PRINT CHR$(7);'FIRST NUHERIC CHARACTER CANNOT BE A ZERO' 11770 60TO 11310 11780 1F X<48 THEN 11810 11790 IF X>57 THE# 11810 11500 60TO 11870 11S10 PRINT 11820 PRINT CHR$(7);'ILLE6AL CHAR~TER IN NUHERI~L PART OF COPE' 11830 PRINT 11840 PRINT AS 11850 PRINT TAB(I- I ) ; ' " 11~0 60TO 11310 11970 I=I÷I llBBO IF I=<L THEN 11720 11890 N6=t/AL(RIOHT$(A$,L-L3) ) 11900 IF N6=<N2÷1 THEN 11940 11910 PRINT 11920 PRINT CHR$~7);'NIJ~ERICAL PART OF CODE INCORRECT' 11930 80TO 11310 11935 ~ Lines 11940-125b0: routinos for ch~szn9 •ata values, smels numbers, I19~ ~ smele labels an~ ~araleters 11940 Zl~-I II~50 TlmkS-2 I19@ IF A~I THE# 1209O 11970 IF IW=2 lNE# 12250 11980 IF N~I THEN 12410 " I191~ REll Lines i1990-12MJ0! ~outine for chanJin~ data value 11990 A$=?N* 12000 PRINT'HEW ';05(¥17;' W~.LIE FOR SAMPLE ';N$(X1);' = '~ 12010 INPUT AS 12020 IF A$<>'#' THEN 12050 12030 D(XhTl)--lt5 12040 60TO 11310 12050 61SU~ 18100 12060 IF P4=I THEN 11990 12070 ~(XI,YI)uSAL{A$) 12080 90TO 11310 12~5 REI~ Linos 12090-1~40; routino for charelin~ sample mmber 12090 #$=" 12100 I~INT'MilIPLE ~ TO REPL~E ';N$(X1);' : ' ; 12110 INPUT N$ 12120 __mS n3 1,5~0 12130 IF C8(4 TILE# 12090 12135 ~ Lines 12140-12220: checks that sample nulber does not alreod~ exist 12136 1 8 in #$(I) arras 12140 L=1 12150 IF L=X1 THEN 12210 12160 IF N$ON$(L) THEN 12210 12170 PRINT 12180 PRINT (]~R$(7);'~JqPI.E NINIIER ALREAPY EXISTS' 12190 PRINT 12200 GOTO 12090 12210 L:L÷I 12220 IF L=(~ THE# 12150 12230 NS(X1):N$ 12240 60TO 11310 12245 ~ Lines 12250-12400: routine for chansin~ saele l~bel 12247 REH L4 - see isne 11195

30?

Page 24: GEOFILE: an interactive program in basic for creating and editing data files

308 A. D. M. BURWELL arid C. G. TOPLE~

12250 k4=l 12260 C$='H' 12270 PRINT'~EV LABEL FOR S~PLE ' ;~$(Xl); ' : ' ; 12280 I#PUT C$ 12290 IF Ct='N' THEN 12340 12120 60SUB 1550O 12330 IF C8=<P5 THEN 12260 12340 60SUJ 22000 12350 IF C8=1 THEN 12260 12360 IF C$<>'N' THEN 12390 12370 MCX1)=FS$ 12380 60TO 11310 12390 ~(Xl)ffiC$ 12400 SOTO 11310 12405 IE~ Lines 12410-12560: r~u~ine fo r charelir~ v a r ~ t e r $~bols 12410 Ot='" 12420 PRINT PI$;' SYMBOL TO REPLACE ';O$(Y1)~' -" ' ; 12430 INPUT 05 12440 60SlB 20800 12450 IF ~4~I THEN 12410 124~ ~ Line~ 12460-12S40: cheeks that v a r ~ t e r does not a l r e ~ exist in 124~ IEN OS(I) arra~ 12460 k=l 12470 IF L=YI THEN 12530 12480 IF 0$<~$(L) THEN 12530 12490 PRINT 12500 PRINT CHR$(7);PI$;' ALREADY EXISTS' 12510 PRINT 12520 80TO 12410

• 12530 L=Lfl 12540 IF L=~ THEN 12470 12~00S(TI)=Ot 12'~0 60TO 11310 125"70 IF Nl,O THEN L4=.O 12~0 IF L4=O THEN 4300 12'~0 PRINT 126O0 PRim 12610 PRINT'NEti L.kliEL$ ~i/E E l l ~ IN TIlE FILE 1400IFICATION ROUTINE" 124~0 PRINT 12630 8MIDI 229~0 12640 WTO 4300

12660 R[]t Lines 12B00-132701 routine for savin~ data on f i le rod/or ~r~in~tin9 12661 ~ pro~r~ exe~ ion 12670 121100 PRINT 12810 PRINT 121120 PItlNT 12830 PRINT'I1E]E kRE #Oil THEE OPTIONS:' 12840 FOR I-'1 TO 28 121~0 PRINT'-'! 121160 NEXT I 12~/0 PRINT 121too PRINT 12890 PRINT'1 A~ORT THIS ROUTINE AND IETIJRN TO E~ITIN6 OPTIONS' 12900 PRINT'2 SAtE D;~TA ON OI~ FILEw tilTH SIJI~EGIJENT OPTION OF FURTHER L~ITING OF' 12910 PRINT' THESE MTA' 12920 PRINT'3 TERHIN~TE EXECUTION OF PROGRAM IJITHgUT S~/IN6 DATA ON FILE' 1293O PRINT 12940 PRINT 12950 At=" 129~0 INPUT'SPECIFY OPTION REOUIRED - ~ I, 2 OR 3 ' ; A $

12970 60SIB 18100 129110 IF V4=I THEN 12950 12990 X--~ALiA$) 13000 IF X<l THE# 13040 13010 IF X>3 TH~ 13040 13020 IF XC-INT(X) TH6q 13040 13030 ON X 08T0 4~00wI~140,I~070

Page 25: GEOFILE: an interactive program in basic for creating and editing data files

GEOFILE: An interactive program in BASIC for creating and editin8 data files

13040 PRINT 13050 PRINT CHRt(7);'~¥~MER h 2 OR 3' 13060 OOTO 121;00 13070 PRI#T 13O8O PRI#T 13090 PRINT CHR$(7);'THERE UILL BE HO rILE CONTAININ6 WORK ~ IXIRIN6 THE PRESEHT' 13100 PRINT'EXECUTION OF THIS PROGRAm' 13110 60SIB 15200 13120 IF ~$=°N' THEN 1280~ 13130 60TO 13240 13140 ~OSU~ 24500 13150 PRINT 13160 PRINT 13170 ~I~IT'~ATA FILE NO~ SAPED ~ R THE NAME ';CHR$(34);RI~HT$(At,LEN(A$)-2);CHR$(34); 13180 PRINT' ON ~RIVE ~' 13190 PRINT 13~ PRINT 13210 PRI~'A;~ I~E EDITI#6 TO DO ON THESE ~TA'; 1322O 60~J~ 169O0 13230 ON X5 ~OTO 4300,13240,1319~ 13240 PRINT 1325O PRINT 13260 ~IHT'FINI~O' 13270 STOP

309

U R 0 U TI 15110R~ 15111 15120 RE#

'IWUT' sob-~mJtine: ch~'ks that ~,,er has entered the editin~ routine he mints

t~ee PRim : ~ o PRim'is 1ms ne tee~m voe m~ To usE.; 15220 __~9__ TM- 16900 15230 IF X5-3 THEN 15200 IS240 PRINT 15250 PRINT 1~30 PRINT 15270 IETURN

15290 19 'LCHECI(' sub-~utine: theirs va l id i ty of label input 15300 REI I -~ 15310 ~ If 13=0"5 on retsrninJ free this routine, ~ error is identified and 15311 19 the label must be ~-ineut 15500 X5=I 15505 C~,I 15510 IF LE#(C$)<I THEN 15600 15520 X5=2 15530 IF LENIC$)>I THEN 15600 15540 X~3 15545 ~H L i ~ 15560-15500' cheeks ttmt label enta~d is not ~ forbidden label 15560 IF ASC(C$)=L3(CS) THEN 15600 1557O C!~C8+1 15580 IF C8=<F5 mEN 15560 155~0 RETURN 15595 REH Lines 15600"-15620: diselevs error messene on VOU 15600 PRINT 15610 PRINT CHR$(7);LIt(XS) 15620 PRI#T 15630 RETUR#

15~50 ~ 'f~tNCHECK' sub-routirm' cheoks validit.v of s ~ l e r~mber l n ~ t 15660 REI~- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15670 HEM I f C8<4 on reternin~ free this $ub-ro~Line, an e r r o r is detecteC and 15671 REH the sample number ~ust. be re-ir~ut 15900 C8=4

Page 26: GEOFILE: an interactive program in basic for creating and editing data files

310 A. D. M. BURWeLL and C. G. TO~LP,,

15920 LT=LEN(N$) 15930 IF LT~=I THEN 159~0 15940 C8-1 18~e~O 6013 I~05Q 159~0 IF L7=<9 THEle RETURN 15970 C~2 1/~)4~ I ~ Lines N~50-1~070: ~rints error m r ~ m on YOU 1~0~0 PRINT N4~O I~IIIT CHRt(7)IEI$(CS) 1~070 ~INT 14400

16100 I ~ 'F~E]WlE' s~b-~utine: Sires a director~ of fi les on disk and checks 16101 Ell ~ i i d i t v of i ~ f i l e 16110 ~ . . . . . . . . . . . 16300 PRINT 16310 PRINT 16320 M~IIT 16330 M~INT'IS 9 I ~ VI~4 ~T~ FILE IN ~ I t ~ B'; 16340 ~ 16900 I ~ ON X5 6013 16400d~I~Od~20 16360 M~I~" 16370 PRINT 16380 M~IJ~'M.~ DIS~ IN ~ I t ~ B' I ~ __nOp_eJ 23OO

16373 RBI I I ~ is a ~ o~mond - ~-init ial ises CP~ d i~ diet~tor~ information 1644O ~ERT 16405 I ~ Lines 16410-16470; diselass disk dir~tor~ on tgU 16410 PRINT 16420 MIIIIT 16430 P~INT'~IS1I~ MTk ~II_rS OR PIS~ B ~ : "

.16440 PRINT 1~50 FILES'~:$.$" 16460 PRINT 16470 ~ I ~ 16490 PRINT'T~ FILBWE OF ~tA FILE TO RE ';FIS(F'2); 16490 #r~ *° 165OO INPUT At 16510 IF LEII(~$)>=I HEN 16550 16520 PRINT I~530 PRINT CHRt(7);°NO F I ~ INPUT' 16540 ~013 16430 16~50 IF 1 ~ ( ~ ) , ( 8 THEN 16590 N~%0 PRINT 16570 ;~lWr CXR~(7);'FILEI#~ 130 LO~6' 16~0 60TO 16470 1 6 , t ~ ' P ' befo~ f i l e reee indicates to CP/M o~ret ins svsto~ that f i l e 'is 16,58~ RE]t to be re~l/saeved on disk in drive B

166OO

1~20 ~ 'Y1ESORNO' sub-Poutine: checks that ans4,er 'Y' o~ 'N" is ~iven 1 ~ 0 REJ~ 16640 ~ On rotomin~ f~o~ this sub-routine, X5 is 1 i f 'Y" ~ns~ered~ 2 i f 'H' 16641 ; ~ m e n d or 3 i f neither 'Y' or 'N ° 16900 k$='* 16910 16920 16930 16940 16950 16960 16970 16900 16990 17000 17010 li~ 17020 II~ 17040 ITEM.

INPUT' - ~ Y(~S) OR N(I~)';At X~I IF AS='Y' ~ X5-2 IF A~,'N' THEN RETURN X~3 M~INT Mtll~ ~ ( 7 ) ; ° ~ S l E R Y OR N ° ~rNRN

' i ~ 1 ' r~-rout ine: us~ vh~m input e r r o r is d~ l i red b~ user in ~armeter md seule number addition/deletion routines

Page 27: GEOFILE: an interactive program in basic for creating and editing data files

GEOFILE: An interactive program in BASIC for creating and editing data files

17300 IF I01 THEN 17340 17305 REM Lines 17310-17330: error me$$ale when 'C' ineut aSainst f i rs t eermmter 17310 PRINT 17320 PRINT CHR$(7);'ILLEDAL INPUT' 17330 RETUAW 17340 PRINT 17345 REM Lines 17350-17480: irm~ ar~ validation of code number of erroneous item 17350 At=' ' 17360 IIIflJT'CIBE NIJMER OF I ~ C T I#PUT';AS 17370 OOSUB 18100 17380 IF P4=I THEN 17350 17390 J--WJ.(A$~ 17400 IF |NT(J).'.'..J THEN 17450 17410 IF J ' l THEN 17450 17429 IF J>=l THEN 17450 17430 I=J 17440 RETLmN 17450 PRIIqT 17460 PRINT CHItt(7);'CODE NUI~R OF I ~ C T INPUT SHOULP ~ AM INTESER BETWEEN 1 ~ * ; I - 1 17470 PRINT 17480 SOTO 17340 17490 IE .K i~ t I~ .; _;~,_;~ t i t ~ t t t l l l l m $ l l r l l ~ l n ~ i ~ i ~ n 17500 REN 'IERR(~' sub-I'outine: use(] when input, error is declared by user in 17510 REM routines ~ dat~ values e~e idded to f i le 17~29 REIT- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177O0 PRINT 17705 REM Lines 17710-17880: input a~ validation of code number of erroneous itn 17710 AS=,, 177"20 It~UT'CODE NUIT~ OF I ~ . C T INPUT';R$ 17730 BOSUB 18100 17740 If P4=1 THEN 17710 17750 #z471kL (AS) 17760 IF INT(#)<>M THEN 17810 17770 IF I~1 THEN 17810 17780 IF M)=C THEN 17810 177~0 IF C-IqY,~O THEN 17840 1780O RETL~ 17810 PAlm 17820 PRINT,CHRI(7);'CO)E NUM~'R OF INCORRECT INI~JT SHOIJLD BE AM INTEBER ~rTiEEM I I';C-1 17830 OOTO 17700 17835 REM Lines 17840-17880; If difference hett, Hn ielecified code number of 17836 REM incorrect item ~J cur~nt code miber is >29, check is ~ t l~ t 17837 ~M code neiber of incorrect itam his been ts~ed correctls (see 17838 AEM line 17790) 17840 PRINT 17850 PRINT'CHECI( THAT COPE NUI~ER 18 CORRECT'; 17860 60SUB 16900 17870 ON X5 ~TO 17880,17700,17840 17U0 RETUR# 171;90 R E ~ m t t t t t t t t t t i t ~ k ~ ~ ~ t ~ k ~ t ~ t _ ~ ¢ 17~0 I ~ 'NIINCHE~' sub-routine: cheeks vmlidit~ of i n~ t numeric itam 17~10 I ~ 17920 IE~ An~ .mmeric value input in ~ i n bed~ of erolr~t is in i t iml lv mssim~J 17V21 REM to variable At, In this sub-routine, contents of At exnined 17922 RE# chlr~r ~ eh~r|cter for ~tcc~ttble characters. 17923 ~II LIn~-e~teble eMtmcte~s eesult in error lesilele. Ualue of P4 (1107 17924 RElq on ~etu~ to lain ermlrem in~ieat~ error/no error conditior, 181O0 ~4=I 18110 LS=LEN(AS) 18120 IF L5~=1 THEN 18170 18130 PRINT 18140 PRltll CHRt(7);'NO DATA ENTERES* 18150 PRINT*ENTER A ~LUE' 181~0 GOTO 1828O 181~5 REM Lines 18170-18410; ex~tines each character of At in turn 18170 C3=0 1818O J3=1 18190 A=4tSC(MIPt (AS, J3,1) ) 182O0 II r J3>I THEN 18220

311

Page 28: GEOFILE: an interactive program in basic for creating and editing data files

312 A. D. M. BL'RWH.L and C. O. Toet.~

18210 IF A=45 THEN 1~0~ irE20 IF ~K>46 THEN 18300 1823O C3=C~H 18240 IF C3=1 THEN 18400 18"250 PRINT I@~0 PRINT CHR$(I);'TWO ~CIM. POINTS ENTEREB' 18270 PRINT'RE-ENTER A VALUE' 18280 PRINT 1829O RETUON 18300 IF A<4~ THEW 18330 18310 IF A>57 THEN 1~30 18320 60TO 18400 18330 PRINT 18340 PRINT CHI~(7);'ILLEGAI. (NON-1~IERIC) CHARACTER ENTEREI)' 183~0 PRINT 18,1W)0 PRINT AS 18370 PRINT TA~(J3-1); '~' 18380 PRINT 1839O 60TO 1828O 1840¢ J~J3+l 18410 IF J3z<L~ THEN 18190 1842O V4=O 18430 RETURN 18440 I ~ E l ~ $ $ 1 ~ I ~ i ~ k ~ $ $ I ~ ~ $ $ I U ~ ; ~ 1 ~ 0 RE]! 'FILINSTR' sub-routine, Jgve$ hard e~w vrlnt-o~t of instructions for 1~151 RFJ! creetins ~ t i l e 1846O 18700 18710 18720 18730 18740 187~0 187~0 1877O 1878O 187~0 U~IIIT 1MOQ LI~INT 18810 LPRINT 18820 I.~INT' IM30 L~INT 18840 LPflINT' .18~0 LPRINT 18860 LPRINT' 1MPO LPRINT 18880 LPRINT 1 ~ 0 LPRINT 18900 LPRIHT' NOTES ~ 18710 LPRINT' . . . . . . 18920 LPRINT 18930 L~INT 18940 LPRIHT 18950 LPRINT'A) 18%0 LPRINT 1~70 LPRINT'B) 18980 LPRINT' 1899O LPRINT 17000 LJ~INT'C) 19010 L~INT' 1~02O U~INT' 19030 LPRIIIT' I?040 LPRINT 19050 LPRINT'D) I~0~0 LPRINT' 19070 LPRINT' 190~ LPRINT' 170~0 LPRINT' I?I00 LPRINT' 19110 LPRINT'

PRINT PRINT PRINT PRINT'DO YOU WANT A PRINT-OUT OF IWSTRUCTIONS FOR DATA FILE CRF.~TION?' BOSlJI I~t0¢ ON X5 60TO 187~0,19'270,1872O LPRINT CHR$(12) LPRINT L~INT'IN THE FILE CREATION ROUTIHE~ THERE ARE THREE PARTS:'

1) SPECIFICATION OF THE ' ;PI$; ' SYIQOLS'

2) l)@lff OF SAMPLE NUItlER - ';DIS;' VALUES - SAMPLE LAREL'

Z) SI~CIFICATIO#! OF ~IIPLE TYPES CORRE~ONOINO TO LAREI.B USED IN 2)'

WHEN ALL DATA 14~ BEEN INPUT IN PARTS I) $ 2) TYPE ' ; ~ $ i ' . '

EACH I~gT PROMPT WILL BE PRECE~ BY k ~ , E.G. 34 SI02?' THE I~REI~ ~ USED IN E I ~ CORRECTION (SEE IELOW).'

IF YOU IDENTIFY AN IrWUT E I ~ , TYPE ';C55;'. ° YOU WILL THEN liE kSI(ED TO GIVE THE ~IISER OF THE INCORRECT INPUT,' (E.6. 34 IN THE CASE ABOVE),' YOU HUST THEN INPUT THE CORRECT V~.UE AND ALL FOLLOWINO DATA,'

SAMPLE L~ELS (SEE PUT 2 ABO~) ARE SINGLE ~LPHANU~RIC CHARACTERS,' THEY ARE USED TO DISTINOIJISH DIFFERENT SAMPLE TYPES, E,G° Itl GRAPHS, ' IF YOU DO NOT WANT TO SPECIFY A LABEL FOR A FARTICLL~ SAMPLE,' SIMPLY ';D25;' WHEN GIVEN THE LAHEL PRONPTo' THE SANPLE LABEL MILL THEN ~TOMTICALLY BECO~ A ';F55;' , ' N,Bt THE FOLLOWING MAY NOT BE USED AS LAi~I.S - '

Page 29: GEOFILE: an interactive program in basic for creating and editing data files

GEOFILE: An interactive program in BASIC for creating and editing data files

19120 FOR l=l TO F5÷2 19130 LPRIm ~(~);~$(L3(1));~$(~);' '; 19140 NEXT I 19150 LPRINT 19160 LPRINT 19170 LPRINT'E) IF NO ";DIS;' DATA EXIST FOR A PARTICULAR ' ;PI$; ' IN A' 19180 LPRINT' PARTICLq.AR 5A~I.E, SINPLY ' ;825; ' . ' 19190 LPRINT 19200 LPRINT'F) NOTE: ANY ERRORS NOT COllECTED DURINO INPUT CAN DE COI~,ECTED LATER" 19210 LPRINT' DLIRINO EDITINO.' 1922O LPRINT CHR$(128 19230 PRINT 19240 PRINT°~ OUTPUT F--KUI~ PRINTER' 19250 PRINT 19260 __mP__n3 23300 19270 RETURN

19290 ~ 'EDOPTIOfl' sub-~outine: d is t la~ oetions ~ai lable in editinS tart 19~I REII of pro~rM on PDU 19300 RE~ 1951B PRINT'Y~ #tie NOW IN TIE FILE EDITING PART OF THE ~ ' 1~10 PRINT'~ ~ITI~ OFFI~ ~ LISTED DEI.OW, THEY NAY DE E ~ IN ANT ORDER,' 19520 PRINT 19530 PRINT'O ';P15; ° S~NI.S DELETION (RESULTINO IN LOSS OF ALL DATA FOR' 19540 PRINT' ";P15;'(S) SPECIFIED)' 1~50 PRIm 1 ~ PRINT'S ~PLE ~ DELETION (~TINO IN LOSS OF ~ DATA FOR ~(S)' I~0 PRINT' ~IFI~' I~ PRIm 19590 PRINT'A ~ITI~ OF ';P15;' SVI@OLS ~/OR ~ ~ (~IRINO' 19600 PRINT' INPUT OF ~ITIO#¢~. ';815;' ~ ~ ~IKY ~Z$)' 19610 PRINT 19~ PRINT'R RE~EFII~ION OF ~ T~E(S) 6IHEN AT ~I"F~ OF PRINT-OUT OF FILE' IW~O PRINT 19640 ~NT'II ~IFI~TIOII OF ~Ik TO ~ ~ TO ~ ~ TO ~ISTI~ ~ ' 19650 PRINT' I I ~ LNELS, ';PI$;" SYlIOL$ NID ';DIS;' VALUES' 19660 PRINT 19670 PRINT'F FINISIb l,E. NO (~114E]~) ~TI~ - DATA ~Y ~ ~ ~ ON* IWd~O PRINT" DIS~ FIIE' 19~ ~ Li~ 19690-19710: If l;st erint~ is not up to ~ (~), 19686 ~ erovidn 'P° (trint-~t) ~im 19690 IF ~ THEN 19720 1920~ PRINT 19710 PRINT'P PRINT-OUT OF CURRENT DATA' 197"20 RETURN 19730 R E ~ . _mm..'P~. _ ÷-- - - -- - ~#~. - . - .~ -~ -~ ~ ~ ~ i ~ e ~ e ~ 19740 REll '~O|l~S~' sub-eoutin~: distl~s instructions on P~ foe m4if~in~ 19741 ~ existin~ item o~ d;t~ file 19750 IE~ 200~ PRINT 20010 PRINT

PRINT'~IFI~TI~ OF WHICH DATA TO ALTER IS l~I~ 8Y AL~RIC ~ S ' 20030 PRINT 20040 PRINT'OIl THE PRINT-OUT OF DATA, ROILS I~E ALPHA]ETIC CODES (A,8,C...) ~ ' 20050 PRINT'COUJNNS ~ ~ I C CODES ( h 2 , 3 . . . ) ' 20060 PRINT 20070 PRINT'THIJSt TO ALTER ' ;P i t ; ' SYI~OLS, USE CO~E$ SUCH AS CI~81JEI...' 200~ PRINT TAB(7);'TO ALTEI| ~ NUN]IEKS~ USE CO~ES SUCH AS A2~,A3~k4...' 20090 PRINT T~(7);'TO ALTER ~,MPLE LNIELS~ U~E CO~ES SUCH kS 82,83~4.., ' 20100 PRINT TA~(T);'TO ALTER ';DIS;' ~I.UES, U~ CODES SUCH AS C2,93~E4..,' 20110 PRINT 20120 PRINT'NOTE TII~T THE ALPflAIk~ICAL CI~RACTEI~ 191ST DE SPECIFIED BEFORE THE' 20130 PRINT'NUHERICAL CIMIMCTEI~' 20140 PRINT 20150 PRINT'IN THE FOLLOWINO K~LITIIE, SPECIFY THE A L ~ I C CODES OF EACH ITEM TO' 20160 PRINT'DE CORRECTED' 20170 PRINT 20180 PRIm'RENEII8ER: ';ES$;'TO TERIIIIMTE INPUT' 20190 PRINT TAB(11);~; ' WHERE NO W~LUE BETERNIN~8'

313

Page 30: GEOFILE: an interactive program in basic for creating and editing data files

314

2020~ 20210 2022O 2O23O 2O240 2O241 2O25O 20'J00 2O51O 20'J20 2O53O 20S40 2 0 ~ 2 0 ~ 2 0 ~ 20571 2 0 ~ 2OO10 20~0 2O83O 20e40 2O15O 2 0 ~ 20e70 20~0

20900 20910 2O92O 20930 2O94O 2O941 2O942 209'J0 21200 21210 21220 2123O 21240 212~0 21260 21270 2128O 212~0 21300 21310 21320 21330 21331 21340 21600 2160~ 21606 21610 21620 21~W 2164O 21645 21646 216~0 216,~ 21656 2166O 21670 2168O 21685 21690 21700 21710

A. D. M. BUeWeLL and C. O. TOPLEY

PRINT TAN(II);~2$;" FOR DEF@~LT LABEL' PRINT RETURN

I ~ 'DATINSTR' mb-ro~tine: instr~:tions for error correction, and for REH obtainiml default labels and 'not determined' c~ta vmlues

PRINT'I# TNE F U I N S ROUTINE: ';C551' FOR ERROR CORRECTION' PRINT TA~(27)l~2t;' tM~E #0 WlUE ~ETERIIINED' IF L3=I THE~ PRINT TANi27);BI' FOR DEFAULT LADEL (';F551')' fltTUR#

I ~ '$YIICHE~' sub-roqtirm: checks validity of e e r m t e r sv~0ols entered RB~ REIt ~elue of V4 (l/O) indicates error/no error condition on return to i~in

ero~rN L=LE#(O$) IF LY=I THEN 20~0 PRINT PRINT CJIR$(7);'#O ';P1$~' ~ ENTERED' 80TO 20~0 IF L-(~ TREN 20910 PRINT PRINT CHI~(7);PI$;' SYMBOL STRI~6 TOO LONG (>? CHaRaCTERS)" PRINT V4=1

RETURN

B 'FILE~EI.' ~utino: entornd from routines for ~eletird s t o l e s / 1 8 emrmters when ell smles /veraNters hew ~ i n ~ r t o n t l v

~INT ~INT PRINT PRINT CHR$(7)I'YOU HAIR SPECIFIi~ TIE OELETION OF ALL DATA FROll THE FILE' ~I#T PRINT'TIIIS IS PI~MiILY AN ERROR ON YOUR PART!' PRINT'IiOE OF THE DELETIONS YOU HJ~E JUST SPECIFIED WILL UE ~CTED ON' PRINT'YOU WILL 8E NETURNE$ TO TI~ SELECTION OF EDITIN6 OPTIONS' PRINT PRINT 60SOB ~'rJ300 60TO 4300

RE# 'LAIELAPD' sub-routine: m ~ from ~ t i n e s for addir~ lobels to file. A~mcis new labels to Lt(I) mr~n if necessar~

. . . . . . . . . . . . . . . . . . . . . . . . . . N . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

IF Nl(l THE# 21660 I B Lines 21610-21~0~ checks whether label setN:ified a l ~ d ~ exists in I ~ Lt(1) ~rrav C~1 IF Ct, Lt(~) THEN 21690 C8sC8+1 IF CS=<N1 THEN 21620 ItEM Line 21650: If rmber of different labels ~revio~sl~ on file ec~als

maximum n~ber mllo~4~ Jumes to error routine IF H1=#3 THEN 22600 REIt Lines 21660-21700: odds nw label to i t ( I ) arre~. ' i ' in 5$(I) a r m

used s~ee~4mtlu to indicate that s~ele t ~ e must be svecified NI=NI+I Lt(WI)=Ct S$(N1)=" ! ' I ~ ~ set to 2 to indicate no error c~r~ition on return to ~ i n erogram ~ 2

Page 31: GEOFILE: an interactive program in basic for creating and editing data files

21720 RE~ 21721 ~]~ 21730 I1~ 22O0O 22010 22015 22016 22020 22030 22O40 22O5O 22O6O 22070 IF J=Xl THEN 22090

GEOFILE: An interactive progrmn in BASIC for creating and edi~ng data files

'LA~CHEC~' sub-r~tine: .ccisr,~ fro~ f i l e modification routine ~ r label ~ 9 e ~ . Chimes L$(I) m r r ~ . i~,e~oeri~4~

IF IU<I THEN 22170 IF I~(Xl).T~ THEN 22170

Lines ~20-221~I checks vhe~her altoretion of e~e-existir~ label REH (~(Xl)) ~ coe~letolv ~move~ this lmbel from the f i l e 1-1 IF ~(XI),L$(I) THEM 22060 I:I+1 SOTO 22030 J=l

22080 IF LI ( I )~ t (J ) THEN 22170 22090 J=J+l 22100 IF J-<N2 THEN 2207O 22105 REH Lines 22110-22160: 22106 ItEM nov ~efunct l~bel 22110 IF I-N1 THEN 22160 22120 FOR J,I TO NI-I 22130 LI(J)=L$(J÷I) 22140 S$(J)--t"t (~1) 22150 NEXT J 221~ NI#I-I 22170 IF Ct='N' TIEN 22270

re-aftra L$(I) end St(I) errmm to delete

22180 IF NI<I THEN 22240 22185 REH Lines 22190-22220: checks ~t3~r ~mlmment ld)el alreid~ exists 22186 ~ on d~ta f i l e 2219O J=l 22200 IF L$(J)=C$ THEN 22270 22210 ,J=,HI ~ o xF ~ l T.~~Z~O-- 2222~ I ~ Line 22230: see lines 2164~-21(~ 22230 IF Nl~I(3 THEN 22600 22235 REN Lines 22240-222~0: m lines 216,55-21656 22240 N1-N1÷1 22250 L$(1tl)=C$ 222b0 S$(N1 )=' ! ' 22270 1:8=2 222M RETURN

22300 RE~ 'tJ~kF(~' routine: extamsion of U~CHE~ ~b-eo~ine (Line 22000) m~% 22301 ItEM L#~LCkD) $~b-~ootine (Line 21600). Prints error m ~U i f mtt4m~ 22302 I ~ Nde to exee~ NximMm n ~ r of diffeMmt lmbel$ e l lo~ble on f i l e 22310 22600 PRINT 22610 PRINT CHI~(7)iI(~I;' ) IFFEI~ LItlI~S NON [ I I ~ IN THE DATA FILE' 22~0 PRINT'OI@,.Y ' IN3;' DIFFERENT L~ELS ARE ALLOMED' 22630 PRINT 22640 PRINT'RE-INPUT LABEL USIN60N£ OF YOOR PREPlO~LY ~ECLkREP LAB~.S' 22650 PRINT 22~ RBI C8 se¢ to I to indice~ error condition on ~rn to main Pro~rne 2266O C~I 22670 RETURN

22~N I ~ "S~TYPE" ~b-mut ine: )~o~ts in~ut of ~ l e tsmes co)~es~Jin~ 22691 RE~ to ~ecentl~ declmrewJ labels 2220~ RE~ 22~00 PRINT'SPECIFT ~ TYPES C~:Poi~IN6 TO kkl~.S ~ IN ROUTINE kllO~' 22910 PRINT'(N.B: ~ I ~ L Y DECLMED LkREL$ CNt !~ ALTERED ~ US[' 2 ~ PRINT' OF THE ~ITIN6 ROUTINE LATER)' 22?30 PRINT 22940 PRIN~ 22950 PRINT 22%0 F~ I=1 TO N1

22990 PRINT'~ TYPE ~ I N 6 TO LAJEL 'H:HRt(34)IL$(I);CHRI(34);' = 22~) INMIT St(1) 23000 HEXT I

CAGEO Vol. 8, No, 3-.,/.--F

315

Page 32: GEOFILE: an interactive program in basic for creating and editing data files

316

23010 23020 23030 23040 23300 23310 23320 23330 23340 23350

2~70 23371 19 2,~80 I~O~

A. D. M. BUnW~LL and C. G. TOPL~Y

I ~ 'YIETURN' sub-Poutine: empJ~s Y is Pressed at ke~ard R ~ * ~ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

I~INT M I l l | I

INPUT'I~ESS T(RETORN) iMEN READY TO CONTIIAIE';A$ IF ~$~'Y' TH~ RETURN PRINT CHR$(7) ~TO 23300

ItEIt °JUIIP(AIT' sub-routine: ~-cesud .hen vma~re exit made from f i l e creation or f i l e editin~ routine

23600 PRINT 2~10 PRINT 2~20 PRINT CHI~(7)I'YOU ~ JUIF~ OUT Of THIS I~U'[II( PRE3~TUI~E].Y' 2362~ ~ F2.--O only in f i le creation Part of Program 2~)30 IF F2-O THEN 23670

PRINT'IS THIS CO~ZCT'; 2365O SOS~ 169OO 23/~0 ON )(5 60TO 23710,2,1670,2)600 2~70 PRINT 23~ ~ B74 - see line 600

~INT )75 2~90 PRINT

PRINT 23710 RETURN

23730 ~ 'FILER~D' sub-~outine: reads data file from disk. Uses OP~ 23731 ~ eo~mds. INMIT t l coma~J reds individ~l data item 23740 24000 m 16300 24010 OPEN'I',I,A$ 24020 INI~ t l ,N 24030 FOR I=1 TO # 24040 INPUT t l ,01( I ) 2e~O ~EXT I 24060 INMJT tl,Hl 24070 IF #I<I THEN 24120 240eOFOR I:I TO N1 24090 INPUT t l ,L$(I) 24100 24110 24120 24130 .24140 24150 24160 24170 24180 241~ 24200 24210 24220 2423O 24231 24240 24500 24510 24520 24~30 2454O 24550 24560 24570 24580 24590 24600

INPUT tl,S$(1) #EXT I I#PUT tI,N2 FOR I=I TO M2 INPUT $I,~(I) I#IMJT fl,~(1) FOR J=I TO N INPUT #hO(l,J) #E](T J NEIT I CLOSE i RETURN

I Q 'FILESA~' s~b-~t ine: saves data f i l e on disk. PRINT t l comklnd REII . r i t es iodividual data items

60SUI 163OO OPE#'O', 1,AS PRINT tl ,N FOR I=1 TO N PRINT t1,0$(I) NEXT I PRI#T 41,Hl IF ~ll/,l THEN 246~ FOR I:I TO ,~I PRIHT t l ,L$(I) PRINT thSSfl)

Page 33: GEOFILE: an interactive program in basic for creating and editing data files

GEOHLE: An interactive program in BASIC for creating and editing data flies

24610 NEXT I 24620 PRINT 41,N? 24630 FOR I=l TO ~2 24640 P~INT tl,~;I, 24650 PRINT thM$(1) 24660 FOE J=l TO 24670 PRINT H,II~I,J~ 24680 NEXT J 24690 NEXT I 24700 CLOSE 1 24710 RETURN

317

~ l X 2

Description of program structure The structure of the program will be descn~..d in terms of the

main functional blocks and the associated subroutines.

Main functional blocks

Dimension statements, variable assignments, data statements. (270-760)

subroutines accessed: none

Determination of source offlie, either keyboardorexistingflle on disk. (770--1010)

subroutines accessed: YRETURN FILEREAD

File creation from keyboard. (1) Input of parameter symbols.

(1020-1630) subroutines accessed: FILINSTR

SYMCHECK IERROR1 JUMPOUT

(2) Input of sample number--data values.sample label. (1635-2510)

subrontines accessed: IERROR2 SAMCHECK NUMCHECK LCHECK LABELADD JUMPOUT

(3) Specification of sample types corresponding to labels declared.

(2515-2640) subroutines accessed:' SAMTYPE

Hard copy print-out of file. (265O.4O70)

subroutines accessed: YESORNO

Selection of editing option. (408O-447O)

subroutines accessed: EDOPTION

Editing options. (1) Deletion of parameters.

(4480-5340) subroutines accessed: ROUT

IERRORI FILEDEL YRETURN JUMPOUT

(2) Deletion of samples. (535O-6420)

subroutines accessed: ROUT IERRORI FILEDEL YREWURN JUMPOUT

(3) Addition of pai'ameters, samples, and associated data values (and labels). (a) Selection of type of addition required.

(64~-71oo) subroutines accessed: ROUT

YRErURN NUMCHECK

(b) Addition of parameter symbols. (710*-7770)

subroutines accessed: SYMCHECK IERRORI YRETURN JUMPOUT

(c) Addition of sample numbers. (?TS0-S520)

subroutines accessed: IERRORI SAMCHECK /UMPOUT

(d) Addition of data values (and labels) for additional parameters and/or samples specified. (853O-1021O)

subroutines accessed: DATINSTR IERROR2 NUMCHECK LCHECK LABEl,ADD SAMTYPE

(4) Respecification of sample types corresponding to declared labels. (10220-10870)

subroutines accessed: ROUT YRETURN JUMPOUT

(5) Alteration of existing data items. (a) Instructions for use of routine. Specification of code of

data item to be changed. (10880-11380)

subroutines accessed: ROUT MODINSTR JUMPOUT

(b) Check on validity of alphanumeric editing codes. (11385-11930)

subroutines accessed: none

Page 34: GEOFILE: an interactive program in basic for creating and editing data files

318 A.D. M, Butwma. and C. O. Topt~

(¢) Ch-nae Of data values, sample numbers, sample labels, • parmneter symbols. (11940-12560)

subroutines accessed: NUMCHECK SAMCHECK [.CHECK LABCHECK SYMCHECK

(d) Input of s~ple types for any new label(s) created

through changes in labels (routine (5c)). (1~7O-12640)

subroutines accessed: SAMTYPE

(6) Saving of data and/or termin~ion of program execution. (12800-13270)

subroutines accessed: NUMCHECK ROUT FILESAVE YESORNO

Subroatines

(D ROUT Checks that user has entered editing routine he requires. (1511O.-15280) Accessed from lines: 4700; 5600; 6710; 10500; 11180; 13110 Other subroutines accessed: YESORNO

(2) LCHECK Checks validity of label input. (15290-15640) Accessed from lines: 2260; 9920; 12320 Other s u b - ~ - a c c e s s e d : none

( ~ S A M C ~ C K Checks validity of sample number input. ( 15650-1609O) Accessed from lines: 1910; 8110; 12120 Other subroutines accessed: none

(4) FILL~A}~ Gives directory of files on disk and checks validity of input ~le name. (1610O-16600) Accessed from lines: 2400/); 24500 Other subroutines accessed: YESORNO

YRETURN

(5) YESORNO Checks that answer 'Y' or 'N' is given. (1662O-17OOO) Accessed from lines: 28~; 13220; 15220; 16340; 18740; 23650 Other subroutines accessed: none

(6) IERROR1 When user declares input error in parameter symbol and sample number additionMeletion routines, this subroutine identifies and validates code number of input error. (17010--17490) Accessed from lines: 1430; 4860; 5760; 7320; 8080 Other subroutines accessed: NUMCHECK

(7) m_,RROR2 When user declares input error during addition of data values to file, this subroutine checks and validates code number of input error. (17500-17890) Accessed from lines: 1890; 9220; 9770 Other submutmes accessed: NUMCHECK

YESORNO

(8) NUMCHECK

(9) FILINSTR

Checks and validates input numeric item. (17900-1844O) Accessed from lines: 2130; 7000; 9300; 9790; 12050;

12970; 17370; 17730 Other subroutines accessed: none

Gives hard copy print-out of instructions for creating a file. (18450-19280) Accessed from lines: 1200 Other subroutines accessed: YESORNO

YRETURN

Page 35: GEOFILE: an interactive program in basic for creating and editing data files

GEOFILE: An interactive program in BASIC for creating and editing data files 319

(10) El)OPTION Displays options available in editing part of program on VDU. (1929O-1973O) Accessed from lines: 4300 Other subroutines accessed: none

(11) MODINSTR Displays instructions on VDU for modification of existing items on data file. (19740-20230) Accessed from lines: 11290 Other subroutines accessed: none

(12) DATINSTR Instructions for error correction and for settin8 default labels and 'not determined' data values. (20240-20540) Accessed from lines: 9020; 9570 Other subroutines accessed: none

(13) SYMCHECK Checks validity of parameter symbol entered. (20550-20930) Accessed from lines: 1380; 7270; 12440 Other subroutines accessed: none

(14) HLEDEL Not a subroutine. Prevents user from inadvertently deleting entire file when using sample number or parameter symbol deletion routines. (2094O-21320) Accessed from lines: 5080; 5980 Subroutines accessed: YRETURN

(15) LABELADD Appends new labels to L,8(1) array when labels added to file. (21330-2171O) A c c ~ l from lines: 2280; 9940 Other s ~ accessed: LABERROR

06) LABCtIECK chmm I J(1) ~rray, if appropriate, when W~d ¢hem~ dur~ ~e medif~tion. (21720-22290) Accessed from lines: 12340 Other subroutines accessed: LABERROR

(17) LABERROR not a subroutine. Extension of LABELADD and LABC~_.~K subrou~es. Prints error message on VDU if attempt made to exceed maximum number of different labels allowed on file. (22300-22680) Accessed from lines: 21650; 22230 Other subrmniues accessed: none

(18) SAMTYPE Prompts input of sample types corresponding to recently declared labels. (226~-23020) Accessed from lines: 2630; 10200; 12630 Other subroutines accessed: none

(19) YRETURN Ensures 'Y' is pressed at keyboard. (2303O23360) Acces~d from lines: 870; 5106; 6006; 6820; 7690; 10570;

16390; 19260; 21300 Other subroutines accessed: none

(20) JUMPOUT Gives warning if premature exit is made from file creation or ~ editing routine. (3370-23720) Accessed from lines: 1620; 2410, 5130; 6030; 7720; 8490;

10720; 11370 Other subrout~es accessed: YESORNO

(21) FILEREAD Reads data file from disk. (23730-24220)

Page 36: GEOFILE: an interactive program in basic for creating and editing data files

320 A. D. M. BURW~LL and C. G. TOPLEY

Accessed from lines: 1000 Other subroutines accessed: FILEHAME

(22) FILESAVE Saves data file on disk. (24230-24710) Accessed from lines: 13140 Other subroutines accessed: FILENAME

Mqq~iX 3 ~odqy/ng the program I. Nor~tandard commands and functions

It has been necessary to use certain commands, statements, and functions which do not comply with standard BASIC as defined by ECMA and ANSI: ASC(X~) Returns the ASCII (decimal) code (in the range 0-

127) of the first character of the string X~. CHRS(I) Returns the ASCII character of value I. CLEAR I Sets all prngmm variables to zero and reserves I

bytes of suing space. CLOSE 1 Closes disk file number one after rendingJwritin~ FILES"B:*.*" Displays disk B file directory on VDU. INPUT#1,(variable) Reads value from disk file into (variable). LEFT~C/,~, I) Returns leftmost I characters of suing X~. LEN(X~) Returns the length of the sU'ing X~. LET (A)= (B) Assigns value of expression (13) to the variable

(A). "LET' often may be omitted from BASIC programs and has been omitted from this proiiram.

LPRINT Directs output to the printer. LPRINT USING XJ Prints the value of the variable I in the

form specified by the string variable X~ (for example if X~ = " ~ . O # ' , four digits w~ be printed, two before and two after a decimal point).

MID~(X~, I, J) Returns J characters from the string X~, start- ing with the Ith dttwacter.

OPEN"I/O",LX$ Opens disk file for reading (1) or writing (O), file having ,tame contained in variable X$.

PRINT #1, (veriable) Writes value of (variable) to disk file. RESET R ' ~ disk directory information. RIGHT~(XS, I) Returns rightmost I characters of string X~. VAL(Xg) Returns numerical value held in string X~.

Additional Notes Certain restrictions which are specified in standard

(ECMA/ANSI) BASIC have been ignored in GEOFILE since they do not appear to apply to any ftequentiy used versions of BASIC:

(~ String variables of the form AI~, B2~ . . . . (standard requires A~, B~ . . . . . ).

(h3 String arrays. (ih3 > 18 Characters assigned to a string variable. (iv) Numerical arrays of the form AI(I), B2(1) . . . . (standard

requires Aft), B(I) . . . . ). (v) INPUT commands with string literal prompts, for example

INPUT'YES OR NO": AS.

2 Structure of data in disk fde Data files are of sequential type, created in this prosram

through a CP/M operating system. File reading and file writing are executed in the subroutines "FILEREAD" and "FILES- AVE", respectively. The files have the following structure:

(i) A numerical value (N): number of parameters. (ii) N parameters. (ill) A numerical values (NI): number of different labels on

file. (iv) Label ~ N I pairs. (v) Associated sample type J (v0 A numerical value (N2): number of samples. (vh.) Sample number 1 (viii) Sample label I N2 sets. (ix) N data values

To implement this program on a computer not supporting CP/M tile handling conventions, the following subroutines must be modified:

HLENAME FILEREAD FILESAVE

3 Army sizes Array sizes may be changed as required, provided the follow.

ing rules are obeyed: (~ N~(1), M~(1), D(I, J), and $8(I, 2) must have the same 'T '

value in the DIMENSION statement (fine 270). If "I" is changed, the new "I" value must be substituted for "60" in line 290.

(h') Arrays O~(J)'and D(I, J) must have the same "J" value in the DIMENSION statement (line 270). If "J" is changed, the new "J" value must be substituted for "20" in line 300. Note that, to ensure proper formatting of print-out, "J" should not exceed (L2-15) (where L2 = number of lines per form on the printer--see lines 385-390) and "J" may not exceed 46.

(/it') The dimensions of army Y~(I) must not be changed. (iv) The dimet~om of arrays L~(D and S$(D must be iden-

tical. The "I" value should not exceed 15. If "I" is changed, the new "V' value should be substituted f0i" "15" in line 310.

(v) The size of the 09~(J) array must not exceed that of the O~(I) array (see 3h.). If the size of 09~(J) is changed, replace "10" by the new "J" value in line 320.

(v0 The size of the S9J(J) array must not exceed that of the N~(I) array (see 30. If the size of the S9,S(J) array is changed, replace "30" by the new "J" value in line 330.

(vi0 The size, and contents of arrays L3(ll), E$(7), EI~(2), FI~(I), and LI~(3) must not be changed, with the exception of the first element of L3(II) (see section 4.vi).

4 Changing variable assignments In ¢.rtain circumstatr~s, it may be necessary to change a

number of variable auignmants in GEOFILE. These changes arise principally through: the specific requ~meuts of the system on which the prosram is to be implemented; any changes made to the array sizes; the type of data being handled.

(i) Variables: I2 (line 290); J2 (300); N3 (310); X2 (320); $2 (330). These variables are set to values which depend on array sizes. They may need to be altered if array sizes are altered (see section 3).

(h.) Variables: C2 (line 380); L2 (390). These variables are set to values which depend on the characteristics of the printer used: characters per line and characters per form, respectively. Changes which may be necessary for printers with different charaC:teristics are described in section 6.

(iii) Variable M5 (line 360). This variable is used in the pro- gram to set a data value to "not determined". The value of M5 is set into the individual array element (in 13(I, J)) which cor- responds to the "not determined" value. M5 is assigned currently the value " - Y' because this would not be a valid concentration value in geochemical data files. The value " - 3" is used later (for example, in graph ploUing) to indicate samples which must be skipped (that is, not plotted). In situations where " - 3" can be a valid data value, variable M5 must be set to some other numeri- cal value (in line 360) which is not a possible data value.

(iv) Variables: Pl~ (line 450): DI~ (460). These two variables contain strings relating to the type of data being handled through GEOFILE. PI~ is set to a string describing the type of symbols on the file and DI~ is set to a string describing the type of numerical values on the file. In the current listing, written for the

Page 37: GEOFILE: an interactive program in basic for creating and editing data files

GEOHLE: An interactive program in BASIC for creating and editing data files 321

creation of geochemical data files, these strings are "OXIDE/ELEMENT" (PI~) and "CONCENTRATION" (DI~). For other uses, these two string assignments must be changed in lines 450 and 460 respectively, for example, use in studies of fossil morphology, Pl~ might be set to "DIMENSIONAL" and D l f to "MEASURED". The user then would be asked to input "DIMENSIONAL" (Pl$) symbols (HEIGHT, LENGTH, RADIUS) and "MEASURED" (DI~) values.

(v) Variable D2~ (line 510). D2,g contains an instruction which, ff obeyed by the user, enables him either: (a) to set a par- ticular sample label to a default ("*" in the current listing); or (b) to set a particular data value to "not determined" (signified by " - 3 " in the current listins). The importance of assigning D2g correctly may be illustrated by using the example of the requirement to set default sample labels during file creation. Immediately prior to the prompt which asks the user for a sample label (line 2210), the label-string variable which will hold that label is set to "N" (line 2190). Once the user responds to the prompt with a valid label, that label overwrites "N" in the label variable. If, however, the user requires a default label then "N" must remain in the label variable. On the system for which the program was written, this may be achieved simply by pressing RETURN which has the effect of not overwriting the "N" already placed in the label variable. Hence, D2~ contains the string instroc6on "PRESS RETURN". On certain systems, however, RETURN (alone) is not a valid input. For such sys- tems, D2~ must be changed to "PRESS N RETURN".

(vi) Variable FS~ (line 570). FS~ contains the string represen- tatinn of the default sample label (currently "*") which is used to set a label for any sample for which the user does not declare a specific label. This default label may be changed in line 570 to any other character except "E" "N" "C" "!" " - .... + .... "" "1" " \ ....... which are disallowed labels. Note that the first element of array L3(II) is set to the ASCII value of FS,g in line 605.

5 Shortenin8 the program by subwutine omission To provide more array space in memory, certain subroutines

which simply provide information for the user may be removed readily from the program: FILINSTR--omit lines 184~-19270; change line 950 to "IF

A~ = "N" THEN 1210"; omit line 1200. EDOPTION--omit lines 19280-19720; replace the "GOSUB

19500" in line 4300 with "REM". MODINSTR-.omit lines 19720-20220; omit ilne 11290.

6 Changing GEOFILE/or use with di~erent pnnters GEOFILE Ires been written for a printer with 132 clmr~ters

per line and 64 lines per form (page). If GEOFILE is used with a printer of different character and line spacing, "change "132" in line 380 to the number of characters per line and "64" in fine 390 to the number of lines per form.