home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Share Gallery 1
/
share_gal_1.zip
/
share_gal_1
/
BF
/
BF015.ZIP
/
PCPM4.EXE
/
arc
/
CPAPRES.BAS
< prev
next >
Wrap
BASIC Source File
|
1987-02-12
|
5KB
|
279 lines
'CPAPRES
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 " PERSONAL COMPUTER PROJECT MANAGEMENT"
print
print" PREDESSOR OR SUCCESSOR"
print
DIM V(100),T$(11),X$(12)
DIM S(500),F(500),D$(500),D(500),A5(500)
DIM P(3000)
GOSUB GetFile '5000 READ IN INPUT FILE
INPUT "Enter Predecessor or Successor (P/S) ",Q$
IF LEFT$(Q$,1)="P" or left$(Q$,1)="p" THEN
F1=1
ELSE F1=0 'F1=1 THEN PREDESSOR
end if
IF F1=1 THEN
OPEN F$+".PRE" FOR OUTPUT AS #1
ELSE OPEN F$+".SUC" FOR OUTPUT AS #1
end if
IF F1=1 THEN
T$="PRECEEDOR "
ELSE T$="SUCCEEDOR "
end if
FOR I=1 TO N
P(I)=I
NEXT
P6=0
FOR I=1 TO 12
READ X$(I)
NEXT I
DATA "JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"
B4=VAL(MID$(DATE$,1,2))
B5=VAL(MID$(DATE$,4,2))
B6=VAL(MID$(DATE$,9,2))
GOSUB WriteHeading '660
PRINT "**** SORTING";N;"ACTIVITIES ****";
GOSUB ShellSort '7000
PRINT " FINSHED SORTING ****"
PRINT "**** THE FOLLOWING INDICATES HOW MANY ";T$;"S EXIST FOR EACH ACTIVITY ****"
K1=1
370 IF F1=1 THEN
N1=S(P(K1))
ELSE N1=F(P(K1))
end if
J2=0
FOR I=1 TO N
IF F1=1 THEN
J5=F(P(I))
ELSE J5=S(P(I))
end if
IF J5<>N1 THEN
goto 440
end if
J2=J2+1
A5(J2)=P(I)
440 NEXT I
PRINT #1,TAB(3);S(P(K1));TAB(9);F(P(K1));
PRINT J2;
IF J2=0 THEN
goto 540
end if
FOR I=1 TO J2
Q=(I-1)*12+1
IF I<10 THEN
goto 520
ELSE Q=(I-10)*12+1
end if
IF I=10 THEN
PRINT #1,G9$
end if
520 PRINT #1,TAB(15+Q);S(A5(I));TAB(21+Q);F(A5(I));
NEXT I
540 PRINT #1,G9$
K1=K1+1
IF K1>N THEN
goto 590
end if
IF K1/50=INT(K1/50) THEN
GOSUB WriteHeading '660
end if
GOTO 370
590 PRINT
PRINT "**** ";T$;" DISPLAY CREATED AND EXISTS IN ";
IF F1=1 THEN
PRINT F$+".PRE";" ****"
ELSE PRINT F$+".SUC";" ****"
end if
PRINT
INPUT "Press ENTER to continue ",Q$
CLOSE #1
chain "CPAMENU"
WriteHeading:
660 REM WRITE PAGE HEADING SUBROUTINE
P6=P6+1
T4=INT((120-LEN(T$+"DISPLAY"))/2)
T5=INT((120-LEN(P$))/2)
PRINT #1,TAB(T5);P$;TAB(115);"PAGE";P6
PRINT #1,G9$
PRINT #1,TAB(T4);T$;"DISPLAY";TAB(99);"RUN DATE: ";X$(B4);B5;", 19";RIGHT$(STR$(B6),2)
PRINT #1,G9$
R$=" ACTIVITY "
R2$=" I J "
PRINT #1,R$;T$;" ";T$;" ";T$;" ";T$;" ";T$;" ";T$;" ";T$;" ";T$;" ";T$
R4$="I J "
PRINT #1,TAB(4);R4$;R2$;R2$;R2$;R2$;R2$;R2$;R2$;R2$;R2$
PRINT #1,G9$
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$,S(I),F(I),O2,D,A6,PC,B,CT
IF S(I)>N8 THEN
N8=S(I) 'HIGHEST START NODE NUMBER=N8
end if
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
ShellSort:
7000 REM **** SHELL METZNER SORT ****************************************
J=N
FOR I=1 TO N
P(I)=J
J=J-1
NEXT I
M=N
7040 M=INT(M/2)
IF M=0 THEN
RETURN
end if
J=1
K=N-M
7080 I=J
7090 L=I+M
IF S(P(I))<S(P(L)) THEN
goto 7150
end if
SWAP P(I),P(L)
I=I-M
IF I<1 THEN
goto 7150
end if
GOTO 7090
7150 J=J+1
IF J>K THEN
goto 7040
end if
GOTO 7080