home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
database
/
sri314_b.zip
/
DEMOPRGS.ZIP
/
MEMBERS.PRG
< prev
next >
Wrap
Text File
|
1990-10-03
|
4KB
|
139 lines
*** MEMBERS.PRG **
** (C) Copyright 1990, Sub Rosa Publishing Inc.
** A demonstration program provided SR-Info users.
** This program may be copied freely. If it is used in commercial code,
** please credit the source, Sub Rosa Publishing Inc.
**
** MEMBERS is compatible with all current versions of VP-Info and SR-Info
** This short program offers most of the functionality required for basic
** list management. Add provisions to delete records and print reports
** and you have a full-blown application.
**
** MEMBERS demonstrates a simple transaction mode approach to record
** maintenance. All 'scratch pad' work is done in the temporary file.
** The master file is only updated after confidence in the new record
** is established.
**
** Note the heavy use of the SELECT command to force SR-Info to work on
** the intended file. New SR-Info users often go wrong by ending up
** in the wrong SELECT area, forgetting that the compiler assumes
** a SELECT error without knowing which branch of the code execution
** will follow. Therefore it is a good precaution to specify the
** SELECT area explicitly.
**
** Bernie Melman and Sid Bursten
**
*
USE#1 members index members
USE#2 membtemp ; same structure as members but contains only one record
IF :color <> 7
SET color to 117; violet on grey (for variety!?)
ENDIF
DO WHILE t; put main menu in an infinite loop
COLOR :color,0,0,24,79,177; fill screen with pattern
* 177 is a shaded fill character.
WINDOW 6,18,19,62 double; declare space for menu text
MODE = '?'
ERASE; fills window with blanks
TEXT
MEMBERS MAIN MENU
0. Exit program and SR-Info.
1. Choose a starting record.
2. Browse master file.
3. Edit copy of current record.
4. Make changes permanent.
5. Move changes to new record.
6. Edit new record.
7. Exit program - stay in SR-Info.
ENDTEXT
CURSOR 12,26 ; positions menu cursor over 1st character of 1st choice
SELECTION = menu(7,33); seven choices (including 0) bar width 33
DO CASE
CASE selection=0
QUIT
CASE selection=1 ; choose starting record
SELECT 1
PERFORM start_rec
@ 21,19 say "Press Pge Up and Pge Down Keys to change record"
@ 22,19 say "Press End key to return to Main Menu "
BROWSE
CASE selection=2 ; browse master file
SELECT 1
BROWSE
CASE selection=3 ; edit copy of current record
WINDOW
SELECT 1
PERFORM over2
SELECT 2
EDIT
CASE selection=4 ; update master file
SELECT 2
PERFORM over1
SELECT 1
CASE selection=5 ; new record to master file
SELECT 2
APPEND to 1
CASE selection=6 ; blank record in temp file
* note: This part of the demo must be 'fleshed out' for serious work
* As presented it is up to the user to go back to the main menu
* and select 5 to append to master file. Selecting 4 will
* overwrite an active record. End users should be handled more gently!
SELECT 2
ZAP
APPEND blank
FLUSH
WINDOW
EDIT
CASE selection=7
WINDOW; reset window to full screen
ERASE
CANCEL
ENDCASE
WINDOW 2,20
ENDDO
**** END OF MEMBERS.PRG main program module
PROCEDURE start_rec
CLEAR gets
mkey=blank(10)
ERASE
TEXT
ENTER ESTIMATE OF LAST NAME -
up to 10 characters
LAST NAME: @mkey
ENDTEXT
READ
MKEY = !(trim(mkey)) ; get rid of trailing blanks
FIND &mkey
IF #=0 ; no find - so go to next record
GOTO :near
ENDIF
ENDPROCEDURE; start_rec
PROCEDURE over1
REPLACE cust_no#1 with cust_no#2
REPLACE lname#1 with lname#2
REPLACE fname#1 with fname#2
REPLACE street#1 with street#2
REPLACE city#1 with city#2
REPLACE state#1 with state#2
REPLACE zip#1 with zip#2
REPLACE home_phone#1 with home_phone#2
REPLACE work_phone#1 with work_phone#2
ENDPROCEDURE; over1
PROCEDURE over2
REPLACE cust_no#2 with cust_no#1
REPLACE lname#2 with lname#1
REPLACE fname#2 with fname#1
REPLACE street#2 with street#1
REPLACE city#2 with city#1
REPLACE state#2 with state#1
REPLACE zip#2 with zip#1
REPLACE home_phone#2 with home_phone#1
REPLACE work_phone#2 with work_phone#1
ENDPROCEDURE; over2
** end of MEMBERS.PRG **