Drumheller Trick

One of the primary developers of what became Prime Information was John Drumheller. I was employed at Prime computer and was introduced to Prime Information. In my work I came across a document that described a method of processing the data in a file using an efficient method that was attributed to John Drumheller. Typically in processing the data in a file you would select the records you wish to process, which requires reading every record in the file. Then you would process those selected records which required a second reading of the records. If your processing touched each record, you would have read each record in the file twice!

The “trick” is to only read the records once. To do this, create a subroutine that can be called from a dictionary record. The dictionary record should always return a false result, either 0 or “”. The subroutine should perform the processing required on the record. Then you can use the LIST command to list the file to be processed with the dictionary record that contains the subroutine. As the LIST command looks at each record, it calls the subroutine, processes the record and since it returns a false, it continues on. When the LIST command completes, it will have processed each record in the file reading the record only once. The result of the LIST command will generate little or no output.

The LIST command would look something like the following.

LIST filename WITH subroutine_dictionary_record

Sometimes the Simple Things… Dictionary Ideas

Sometimes its the simple things in life. I have a favorite Dictionary record I’d like to share with all of you. It is the constant “1”. What can you do with a Dictionary Record of “1”? First, create a dictionary record with the constant “1” and call it “ITEMS” (see below).

Then if you want to know how many employees you have in each department (Assuming you have an EMPLOYEE file with a DEPT attribute)

LIST EMPLOYEE BREAK-ON DEPT BY DEPT TOTAL ITEMS DET-SUPP ID-SUPP (Your flavor of mutlivalue may vary on this)

You will get a list of departments with the number of employees in each department.

So anything you need to know how many of a certain type of item is in your file, you can modify the above query to provide that information.

Pick Flavor Dict Item (Thanks to Clif Oliver)


0001 S
0002 0
0003 ITEMS
0008 F;C1
0009 R
0010 8

Information Flavor Dict Item


0001 I
0002 1
0004 ITEMS
0005 8R
0006 S