* Card Index Program * (c) 1988, Simon Phipps (Users' club 0221) * Free to Z88 Users' Club members providing comment lines remain ? "CardBase Initialising..." if file("Cardbase.prg")=0 ? "Not set to correct directory; changing via CLI..." * Put def drive def dir on the next line cli "#F|sv|d:ram.1~e|si|dzBase/Card2~e#ZW" do CardBase.prg return endif let Input$=" " let Vl$=CHR(1)+"2*J" let Jn$=CHR(1)+"2*M" let Fl$=CHR(1)+"R" let Bd$=CHR(1)+"B" let It$=CHR(1)+"T" let HLIN1$=CHR(1)+"2*E" let HLIN2$=HLIN1$+HLIN1$ let HLIN3$=HLIN1$+HLIN2$ let HLIN5$=HLIN2$+HLIN3$ let HLine$=HLIN5$+HLIN5$ let HLine$=HLine$+HLine$ release HLIN1$,HLIN2$,HLIN3$,HLIN5$ let Ind$=CHR(1)+CHR(230) let Hp$=CHR(1)+CHR(231) select 1 use CardBase.dbf index CardBase.ndx find "Index" cls let Cnt=0 do while Cnt < 79 at 1,Cnt say HLine$ let Cnt=Cnt+20 enddo at 0,0 say " "+Vl$+"Cr / / "+Vl$+"Ex / / "+Vl$+"Key "+Vl$+"X1 "+Vl$+"X2 "+Vl$+"Cmd" at 1,9 say Jn$ at 1,21 say Jn$ at 1,33 say Jn$ at 1,46 say Jn$ at 1,58 say Jn$ at 1,70 say Jn$ release Jn$,Vl$,HLine$ let fContinue = 1 let fModified = 1 * Main loop starts here... do while fContinue if eof() at 0,0 say Fl$+"End!"+Fl$ at 0,5 say " " else at 0,4 say " " at 0,5 say recnum() if deleted() at 0,0 say CHR(1)+CHR(227)+" " else if 1:Usage < 0 if 1:Usage < -1 if 1:Usage < -2 at 0,0 say Ind$+" " else at 0,0 say Hp$+" " endif else at 0,0 say Fl$+It$+"Prot"+Fl$+It$ endif else at 0,0 say "Card" endif endif endif if fModified at 2,0 say 1:Line1$ at 3,0 say 1:Line2$ at 4,0 say 1:Line3$ at 5,0 say 1:Line4$ at 6,0 say 1:Line5$ at 0,13 say substr(1:DT$,5,2) at 0,16 say substr(1:DT$,3,2) at 0,19 say substr(1:DT$,1,2) at 0,25 say substr(1:Exp$,5,2) at 0,28 say substr(1:Exp$,3,2) at 0,31 say substr(1:Exp$,1,2) at 0,38 say Bd$+1:Key$+Bd$ if 1:X1$=" " at 0,50 say "--------" else at 0,50 say It$+1:X1$+It$ endif if 1:X2$=" " at 0,62 say "--------" else at 0,62 say It$+1:X2$+It$ endif let fModified = 0 endif at 7,0 say 1:Line6$ let Cmd$=" " let CmA$=" " do while where(CmA$,"|A|B|C|D|E|F|O|P|Q|R|S|T|U|X|Z|+|-|?|#|!|<|>|")=0 let Cmd$=" " at 0,75 get Cmd$ let Cmd$=upper(trim(Cmd$)) let CmA$=substr(Cmd$,1,1) let CmB$=substr(Cmd$,2,1) if CmA$="|" let CmA$="" endif enddo at 0,75 say Cmd$+" " * Compound commands; help and find if len(Cmd$)=2 if where(CmA$,"?|F")>0 let Hlp$="Help" if CmA$="?" let Hlp$="Cmd "+CmB$ endif if CmA$="F" let Hlp$=CmB$ endif at 7,0 say Fl$+"Searching for "+Hlp$+"..."+Fl$+" " find Hlp$ let Cmd$="|" let fModified=1 endif endif * Find a card if Cmd$="F" let Loc$=" " let Tmp=recno() at 0,38 get Loc$ at 0,38 say It$+Loc$+It$ let Loc$=trim(Loc$) find Loc$ if eof() at 7,0 say Fl$+" Not found "+Fl$ go Tmp at 0,38 say Bd$+1:Key$+Bd$ else let fModified=1 endif endif * Quit if Cmd$="Q" let fContinue=0 at 0,0 say Fl$+Bd$+"Finishing"+Bd$+Fl$ use cls ? "CardBase v2.0 Finished. "+Fl$+"Make a back-up of CardBase.dbf"+Fl$ release fContinue,Cmd$,Cnt,Today$,Loc$,Yr$,Mo$,Da$,Hr$,Mi$,Fl$,Bd$,It$,Dy$,Tmp,fModified,Hlp$,CmA$,CmB$,Ind$,Hp$,HLine$ return endif * Free text search if CmA$="S" let fModified=1 do Search.prg endif * Change card if Cmd$="+" skip let fModified=1 endif if Cmd$="-" skip -1 let fModified=1 endif if Cmd$="<" let Tmp=recno() find 1:X1$ if eof() go Tmp else let fModified=1 endif endif if Cmd$=">" let Tmp=recno() find 1:X2$ if eof() go Tmp else let fModified=1 endif endif * Clean file if Cmd$="C" do CardPack.prg find "Index" let fModified=1 endif * Protect card if Cmd$="P" if where(CmB$,"H|I") if 1:Usage=-1 if CmB$="H" let 1:Usage=-2 else let 1:Usage=-3 endif else at 7,0 say Fl$+"Only protected cards may be converted to "+Ind$+" or "+Hp$+"."+Fl$ endif endif if 1:Usage > -1 let 1:Usage=-1 endif endif * Unprotect card if Cmd$="R" if 1:Usage=-1 let 1:Usage=0 endif if 1:Usage=-2 let 1:Usage=-1 endif if deleted() recall record endif endif * Go top/bottom if Cmd$="T" go top let fModified=1 endif if Cmd$="B" go bottom let fModified=1 endif * Show index card if Cmd$="!" find "Index" let fModified=1 endif * Show help card if Cmd$="?" at 7,0 say Fl$+"Finding "+Hp$+" card"+Fl$ find "Help" let fModified=1 endif * Use cross-references if Cmd$="X" do CardXref.prg endif * Add a new record if Cmd$="A" do CardAdd.prg let fModified=1 endif * Print cards if CmA$="#" do Print.prg endif * Delete card if Cmd$="D" if 1:Usage > -1 delete record else at 7,0 say Fl$+"Cannot delete a protected card!"+Fl$ endif endif * Set expiry date if Cmd$="E" do SetExp.prg endif * Zap expired cards if Cmd$="Z" do Expire.prg let fModified=1 endif * Open a different box if CmA$="O" let fModified=1 do OpenBox.prg endif * Update a card if Cmd$="U" do Alter.prg let fModified=1 endif enddo ? "ABNORMAL END! File still open, memory still allocated"