home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Share Gallery 1
/
share_gal_1.zip
/
share_gal_1
/
BF
/
BF015.ZIP
/
PCPM4.EXE
/
arc
/
CPAUPD.BAS
< prev
next >
Wrap
BASIC Source File
|
1987-02-12
|
5KB
|
236 lines
'*** CPAUPD ***
common cpafile$
UpperCase:
def fnucase$(cpafile$)
length=len(cpafile$)
if length =0 then
exit def
end if
for I=1 to length
ch=asc(mid$(cpafile$,I,1))
if ch> 96 and ch<127 then
mid$(cpafile$,I,1)=chr$(ch-32)
end if
next
fnucase$=cpafile$
end def
cls
CLOSE
print " UPDATE INPUT FILE FOR ACTUAL TIMES"
print
REM CPAUPD UPDATE INPUT FILE FOR ACTUAL TIMES
DEFINT B-Z:DEFSNG A
DIM X$(12),A6(500)
FOR I=1 TO 12
READ X$(I)
NEXT I
DATA "JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"
DIM S(500),F(500),D$(500),D(500),O2(500)
DIM H3(100),B(500),S$(48),R3(500),C(500)
B4=VAL(MID$(DATE$,1,2))
B5=VAL(MID$(DATE$,4,2))
B6=VAL(MID$(DATE$,9,2))
GOSUB GetFile '5000 READ INPUT FILE
ON ERROR GOTO FileHandlingErrs '6500
H$=F$+".UPD"
OPEN H$ FOR INPUT AS #2
INPUT #2,C4,C5,C6 'DATE OF CREATION OF UPDATE FILE
J=0
Start:
230 J=J+1
IF EOF(2) THEN
goto Warning '280
end if
INPUT #2,D$,S,F,D2,A6
IF A6=0 THEN
goto Start '230
end if
GOSUB CompChgActTime '2000
PRINT "**** ";D$;" UPDATED TO";D2;T6$;" ****"
GOTO Start '230
Warning:
280 IF N<>J-1 THEN
PRINT "**** WARNING - WRONG NUMBER OF ENTRIES IN UPDATE FILE ****"
end if
CLOSE #2
PRINT "File ";F$;" updated - O.K. to write to disk (Y/N) ";
INPUT Q$
IF LEFT$(Q$,1)="N" THEN
goto Back2MainMenu '320
ELSE goto 330
end if
Back2MainMenu:
320 INPUT "Press ENTER to return to the main menu ",Q$
close
chain "CPAMENU"
330 GOSUB UpdateInput '3000 WRITE TO DISK
close
chain "CPAMENU"
PRINT "**** UPDATE FILE ";H$;" NOT FOUND - CREATE WITH OPTION 5 ****"
PRINT
GOTO Back2MainMenu '320
CompChgActTime:
2000 REM SUBROUTINE TO COMPARE AND CHANGE ACTUAL TIMES
FOR I=1 TO N
IF S(I)<>S THEN
goto 2100
end if
IF F(I)<>F THEN
goto 2100
end if
IF D$(I)<>D$ THEN
PRINT "**** DESCRIPTIONS VARY - ";D$(I);" - ";D$;" ****"
ELSE goto 2070
end if
INPUT "Enter Y (O.K.), N for wrong activity, or Q to Quit (abort here) (Y/N/Q) ";Q$
IF Q$="Q" or Q$="q" THEN
CLOSE #2
chain "CPAMENU"
end if
2070 D(I)=D2
2100 NEXT
RETURN
UpdateInput:
3000 REM **** UPDATING INPUT FILE ******************
G$=F$+".CPM"
OPEN G$ FOR OUTPUT AS #3
WRITE #3,P$,T6$,DA$
FOR I=1 TO N
WRITE #3,D$(I),S(I),F(I),O2(I),D(I),A6(I),R3(I),B(I),C(I)
IF I/10=INT(I/10) THEN
PRINT I;
end if
NEXT
CLOSE #3
PRINT " **** FILE ";G$;" UPDATED ****"
RETURN
GetFile:
5000 REM **** READING IN ALREADY CREATED INPUT FILE ******************
if len(cpafile$) >0 then
G$=cpafile$
goto commndfile
end if
GetFile1:
5010 INPUT "Enter the name of the input file [.CPM] or Q to quit ";G$
IF G$="Q" OR G$="q" THEN
close
chain "CPAMENU"
end if
commndfile:
P=INSTR(1,G$,".")
IF P<>0 THEN
F$=LEFT$(G$,INSTR(1,G$,".")-1)
ELSE F$=G$
end if
IF LEN(F$)>8 THEN
PRINT "**** NOT A VALID PCPM FILE ****"
BEEP
GOTO GetFile1 '5010
end if
ON ERROR GOTO FileNotExist '5300
cpafile$=F$
cpafile$=fnucase$(cpafile$)
F$=cpafile$
G$=F$+".CPM"
OPEN G$ FOR INPUT AS #3
INPUT #3,P$,T6$,DA$
I=0
5070 I=I+1
IF EOF(3) THEN
goto 5130
end if
INPUT #3,D$(I),S(I),F(I),O2(I),D(I),A6(I),R3(I),B(I),C(I)
IF I/10=INT(I/10) THEN
PRINT I;
end if
GOTO 5070
5130 N=I-1
M6=VAL(LEFT$(DA$,2)):D6=VAL(MID$(DA$,3,2)):Y6=VAL(RIGHT$(DA$,2))
CLOSE #3
PRINT " **** INPUT FILE READ ****"
RETURN
FileNotExist:
5300 PRINT "**** FILE DOES NOT EXIST - TRY AGAIN ****"
BEEP
GOTO GetFile '5000
FileHandlingErrs:
6500 REM ERRORS IN FILE HANDLING
IF ERR=53 THEN
BEEP
PRINT "**** UPDATE FILE MUST BE CREATED FIRST AND EXIST ON THE DISK ****"
PRINT
end if
IF ERR<>53 THEN
goto GeneralError '11000 GENEARAL ERROR
end if
RESUME Back2MainMenu '320
GeneralError:
11000 PRINT "ERROR NUMBER";ERR;"AT LINE NUMBER";ERL
PRINT "**** PLEASE NOTE FOR FUTURE USE AND DEBUGGING ****"
GOTO Back2MainMenu '320