REM MAGSAMX 3.0 - MAGSAM TUTORIAL PROGRAM
REM  MICRO APPLICATIONS GROUP
REM  7300 CALDUS AVE
REM  VAN NUYS, CA  91406
REM  (C) COPYRIGHT 1978, 1979 MAG
REM 
      REC.LEN%=256
      DIM MAGSAM$(20),MAGSAM%(20)
      PRINT:PRINT:PRINT
      PRINT "MAGSAMX 3.0 - MAGSAM TUTORIAL PROGRAM"
      PRINT "(C) COPYRIGHT 1978, 1979 MICRO APPLICATIONS GROUP"
      PRINT: INPUT "ENTER INDEX FILE NAME: ";I$
      MAGSAM%(1)=1: REM INDEX FILE NUMBER
      PRINT: INPUT "ENTER DATA FILE NAME: ";D$
      MAGSAM%(2)=2: REM DATA FILE NUMBER
      PRINT: INPUT "ENTER OVERFLOW FILE NAME: ";O$
      MAGSAM%(3)=3: REM OVERFLOW FILE NUMBER
      PRINT: INPUT "ENTER DATA FILE RECORD LENGTH: ";D
      FILE I$(REC.LEN%)
      FILE D$(D)
      FILE O$(REC.LEN%)
200   PRINT: INPUT "ENTER KEY LENGTH: "; MAGSAM%(4)
210   PRINT: INPUT "ENTER FUNCTION CODE: ";MAGSAM$(1)
      IF RIGHT$(MAGSAM$(1),1)="N" THEN GOTO 300
      PRINT: INPUT "ENTER KEY VALUE: ";MAGSAM$(2)
      IF MAGSAM$(1)<>"WA" AND MAGSAM$(1)<>"WL" THEN GOTO 250
      PRINT: INPUT "ENTER DATA RECORD TEXT: ";R$
      GOTO 300
250   IF MAGSAM$(1)<>"SA" AND MAGSAM$(1)<>"SL" THEN GOTO 300
      PRINT: INPUT "ENTER DATA RECORD NUMBER: ";MAGSAM%(5)
300   GOSUB 60000: REM MAGSAM 
      IF MAGSAM%(8)=0 THEN GOTO 400
      PRINT: PRINT ">>ERROR: ";MAGSAM%(8): GOTO 900
400   IF LEFT$(MAGSAM$(1),1)="R" THEN GOTO 500
      IF LEFT$(MAGSAM$(1),1)="W" AND MAGSAM$(18)<>"S" THEN \
         GOTO 600 \
      ELSE \
         GOTO 900
500   READ # MAGSAM%(2),MAGSAM%(9); LINE X$
      PRINT: PRINT X$
      GOTO 900
600   PRINT # MAGSAM%(2),MAGSAM%(9);R$
900   X$=""
      PRINT: INPUT "MORE FUNCTIONS? (Y OR N): ";X$
      IF X$="Y" THEN GOTO 210
      IF X$<>"N" THEN GOTO 900
      PRINT:PRINT"MAGSAMX COMPLETE":PRINT
      CLOSE MAGSAM%(1),MAGSAM%(2),MAGSAM%(3)
      STOP
%INCLUDE MAGSAM
      END
