steps 2 through 16. Call it S5, PRG.
S5, PRG—Using memory variables
SET TALK OFF && Turn off dBASE dialogue
USE EXPENSE && Open EXPENSE.DBF file
SUM Emp1 TO mtEmp1 && Sum employee expenses to mtEmp1
SUM Comp TO mtComp && Sum company expenses to mtComp
mTotal=mtEmp1+mtComp && Store preceding sums to mTotal
CLEAR && Clear the screen for following display
@ 3,20 SAY’ Employee Expenses:’ + STR (mtEmp1, 6, 2)
@ 4,21 SAY ‘Company Expenses: +STR (mtComp, 6, 2)
@ 5, 23 SAY ‘Total Expenses:’ + STR (mTotal, 6, 2)
WAIT && Pause operation for keypress
mDate=DATE ( ) && Store system date to mDate
mDate90=mDate+90 && Store mDate+90 to mDate 90
CLEAR
@ 3,20 SAY “Today’s Date: “ + DTOC (mDATE)
@ 4,20 SAY ‘Date+90 Days: +DTOC (Mdate 90)
@ 5,20 SAY ‘Date-90 Days:’ +DTOC (mDate-90)
WAIT && Pause operation for keypress
? mtEmp1, mtComp, mTotal, mDate, mDate 90
SAVE ALL LIKE m* TO TMP && Save memory variable to file TMP.MEN.
RELEASE mtEmp1, mtComp, mTota1, mDate, mDate 90 && Remove wariables from memory
*Some xBASE languages allow “RELEASE ALL” or RELEASE ALL LIKE m*”
?
? ‘TYPE 1 TO IGNORE IN RESPONSE TO FOLLOWING ERROR MESSAGE’
?
?
? mtEmp1, mtComp, mToal, mDate, mDate 90 && Cannot display memory variables
&& because they were released above
RESTORE FROM TMP && Restore memory variables
?mtEmpl, mtComp, mTotal, mDate, mDate 90 && Display restored memory variables
WAIT && Pause operation for keypress
CLEAR ALL && Release memory variables; close database (s)
RETURN && End of program file
19. Save the S5, PRG program. (USE Ctrl+W if you are using a database program editor).
0 comments:
Post a Comment