Sunday, May 15, 2016

"BUILDXF" == PROGRAM TO CREATE AN INDEXED FILE - Dan Paymar

Please see our page on the contribution of Dan Paymar to the Point 4 IRIS system.

------------------------------------------------------------------------------

Dan,

I mentioned this program to you last week, to which you said that you didn't recall writing this program.  That's OK.

However, thanks to David teaching me how to more properly use your BASIC interpreter on this Point $ IRIS system, I was able to display the contents of your BUILDXF program in a less confusing, more recognizable format.

I share this with you mostly for your/our own nostalgia.  I don't really have any questions about it as of yet, but I'm just sharing things as I find them, that I think you might find relevant.

Enjoy:

#BASIC BUILDXF
LIST
 10 REM  "BUILDXF" == PROGRAM TO CREATE AN INDEXED FILE
 20 REM WRITTEN BY DAN PAYMAR = 7-10-75
 30 REM REVISED BY ROY P. SINCLAIR = 5-25-77
 40 REM
 50 REM                 All Rights Reserved
 55 REM     Copyright (C) 1974, Educational Data Systems
 60 REM     Copyright (C) 1977, Educational Data Systems
 65 REM    This document contains secret and confidential
 70 REM   information of Educational Data Systems, and may
 75 REM  not be reproduced, used,  or disclosed without the
 80 REM prior written permission of Educational Data Systems
 90 REM
 100 PRINT "\215\PROGRAM TO CREATE AN INDEXED DATA FILE"
 110 REM         K = KEY LENGTH
 120 REM         N = NUMBER OF KEYS PER BLOCK
 130 REM         F = NUMBER OF FINE BLOCKS
 140 REM         C = NUMBER OF COARSE BLOCKS
 150 REM         T = TOTAL BLOCKS
 160 REM         L = DATA RECORD LENGTH
 170 REM         R = NUMBER OF INDEXED DATA RECORDS
 180 REM         X = NUMBER OF DATA RECORDS
 190 REM         D = NUMBER OF DIRECTORIES
 200 DEF  FNR(X)= INT X+ NOT  NOT  FRA X
 210 DIM N$[16],F$[30]
 220 INPUT "\215\DESIRED FILENAME? "N$
 230 IF  LEN (N$)<15 GOTO  260
 240 PRINT " NAME TOO LONG";
 250 GOTO  220
 260 LET F$="NUMBER OF DATA RECORDS"
 270 GOSUB 940
 280 LET X=Z
 290 LET L=256
 295 IF X=0 GOTO 320
 300 LET F$="DATA RECORD LENGTH (#WORDS)"
 305 GOSUB 940
 307 IF Z>0 GOTO  310
 308 GOSUB  970
 309 GOTO 307
 310 LET L=Z
 320 LET F$="NUMBER OF INDEXED RECORDS"
 330 GOSUB  940
 340 LET R=Z
 350 LET F$="NUMBER OF DIRECTORIES"
 360 GOSUB  940
 364 IF Z>0 IF Z<16 GOTO 370
 366 GOSUB  970
 368 GOTO 364
 370 LET D=Z
 380 DIM K[D],N[D],F[D],C[D],T[D]
 390 PRINT "\215\\215\ENTER KEY LENGTH (#WORDS) FOR EACH DIRECTORY:";
 400 FOR I=1 TO D
 410   LET F$=I
 420   LET F$[1,1]="#"
 430   GOSUB 940
 440   LET K[I]=Z
 450   LET N[I]= INT (254/(K[I]+1))
 460   LET F[I]= FNR(R*2/(N[I]+1))
 465   IF F[I]<2 LET F[I]=2
 470   LET C[I]= FNR(F[I]/(N[I]-1))
 475   IF C[I]<2 LET C[I]=2
 480   LET T[I]=F[I]+C[I]+1
 490   IF C[I]<=N[I] GOTO  520
 500   PRINT " KEY TOO LONG (MASTER LEVEL > 1 BLOCK)!";
 510   GOTO  430
 520   LET T=T+T[I]
 530 NEXT I
 540 PRINT "\215\\215\PLEASE WAIT . . ."
 550 SIGNAL 3,0
 560 REM         CREATE FILENAME STRING AND BUILD THE FILE
 570 LET R0= FNR(T*256/L)
 580 LET R1=R0+X
 581 IF R1<=65534 GOTO  590
 582 PRINT "\207\ FILE EXCEEDS 65534 RECORDS; THE INDEX REQUIRES";R0;"RECORDS"
 583 LET T=0
 585 GOTO 260
 590 LET F$=R1
 600 LET F$[1,1]="["
 610 LET I= LEN (F$)
 620 LET F$[I]=L
 630 LET F$[I,I]=":"
 640 LET F$[ LEN (F$)]="] ",N$
 650 BUILD #0,F$
 660 REM         SET KEY LENGTH FOR EACH DIRECTORY
 670 FOR I=1 TO D
 680   SEARCH #0,0,I;N$,K[I],E
 690   IF E=0 GOTO  720
 700   PRINT "\215\ERROR TYPE";E;"IN DIRECTORY";I
 710   STOP
 720 NEXT I
 730 REM         STRUCTURE THE DIRECTORIES
 740 SEARCH #0,0,0;N$,R,E
 750 IF E=0 GOTO 780
 760 PRINT "\215\ERROR TYPE";E;"WHILE STRUCTURING DIRECTORIES"
 770 STOP
 780 REM         READ FIRST REAL DATA RECORD NUMBER
 790 SEARCH #0,1,0;N$,R2,E
 792 IF E=0 GOTO  800
 794 PRINT "\215\ERROR TYPE";E;"WHEN READING FIRST REAL RECORD #"
 796 STOP
 800 LET R1= CHF 0
 810 PRINT "\215\FILE HAS";R1-R2;"DATA RECORDS\215\\215\PLEASE WAIT . . ."
 820 SIGNAL 3,0
 830 REM         LINK AVAILABLE RECORDS ONTO FREE CHAIN
 840 FOR I=R1-1 TO R2 STEP -1
 850   LET E=3
 860   SEARCH #0,1,0;N$,I,E
 870   IF E=0 GOTO 900
 880   PRINT "\215\ERROR TYPE";E;"WHILE CHAINING DATA RECORDS"
 890   STOP
 900 NEXT I
 910 PRINT "\215\FILE STRUCTURE COMPLETED"
 920 CLOSE #0
 930 GOTO  990
 940 PRINT "\215\";F$;
 950 INPUT Z
 960 IF  FRA Z=0 IF Z>=0 RETURN
 970 PRINT " ENTER POSITIVE INTEGER ONLY!";
 980 GOTO  940
 990 END

---------------------------------------------------------------------------

Indexed files were basically contiguous data files with indexing to locate records.
The best doc for these is in the BASIC programming manual.
~David

---------------------------------------------------------------------------

I still don't remember this. If I wrote it today there would be many more comments explaining what an indexed file is and its purpose.

I notice a contradiction. It says written in 1975, then there is a REM statement apparently inserted later saying copyright 1974!

Also, there's some anti-nostalgia. Back then we had to use IF and GOTO statements for conditional actions. Too bad we never implemented IF-THEN-ELSE structures in the language.

If you figure out what BUILDXF was used for, I'd be interested. I seem to recall we had what we called indexed files and contiguous files, but the "index" was just a list of hard drive block addresses. Contiguous data files were implemented later because of the size restriction on indexed files.

Dan

------------------------------------------------------------------------------

You want nostalgia, here's a pic of me about the time I started on the BASIC interpreter.





Please see our page on the contribution of Dan Paymar to the Point 4 IRIS system.

No comments:

Post a Comment