        REM GNSCREEN.BAS * PROGRAM
        REM              *
        REM 11 23 82     * J.BUTLER
        REM SYSTEM CONTROL PROGRAM NUMBER :
        REM FILES UNDER 'DBFM' CONTROL    :

        REM COMMONS GO HERE
        COMMON CLEAR$,NAME$,LINE$,DEMO$,CRSR$,FOCUS$,HIGH$,LOW$,PASSWORD$, \
               DATE$,EOL$,CLRFORE$,ROWOFF,COLOFF,SCRPARA,CONT
	
        REM ADD HARD SCREEN FUNCTIONS HERE IF NECESSARY

        REM DIMENSIONS GO HERE
        DIM MONTHS$(12),MASK$(10)

        MONTHS$(1)="JANUARY":MONTHS$(2)="FEBRUARY":MONTHS$(3)="MARCH"
        MONTHS$(4)="APRIL":MONTHS$(5)="MAY":MONTHS$(6)="JUNE"
        MONTHS$(7)="JULY":MONTHS$(8)="AUGUST":MONTHS$(9)="SEPTEMBER"
        MONTHS$(10)="OCTOBER":MONTHS$(11)="NOVEMBER":MONTHS$(12)="DECEMBER"

        BLANK$="                             ":SCNO$="":ERR=5

7       REM OPEN PARTICULAR FILE HERE

        GOTO 11
 
8       REM VERTICAL CURSOR POSITIONING ROUTINE
        FOR ZZ=1 TO VV:PRINT:NEXT ZZ:RETURN
 
9       REM DATE FORMATTING ROUTINE
        DATE$=MID$(P$,1,2)+"-"+MID$(P$,3,2)+"-"+MID$(P$,5,2)
        RETURN
 
10      REM CURSOR ADDRESS
        IF SCRPARA=1 THEN \
        PRINT CRSR$;CHR$(ROW+ROWOFF);CHR$(COLUMN+COLOFF);:RETURN
        PRINT CRSR$;CHR$(COLUMN+COLOFF);CHR$(ROW+ROWOFF);:RETURN

15      REM SCREEN GENERATION HERE
        PRINT CLEAR$
        PRINT TAB(40-LEN(COMPANY$)/2);COMPANY$
        PRINT TAB(40-LEN(COMPANY$)/2);LINE$:PRINT TAB(62);"DATE:";DATE$

    REM PUT YOUR SCREEN HERE

        IF SECOND=1 THEN SECOND=0:RETURN

20      PRINT HIGH$;CLRFORE$;:HOLD$=STR$(REC1) 
        IF CHANGE$="C" THEN HOLD$=STR$(REC1-1)
        COLUMN=13:ROW=3:GOSUB 10:INPUT "";LINE RECORD$
        IF RECORD$="STOP" OR RECORD$="END" THEN 9990
        REC1=VAL(RECORD$)
        IF RECORD$="" THEN REC1=VAL(HOLD$)+1
 
25      PRINT CLRFORE$
        COLUMN=13:ROW=3:GOSUB 10:PRINT REC1
        GOSUB 1000:GOSUB 60

30      PRINT LOW$;:COLUMN=11:ROW=22:GOSUB 10
        PRINT "IS THIS DATA CORRECT <Y/N> :";:INPUT "";LINE DATA$
        GOSUB 10:PRINT EOL$;
        IF DATA$="" OR LEFT$(DATA$,1)="Y" THEN 15
        
40      REM ERROR CHECKING STATEMENT HERE
        RECUR$="":COLUMN=11:ROW=22:GOSUB 10
        PRINT EOL$;"'S'TOP, 'D'ELETE, 'R'ECUR @, FIELD #  :";
        INPUT "";LINE CHANGE$
        IF LEFT$(CHANGE$,1)="S" THEN GOSUB 2001:GOTO 9990
        IF CHANGE$="" THEN GOSUB 2001:SECOND=1:GOSUB 15:GOTO 20
        IF CHANGE$="D" THEN 8900
        IF MID$(CHANGE$,1,1)="R" THEN RECUR$="R" \
           :CHANGE$=MID$(CHANGE$,2,LEN(CHANGE$)-1)
        IF VAL(CHANGE$)=0 THEN 15

    REM CHANGE THE NEXT NUMBER AS TO HOW MANY FIELDS ON SCREEN

        NUM=2

50      IF VAL(CHANGE$)<29 OR VAL(CHANGE$)>NUM THEN 40

    REM ADD TO THE ROUTINE AS TO HOW MANY FIELDS ON SCREEN

        ON VAL(CHANGE$) GOSUB 7010,7020,.....................

        GOSUB 2001
        IF RECUR$="R" AND VAL(CHANGE$)<=NUM THEN \
        CHANGE$=STR$(VAL(CHANGE$)+1):GOTO 50
        SECOND=1:GOSUB 15:GOTO 25

60      REM SCREEN PRINT HERE
        COLUMN=70:ROW=3:GOSUB 10:P$=G2$:GOSUB 9:PRINT DATE$

    REM PUT YOUR ROW, COLUMN, AND PARTICULAR FIELDS TO DISPLAY, HERE

        RETURN

1000    IF END #1 THEN 6000

1001    REM CHANGE THIS AS TO HOW MANY FIELDS THERE ARE IN THE FILE 
        READ #1,REC1;A1$
        RETURN

2001    REM CHANGE THIS AS TO HOW MANY FIELDS THERE ARE IN THE FILE
        PRINT #1,REC1;A1$
        RETURN

6000    COLUMN=2:ROW=22:GOSUB 10
        PRINT EOL$;"RECORD #";REC1; \
        " HAS NOT BEEN ESTABLISHED FOR ";DATAFIL$;CHR$(7);
         FOR X=1 TO 500:NEXT X
        GOSUB 10:PRINT EOL$;:GOTO 15

7010    REM SCREEN INPUT FUNCTIONS HERE
        SPC%=13:COLUMN=32:ROW=5:GOSUB 10:INPUT "";LINE A1$
        IF LEN(A1$)>SPC%-1 THEN PRINT CHR$(7):GOTO 7010
        RETURN

   REM  ADD MORE STATEMENTS IF NECESSARY, FOR SCREEN INPUT, HERE
 
8900    REM DELETE RECORD FUNCTION HERE

     REM CHANGE THIS ACCORDING TO HOW MANY FIELDS THERE ARE IN THE FILE

        PRINT #1,REC1;""
        GOTO 15

9990    CLOSE 1
        PRINT LOW$;CLEAR$:STOP
 
9992    FOR X=1 TO 24:PRINT:NEXT X
        PRINT TAB(20);"ACCESS NOT PERMITTED! SEE YOUR SYSTEM SUPERVISOR..";ERR;
        Y%=CONCHAR%
        IF Y%=5EH THEN 9999
        GOTO 9992
 
9999    PRINT LOW$;CLEAR$
        STOP

