NOTE |
Use of file inquiry logic. This program queries an inventory file. It reads the dictionary of file INV to get the attribute numbers of DESC (description) and QOH (quantity on hand). The program then prompts the user for a part number, which is the item-ID of an item in INV, and uses the attribute numbers to read and display the part description and quantity on hand. The program loops until a null part number is entered. |
*--- Get attribute definitions from dict of inventory file OPEN 'DICT', 'INV' ELSE PRINT 'CANT OPEN "DICT INV"'; STOP READV DESC.AMC FROM 'DESC',2 ELSE PRINT 'CANT READ "DESC" ATTR'; STOP END READV QOH.AMC FROM 'QOH',2 ELSE PRINT 'CANT READ "QOH" ATTR'; STOP END *--- Open data portion of inventory file OPEN '', 'INV' ELSE PRINT 'CANNOT OPEN "INV"'; STOP *--- Prompt for part number 100 PRINT PRINT 'PART-NUMBER ': INPUT PN IF PN = '' THEN PRINT '--DONE--'; STOP *--- Read data from files READV DESC FROM PN, DESC.AMC ELSE PRINT 'CANT FIND THAT PART'; GOTO 100 END READV QOH FROM PN, QOH.AMC ELSE QOH=0 *--- Print description and quantity-on-hand PRINT 'DESCRIPTION -': DESC PRINT 'QTY-ON-HAND -': QOH GOTO 100 END |
See Also