by George Stachnik
In the last few installments, we've learned how to perform a few simple but practical tasks using HP's IMAGE/SQL database management system. We've created an IMAGE/SQL database, and seen how to begin accessing it using QUERY. I have tried, in this series, to take a very practical approach to the HP 3000, and to IMAGE/SQL in particular. Rather than spending a lot of time on theory, I've tried to focus on how to get the job done, and to talk about theory only in that context. This time around, we're going to step out of that pattern and look at the design of IMAGE/SQL applications. We will define an application to be a collection of computer programs and related components (documentation, hardware, etc.) that all work together to perform a particular task. One of the most important aspects of designing an application is figuring out just exactly how the programs are going to work together. Way back in the 1970s, when the HP 3000 was introduced to the market, most applications were designed to run as batch jobs. Batch applications processed information in much the same way as an assembly line processed parts. Consequently, designing batch applications has a lot in common with designing an assembly line. A batch application was made up of a collection of programs, each of which accepted data from one or more input files. Each program transformed the data somehow (sorted it, combined it, separated it) and produced one or more output files, which were in turn used as input files for the next program in the assembly line. Eventually, at the end of the line, the application produced something that people could use, typically a report of some kind. Batch applications also typically stored some information permanently. This permanent repository came to be known as a master file. The HP 3000 came along at a time when database technology was transforming the way computers processed information. Business people were not happy with the constraints placed upon them by the batch assembly line way of processing information. Batch applications forced them to hand transactions over to a computer operator who would collect them together into "batches" (hence the name "batch job"). The batch would then be fed to the assembly line. Depending on how often this was done, users would have to wait for days or even weeks for the results of their transactions to come back to them. Not surprisingly, this was not what most users had in mind. They wanted to be able to enter their transactions into the computer themselves and get the results back immediately. Thus, the idea of an online application was born. The most popular platform for the creation of batch applications had been IBM's mainframes. When the online revolution began to roll over the information processing industry, IBM tried to adapt its mainframe platform to simultaneously support both batch and online environments. They were reasonably successful in doing this, but at a cost. Mainframes may have been good at processing batch jobs, but they made very inefficient and expensive online machines. Many computer vendors (notably HP) saw this as an opportunity to take some market share away from IBM. They figured out that online applications could be designed and run much more efficiently (that is, cheaply) on a machine that was designed and built specifically for that purpose. Thus the HP 3000 was designed and built primarily as an online machine that could also be used as a batch processor. Unlike the IBM mainframe, which was a fabulously cost-effective batch processor but an expensive and clunky online platform, the HP platform was an amazingly cheap and efficient online machine and a fair-to-middling batch platform. HP determined that many of the technologies that had been used to create batch applications (for example, languages such as COBOL) could be used just as well for the design and creation of new online applications. Hence, COBOL (which had been the language of choice in the batch world) quickly became the lingua franca of the HP 3000 online world as well. But there were a number of key differences in the technologies that were required to create batch and online applications. The first, and most obvious, was the need for terminals. HP's MPE operating system used an ingenious system of device independence, which treated terminals as if they were files, thus simplifying the programming required to interface these new devices to COBOL applications. The second, and far more revolutionary requirement, was the need for a database management system, or DBMS. The Birth of Database Management Systems We've seen that batch applications stored data in an ordinary file called a master file. Architecturally speaking, a master file wasn't anything special. A batch application's master file was little more than a sorted collection of records that could be accessed sequentially or directly using a record number. In some cases, the master file might be accessed using a key--which led to the development of KSAM. But the most important thing to understand about master files and batch applications is that the master file was never accessed by more than one program at a time. Batch application programs ran sequentially--one at a time--assembly-line fashion. Online applications changed all that. With the advent of online applications, designers suddenly had to deal with the fact that an online application's data would be accessed not by one program at a time, but by multiple programs, each of which operated on the data in different ways. To complicate things further, each program could be used by multiple users at the same time. At the time, this represented an apparently insoluble problem for application designers. To designers of traditional batch applications, the online world represented nothing less than chaos. Instead of a well-ordered assembly line, an online world seemed more like a football game--with gangs of unruly users all trying to get the ball (i.e., the data) at the same time. Clearly, the software technologies that had been used to create batch assembly lines were not up to solving what soon became known as "the football problem": How do you control access to the data so that users can do what they want to do when they want to do it, and at the same time protect the data so that it doesn't become corrupted? How do you plan for the scenario in which two or more users need to update a particular file (or a particular record within a file) at the same time? Experiments soon showed that traditional batch technologies would either corrupt the file or force each user to wait so long that no user would use the system. Hence the database management system (DBMS) was born. By the mid 1970s, most computer vendors, (IBM, DEC, HP) had created DBMS products and were offering them for sale. But HP leapfrogged its competition with a bold move. When it brought its HP 3000 business minicomputer to the market, it bundled the IMAGE DBMS with the system. Other vendors were still treating database technology as an add-on--something that their more adventurous customers would have to pay for. HP wisely figured out that most HP 3000 applications were going to need database technology if they were going to be successful. So instead of trying to gouge customers out of a few extra bucks for it, they effectively gave it away with the 3000. The results can still be seen today. As the IMAGE DBMS has evolved (changing its name, first to TurboIMAGE, then to IMAGE/SQL), virtually every HP 3000 application continued to use IMAGE database technology. It's important to understand that IMAGE's broad acceptance in the HP 3000 community was not due only to the fact that the price was right (that is, free). IMAGE won awards in its day because of the unique and simple solutions it provided to the fundamental problems facing application programmers in the 1970s. Most notably, IMAGE provided a neat and simple solution to the football problem that is still applicable in today's world. Solving The Football Problem The first step in solving the so-called "Football problem" was to divide users up into classes. We've already seen how IMAGE does this in the last three articles in this series. We saw that each dataset and each data-item in an IMAGE database is associated with a list of class numbers. Each class number represents a certain class of users. An individual user may have access to a particular database. But he may or may not have access to all the records (data entries) in the database, or to all the fields (data-items) in the records. Figure 1 shows the class numbers in the sample database schema that we've been using in these articles. They are defined in the PASSWORDS section, and referenced in the ITEMS section and the SETS section. Contrast this with the way batch applications work. With the ordinary files used in batch systems, an individual user either has access to a file or he doesn't. If a user does have access to a file, he has access to all the data in that file. Figure 1: Class Numbers BEGIN DATA BASE ORDERS; << CUSTOMER ORDERS >> PASSWORDS: 4 CLERK; << SALES CLERK >> 8 SUPER; << SUPERVISOR OF CUSTOMER ORDERS DEPARTMENT >> 15 DO-ALL; << PROGRAMMER/ANALYST - CREATOR OF DATA BASE>> ITEMS: << (READ / WRITE) >> ACCOUNT, X6 (4,8,15/8,15); << CUSTOMER ACCT=AA-NNN >> CITY, X14 (4,8,15/8,15); << CUSTOMER CITY >> . . . ZIPCODE, X6 (4,8,15/8,15); << CUSTOMER ZIPCODE >> SETS: NAME: CUSTOMER,MANUAL(4,8,15/8,15); ENTRY: ACCOUNT(1), . . . CAPACITY: 1231; END.IMAGE's Database Access Modes The second step in solving the football problem is to control what application programs can do. Figure 2 shows how this is accomplished. In this example, we're using QUERY to open a database called orders. We are prompted for a password. How we respond to this prompt will determine what class number we are assigned, and therefore what data we can or cannot access. Figure 2: Opening a Database with QUERY :RUN QUERY.PUB.SYS HP32216D.03.11 QUERY/3000 TUE, SEP 7, 1999, 11:30 AM COPYRIGHT HEWLETT-PACKARD CO. 1976 >DATA-BASE=ORDERS PASSWORD = >> MODE = >>1 >FORM SETS DATA BASE: ORDERS TUE, SEP 7, 1999, 11:30 AM DATA BASE LANGUAGE ATTRIBUTE: NATIVE-3000 ITEM CURRENT ENTRY ENTRY BLOCKING SETS: TYPE COUNT CAPACITY COUNT LENGTH FACTOR CUSTOMER M 6 201 0 39 10 DATE-MASTER A 1 211 0 3 36 SALES D 8 1245 0 26 15In a future article in this series, we'll see that database passwords may not always be handled the way QUERY handles them. In some applications, the passwords may actually be hard-coded into the application program itself. In that case, the level of access that a user has to a database is not a function of what passwords he knows, but of what program(s) he runs. We'll explore password management in more detail in a future article. In the example shown in Figure 2, we are also prompted for a mode. Like database passwords, the mode may be something you prompt the user for (as QUERY does), but it's more likely to be something that's hard coded in a typical application program. In the previous article of this series, we introduced you to QUERY and brushed over this mode very quickly. IMAGE/SQL allows database access in a variety of different modes, and each one is identified with a number (1, 2, 3, and so forth). The mode that you select in Query determines whether or not you will be able to add records to the database, update existing records, or share the database with other users. It also determines what other users will be able to do. Last time, we used mode 1 without any explanation beyond the fact that mode 1 allowed us to add records to the database (assuming that we've entered an appropriate password). Now it's time to understand what the mode really means. First of all, the mode is not unique to QUERY. Any program that wants to access an IMAGE database must begin by opening it. In a future article, we'll take a look at the actual MPE intrinsics used to access an IMAGE database from a user-written program, but for now, suffice it to say that everything you learn about Query's Mode prompt will be equally applicable to other application programs. In other words, no matter how you choose to access an IMAGE database, the rules for database access modes still apply. IMAGE recognizes three different kinds of access to the data it controls:
George Stachnik works in technical training in HP's Network Server Division. |