*--------------------------*
* TABLE
* GENERIC TABLE MAINTENANCE PROGRAM TO UPDATE CLOCK TABLES.
*--------------------------*
CS=@(-1) ; CR=@(-3) ; CL=@(-4) ; RV=@(-13) ; ERV=@(-14)
VM=CHAR(253) ; SVM=CHAR(252) ; AM=CHAR(254) ; BEEP=CHAR(7)
PF1='<' ; PF2='P' ; PF3='/'
PROMPT ""
*
LAYOUT=''
LAYOUT<1>=1
LAYOUT<2>="TERMINAL"
LAYOUT<3>="Enter 1(ADDS 2020), 2(ADDS 2025 or 4000), 0(all others)"
FILENAME='PORTS'
OPEN FILENAME TO OFILE ELSE ABORT
10 *
CRT CS
CRT @(0,0):"CLOCKTABLE.PORTS"
STRING=FILENAME:" MAINTENANCE"
CENTER=40-INT(LEN(STRING)/2)
XCT=DCOUNT(LAYOUT<1>,VM)
OLD.LEN=0
FOR X=1 TO XCT
XLEN=LEN(LAYOUT<2,X>)
IF XLEN > OLD.LEN THEN OLD.LEN=XLEN
NEXT X
XLEN=OLD.LEN
CRT @(CENTER,3):RV:STRING:ERV
STRING=FILENAME
CRT @(0,22):CL:"Enter ":FILENAME:" code '/' to escape"
CRT @(CENTER,6):CL:STRING:" ":
CENTER=CENTER-5
INPUT KEY
IF KEY='/' OR KEY='' THEN STOP
READ IREC FROM OFILE,KEY THEN
GOSUB 2000
OREC=IREC
END ELSE
CRT @(0,22):CL:FILENAME:" record not found - 'A'(add)":
INPUT ANS
IF ANS = 'A' THEN
IREC=''
OREC=''
GOSUB 2000
GOSUB 1000
END ELSE
GO 10
END
END
GOSUB 3000
GO 10
1000 *
ACT=DCOUNT(LAYOUT<1>,VM)
FOR A=1 TO ACT
ALEN=LEN(LAYOUT<2,A>)
CRT @(0,22):CL:LAYOUT<3,A>:
CRT @(CENTER,7+A):A:" ":LAYOUT<2,A>:STR(" ",XLEN-ALEN):": ":
INPUT ANS
IF ANS # '' THEN
OREC=ANS
END
NEXT A
RETURN
2000 *
ACT=DCOUNT(LAYOUT<1>,VM)
FOR A=1 TO ACT
ALEN=LEN(LAYOUT<2,A>)
CRT @(CENTER,7+A):A:" ":LAYOUT<2,A>:STR(" ",XLEN-ALEN):": ":IREC
NEXT A
RETURN
3000 *
CRT @(0,22):CL:"Enter # change, 'E'(end) else RETURN ":
INPUT A
IF A='E' THEN GOSUB 4000; GO 10
IF A >=1 AND A <=ACT THEN
ALEN=LEN(LAYOUT<2,A>)
CRT @(0,22):CL:LAYOUT<3,A>:
CRT @(CENTER,7+A):A:" ":LAYOUT<2,A>:STR(" ",XLEN-ALEN):": ":OREC:CL
CRT @(CENTER,7+A):A:" ":LAYOUT<2,A>:STR(" ",XLEN-ALEN):": ":
INPUT ANS
IF ANS # '' THEN
OREC=ANS
END
CRT @(CENTER,7+A):A:" ":LAYOUT<2,A>:STR(" ",XLEN-ALEN):": ":OREC:CL
GO 3000
END
CRT @(0,22):CL:"NO SELECTION MADE":
RQM
GO 10
RETURN
4000 *
WRITE OREC ON OFILE,KEY
CRT @(0,22):CL:"RECORD UPDATED":
RQM
RETURN