home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Don Maslin Archive
/
maslin_archive.zip
/
AARDVARK_Tape_Backups
/
maslin_c_d_3oct95
/
ddrive
/
sydex
/
prgms
/
invntory.lbr
/
MAINTAIN.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1980-01-29
|
7KB
|
289 lines
********************* maintain.cmd ********************
SET talk OFF
SET confirm ON
SET colon OFF
SET bell ON
SET escape OFF
SET inten OFF
CLEAR
SET bell OFF
STORE '00/00/00' TO mdate
STORE t TO getdate
DO WHILE getdate
ERASE
?
? " Enter date as MM/DD/YY"
@ 3,0 SAY " or <return> for none: " GET mdate PICTURE '99/99/99'
READ
IF val($(mdate,1,2))>12 ;
.OR. val($(mdate,4,2))>31 ;
.OR. (val($(mdate,7,2))<84 .AND. val($(mdate,7,2))<>0)
@ 5,0 SAY chr(7)
? " **** INVALID DATE, RE-ENTER ****"
STORE 1 TO x
DO WHILE x<25
STORE x+1 TO x
ENDDO WHILE x<25
LOOP
ELSE
STORE f TO getdate
SET DATE TO &mdate
ENDIF val($(mdate,1,2))>12 ;
ENDDO WHILE getdate
RELEASE mdate,x,getdate
SET bell ON
SET talk ON
DO WHILE t
ERASE
? "****************************************************"
? ' M A I N T E N A N C E M E N U'
? "****************************************************"
?
? ' 1. COPY-CHOP Account File'
?
? ' 2. COPY-CHOP Inventory File'
?
? ' 3. PURGE Ledger File'
?
? ' 4. CHANGE Invoice Number'
?
? ' 5. RE-INDEX all data files (no alterations)'
?
? ' 6. DELETE Beat Yesterday file'
?
? ' 7. ZERO salesman totals'
?
? ' I. RUN INVENTY Program'
?
? ' X. RETURN to CP/M'
?
ACCEPT " Enter here " TO command
DO CASE
CASE !(command)= '1'
ERASE
?
? ' **** C O P Y--C H O P A C C O U N T D I S K ****'
?
?
? 'This option will allow you to PERMANENTLY delete'
? 'all of the accounts which were tagged for deletion'
? 'YOU MUST BE SURE TO HAVE A BACK-UP COPY OF THE '
? "ACCOUNT DISK BEFORE YOU BEGIN. Press <return> or"
? "enter an 'A' to ABORT and return to menu."
?
SET console OFF
WAIT TO GO
SET console ON
IF !(GO)<> 'A'
ERASE
?
?
?
?
?
?
? ' This is going to take a little while..'
?
?
? ' Working--'
?
USE b:accounts
DELETE FILES b:accounts.ndx
DELETE FILES b:accnt:no.ndx
COPY TO b:tempa
USE b:tempa
INDEX ON bill:nm TO b:accounts
INDEX ON accnt:no TO b:accnt:no
CLEAR
DELETE FILES b:accounts
RENAME b:tempa TO b:accounts
ENDIF !(GO)<> 'A'
CASE !(command)= '2'
ERASE
?
? '** C O P Y--C H O P I N V E N T O R Y D I S K **'
?
?
? 'This option will allow you to PERMANENTLY delete'
? 'all of the inventory which was tagged for deletion'
? 'YOU MUST BE SURE TO HAVE A BACK-UP COPY OF THE '
? "INVENTORY DISK BEFORE YOU BEGIN. Press <return> or"
? "enter an 'A' to ABORT and return to menu."
?
SET console OFF
WAIT TO GO
SET console ON
IF !(GO)<> 'A'
ERASE
?
?
?
?
?
?
? ' This is going to take a little while..'
?
?
? ' Working--'
?
USE b:inventy
DELETE FILES b:invcatno.ndx
COPY TO b:tempi
USE b:tempi
DELETE FILES b:inventy
INDEX ON cat:no TO b:invcatno
CLEAR
RENAME b:tempi TO b:inventy
ENDIF !(GO)<> 'A'
CASE !(command)= '3'
ERASE
?
? ' ***** P U R G E L E D G E R F I L E ****'
?
?
? 'This option will allow you to permanently delete '
? "ALL of the ledger entries on file. Press <return> "
? "or enter an 'A' to ABORT this operation and return"
? "to the menu. This will also create an single entry"
? "for each account with today's date, a DEBIT consisting"
? "of the current balance, a detail of 'BROUGHT FOWARD'"
?
?
? " DO YOU HAVE NEW BACK-UPS MADE!!!"
?
?
SET console OFF
WAIT TO GO
SET console ON
IF !(GO)<> 'A'
ERASE
?
? ' ***** P U R G E L E D G E R F I L E ****'
?
?
?
?
?
? ' Working---'
DELETE FILES b:ledger.ndx
USE a:ledger
COPY STRUCTURE TO b:templ
SELECT PRIMARY
USE b:templ
SELECT secondary
USE b:accounts
GO TOP
DO WHILE .not. eof
SELECT PRIMARY
APPEND BLANK
REPLACE DATE WITH DATE (),detail WITH "BROUGHT FOWARD"
REPLACE debit WITH s.balance,rbalance WITH s.balance,accnt:no WITH s.accnt:no
SELECT secondary
SKIP +1
ENDDO WHILE .not. eof
DELETE FILES b:ledger
CLEAR
RENAME b:templ TO b:ledger
USE b:ledger
INDEX ON accnt:no TO b:ledger
CLEAR
ENDIF !(GO)<> 'A'
CASE !(command)= '4'
CLEAR
ERASE
?
? ' *** C H A N G E I N V O I C E N U M B E R ***'
?
?
RESTORE FROM a:invnmbr
STORE ' ' TO inv:no2
?
? 'The OLD invoice number was: ' ,inv:no
?
?
@ 8,0 SAY 'Enter new STARTING number : ' GET inv:no2 PICTURE '9999999999'
READ
STORE trim(inv:no2) TO inv:no
RELEASE inv:no2
SAVE TO a:invnmbr
CASE command= '5'
CLEAR
ERASE
?
? " *** H O U S E -- C L E A N I N G *** "
?
?
? " Make sure you have NEW BACK-UP disks before"
? " begining this process. PRESS <RETURN> to "
? " continue -- or enter an 'A' to ABORT"
?
WAIT TO GO
IF !(GO) <> "A"
ERASE
@ 12,10 SAY "Working..."
SET console OFF
SET talk OFF
DELETE FILES b:accnt:no.ndx
DELETE FILES b:accounts.ndx
DELETE FILES b:ledger.ndx
DELETE FILES b:sales.ndx
DELETE FILES b:accntzip.ndx
DELETE FILES b:invcatno.ndx
USE b:accounts
INDEX ON accnt:no TO b:accnt:no
INDEX ON bill:nm TO b:accounts
USE b:inventy
INDEX ON cat:no TO b:invcatno
USE b:ledger
INDEX ON accnt:no TO b:ledger
ENDIF !(GO) <> "A"
CLEAR
SET console ON
RETURN
CASE command= '6'
ERASE
?
? ' *** D E L E T E B E A T Y E S T E R D A Y ***'
?
?
? "Enter an 'A' if you wish to ABORT this process"
?
SET console OFF
WAIT TO GO
SET console ON
IF !(GO) <> 'A'
USE a:diary
? ' DELETING'
DELETE ALL
PACK
ENDIF !(GO) <> 'A'
CASE command= '7'
?
? " *** Z E R O S A L E S T O T A L S ***"
?
?
? "Enter an 'A' if you wish to abort this process"
?
SET console OFF
WAIT TO GO
SET console ON
IF !(GO) <> "A"
USE a:salesman
DELETE ALL
PACK
ENDIF !(GO) <> "A"
CASE !(command)= 'X'
ERASE
CLEAR
SET console OFF
QUIT
CASE !(command)= 'I'
CLEAR
ERASE
DO a:it
OTHERWISE
ERASE
?? chr(07)
ENDCASE
ENDDO WHILE t