AT&T 6300 Programmer's Manual page 118

Gwbasic by microsoft
Hide thumbs Also See for 6300:
Table of Contents

Advertisement

Disk File Handling
4-34
The following example is an inventory program
that illustrates random file access. In this
program, the record number is used as the part
number, and it is assumed the inventory will
contain no more than 100 different part
numbers. Lines 900 through 960 initialize the
data file by writing CHR$(255) as the first
character of each record. This is used later (line
270 and line 500) to determine whether an entry
already exists for that part number.
Lines 140 through 210 display the different
inventory functions that the program performs.
When you type in the desired function number,
line 230 branches to the appropriate subroutine.
1200PENUR",#1,UINVEN.DAT",39
130 FIELD#1,1 AS FS,30 AS DS,2 AS OS,2 AS RS,4 AS PS
140 PRINT:PRINT uFUNCTIONS:":PRINT
150 PRINT 1,uINITIALIZE FILE"
160 PRINT 2,uCREATE A NEW ENTRY"
170 PRINT 3,uDISPLAY INVENTORY FOR ONE PART"
180 PRINT 4,uADD TO STOCK"
190 PRINT 5,uSUBTRACT FROM STOCK"
200 PRINT 6,uDISPLAY ALL ITEMS BELOW REORDER LEVEL"
210 PRINT:PRINT:INPUT"FUNCTION"jFUNCTION
220 IF [FUNCTION >1)OR[FUNCTION >6) THEN PRINT uBAD
FUNCTION NUMBER":GOTO 140
230 ON FUNCTION GOSUB 900,250,390,480,560,680
240 GOTD 140
250 REM BUILD NEW ENTRY
260 GOSUB 840
270 IF ASC[FS)< >255 THEN
INPUT"OVERWRITE"jAS:
IF AS uY" THEN RETURN

Advertisement

Table of Contents
loading

Table of Contents