Download presentation
Presentation is loading. Please wait.
Published byHector Patrick York Modified over 6 years ago
1
Exercise Open the Store database and copy the m-customer dataset into a file called Custfile Then look at the contents of Custfile >base store >get m-customer >output custfile >xeq >input custfile >output * >list >list char In addition to Output *, try these commands: List List Char 14 Answers to Module 1 14
2
Exercise GET versus CHAIN: quick, choose one!
Ord-Line detail dataset has2.3 million records of 308 bytes Ordfile has 162,000 key values which will select 261,000 records chain ord-line,ord-num=my-table table my-table,ord-num,file-ordfile output myfile xeq get ord-line table my-table,ord-num,file,ordfile if $lookup(my-table,ord-num) sort ord-num output myfile xeq The Chain method will use 162,000 disc reads for Dbfinds, and 261,000 reads for Dbgets, resulting in a total of 423,000 disc reads. Because Suprtool maintains the Ord-nums in the table in sorted sequence, and the Chain command reads the records in the table sequence, there is no need to sort the records. They will be retrieved in the desired order. The Get command reads many contiguous records with each disc access. Each Get reads 50,000 bytes, so Suprtool will read 162 records with each disc read. At 162 records per read, the entire 2.3 million record dataset will be read using only 14,197 disc reads. Compared to Chain's 423,000 disc reads, that's a saving of 98.7 percent of the I/O. It's true that using the Get method you must sort the records, but adding the sort still results in a major saving over the Chain method. With the Ord-line dataset, the Get command will always take 14,197 reads, regardless of the number of records selected. However, the performance of Chain will depend on the number of Ord-nums and records selected. If there are few enough records to be selected, Chain will be faster. So, while it may be more intuitive to do a chained read when you have index values of the required records, it is often more efficient to read the whole dataset sequentially and simply not select the unwanted records. When in doubt, use the GET command to read the dataset sequentially, with Set Statistics On. If the "Input FREAD calls" returned is less than the number of records selected, Get will be faster than Chain. 13 This was published in the What’s Up, DOCumentation newsletter, 1994 issue #6. Answers to Module 2 13
3
Exercise Create a listing of the Alberta customers
Create the following report from the STORE database: Mar 20, : Alberta Customers Page 1 Account# Name City Rogers Edmonton Coyle Edmonton Frahm Calgary Tiernan Calgary Young Edmonton Bamford Edmonton Morrison Calgary Johnston Calgary >base store >get m-customer >if state-code = "AL" >extract cust-account >extract name-last >extract city >list standard,& >>title "Alberta Customers",& >>heading "Account# Name City" >sort cust-account >xeq 21 Answers to Module 2 21
4
Exercise Duplicates, Duplicates, Duplicates, Duplicates
Exercise 1: Create a list of all the states/provinces in which we have customers. Exercise 2: List all the dates on which we made more than one sale. Bonus Exercise 3: List all the sales made on those dates. Hints: requires two passes, and the Table command *** Exercise 1 >base store >get m-customer >sort state-code >duplicate none keys >extract state-code >list standard >output states,link >xeq *** Exercise 2 and first pass of Exercise 3 >get d-sales >sort purch-date >duplicate only keys >extract purch-date >output purchdt,link *** Second pass of Exercise 3 >table date-tbl,purch-date,sorted,purchdt >if $lookup(date-tbl,purch-date) 26 Answers to Module 4 26
5
Suprlink Exercise 1 From the Store database, find all the products of British Columbia suppliers with inventories less than 20 You should include the product number, quantity in stock, as well as the supplier's name and number Solution >get d-inventory >if on-hand-qty < 20 >sort supplier-no >extract supplier-no,product-no,on-hand-qty >output prodfile,temp,link >xeq >get m-supplier >if state-code = "BC" >sort supplier-no >extract supplier-no,supplier-name >output suppfile,temp,link >xeq >link input prodfile >link link suppfile >link output listfile,temp >link xeq >input listfile;list standard;xeq 31 Answers to Module 5 31
6
Suprlink Exercise 2 Add the product price to the list in Exercise 1 (page 31) SUPPLIER- PRODUCT-N ON-HAND-QTY SUPPLIER-NAME Makita Canada Inc Makita Canada Inc Makita Canada Inc Makita Canada Inc Black & Decker ... Solution >get d-sales >sort product-no >item product-price,decimal,2 >extract product-no,product-price >output descfile,temp,link >xeq >input listfile >sort product-no >output = input >xeq >link input listfile >link link descfile >link output ordrfile temp >link xeq [COMPLETE PRICE LIST IN DEMO] 40 Answers to Module 5 40
7
HTML Exercise Create an HTML Table that looks like this: 16
>export input custsale >export html table title "Purchase History" & heading "Customer Purchase History" >export date mmddyy "-" invalid " " >export sign none >export heading none >export heading column "Acct #” >export heading column "Surname" >export heading column "Given Name" >export heading column "Credit Limit" >export heading column "Total Amount Purchased" >export heading column "# of Purchases" >export heading column "Earliest Purchase" >export heading column "Latest Purchase" >export purge htmlout >export output htmlout >export xeq 16 Answers to Module 6 16
8
HowMessy Exercise #1 (Master)
Secon-Max Type Load daries Blks Blk Data Set Capacity Entries Factor (Highwater) Fact A-MASTER Ato % 36.8% Max Ave Std Expd Avg Ineff Elong- Search Field Chain Chain Dev Blocks Blocks Ptrs ation MASTER-KEY % 1.88 Suggestions: The number of secondaries, MaxBlks, MaxChain and Inefficient pointers are a bit high. Look at the search item data type. There is a possibility that some clustering is happening here. MaxChain could be an indication but with a dataset of this size, it is hard to tell for sure. 16 Answers to Module 11 16
9
HowMessy Exercise #2 (Detail)
Secon-Max Type Load daries Blks Blk Data Set Capacity Entries Factor (Highwater) Fact D-ITEMS Det % ( ) 7 Max Ave Std Expd Avg Ineff Elong- Search Field Chain Chain Dev Blocks Blocks Ptrs ation S ! ITEM-NO % S SUPPLIER-NO % LOCATION % BO-STATUS % DISCOUNT % 10.55 Suggestions: The Highwater mark is more than twice the number of entries. Repacking would definitely help serial scans. Primary path should be on the Supplier-no or Location search path There might some logical inconsistency on the Itemno search path. The average chain is1.00 and MaxChain is 3. There is a good chance there should be only one entry per item number. If that is the case, the sorted path on Itemno is probably not needed The BO-STATUS path is unnecessary. MaxChain and AveChain are very high, probably equal. The current number of entries can be stored in 17,031 blocks which is the number of expected blocks for this path. This indicates that all the entries contain the same value. The last path, DISCOUNT, could possibly be removed. You have to look at how it is used and the access frequency. MaxChain is very high indicating that a large number of records have the same value. Reading along this chain will be very slow. Unlike BO-STATUS, there are entries with other values with much smaller chains as indicated by AveChain and StdDev. Reading along these chains will be fairly fast. 27 Answers to Module 11 27
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.