HP 3000 Manuals

Model Program [ TurboIMAGE/XL Database Management System Reference Manual ] MPE/iX 5.0 Documentation


TurboIMAGE/XL Database Management System Reference Manual

Model Program 

This section shows the model for the example programs that run against
the ORDERS database.  You may wish to skip this section if you are an
experienced TurboIMAGE/XL programmer.

The main entry point for the application is a numbered list of functions
that can be performed by calling the various routines.  Each routine is
made up of one or more tasks that are implemented through TurboIMAGE/XL
intrinsic calls.  Each call contains one or more parameters, some of
which are used to pass their assigned values to TurboIMAGE/XL intrinsics.
These values determine the outcome of the intrinsic.  Other parameters
are used to receive data and status information from TurboIMAGE/XL
intrinsics.

This model attempts to familiarize you with generic techniques for making
TurboIMAGE/XL intrinsic calls.  Additionally, the model reiterates the
importance of defining TurboIMAGE/XL transactions for logging and
recovery.

The conventions used throughout the model and the structure of the
program are explained immediately preceding the model program.

ORDERS Database Schema 

Figure 6-1  contains the list file output printed when the schema of
the sample ORDERS database is processed.  This schema is shown earlier in
chapter 3, but is repeated here for easy reference when reading through
the model program.  Use it to refer to the data set and data item names
used in the model program.


NOTE Because the Schema Processor, DBSCHEMA, upshifts alphabetic characters, programs must specify data set and data item names in all uppercase characters. Take note of this if the programming language you use does not require uppercase characters.
______________________________________________________________________________ | | | PAGE 1 | | | | HEWLETT-PACKARD 30391C.05.00 TurboIMAGE/3000: DBSCHEMA TUE, JAN 11 | | | | $CONTROL LIST,LINES=46 | | $PAGE "SCHEMA FOR DATABASE ORDERS" | | | | BEGIN DATABASE ORDERS; | | | | PASSWORDS: | | 11 CREDIT; << CUSTOMER CREDIT OFFICE >> | | 12 BUYER; << BUYER - RESPONSIBLE FOR PARTS INVENTORY >> | | 13 SHIP-REC; << WAREHOUSE - SHIPPING AND RECEIVING >> | | 14 CLERK; << SALES CLERK >> | | 18 DO-ALL; << FOR USE BY MGMT >> | | | | ITEMS: << IN ALPHABETICAL ORDER FOR CONVENIENCE >> | | ACCOUNT, J2 ; << CUSTOMER ACCOUNT NUMBER>> | | BINNUM, Z2 (/13); << STORAGE LOCATION OF PROD>> | | CITY, X12 (12,13,14/11); << CITY>> | | CREDIT-RATING, R2 (/14); << CUSTOMER CREDIT RATING>> | | DATE, X6 ; << DATE (YYMMDD)>> | | DELIV-DATE, X6 (/14); << DELIVERY DATE (YYMMDD)>> | | DESCRIPTION, X20 ; << PRODUCT DESCRIPTION>> | | FIRST-NAME, X10 (14/11); << CUSTOMER GIVEN NAME>> | | INITIAL, U2 (14/11); << CUSTOMER MIDDLE INITIAL>> | | LAST-NAME, X16 (14/11); << CUSTOMER SURNAME>> | | LASTSHIPDATE, X6 (12/ ); << DATE LAST REC D(YYMMDD)>> | | ONHANDQTY, J2 (14/12); << TOTAL PRODUCT INVENTORY>> | | PRICE, J2 (14/); << SELLING PRICE (PENNIES)>> | | PURCH-DATE, X6 (11/14); << PURCHASE DATE (YYMMDD)>> | | QUANTITY, I (/14); << SALES PURCHASE QUANTITY>> | | STATE, X2 (12,13,14/11); << STATE -- 2 LETTER ABB>> | | STOCK#, U8 ; << PRODUCT STOCK NUMBER>> | | STREET-ADDRESS, X26 (12,13,14/11); << NUMBER AND STREET ADDRESS>> | | SUPPLIER, X16 (12,13/); << SUPPLYING COMPANY NAME>> | | TAX, J2 (14/); << SALES TAX (PENNIES)>> | | TOTAL, J2 (11,14/); << TOTAL AMOUNT OF SALE (PENNIES)>>| | UNIT-COST, P8 (/12); << UNIT COST OF PRODUCT>> | | ZIP, X6 (12,13,14/11); << ZIP CODE>> | | | | SETS: | | NAME: DATE-MASTER,AUTOMATIC,DISC1; <<DATE MASTER>> | | ENTRY: DATE(3); | | CAPACITY: 365; | ______________________________________________________________________________ Figure 6-1. ORDERS Database Schema Listing _____________________________________________________________________________ | | | PAGE 2 SCHEMA FOR DATABASE ORDERS | | | | NAME: CUSTOMER,MANUAL(14/11,18),DISC1; <<CUSTOMER MASTER>> | | ENTRY: ACCOUNT(1), | | LAST-NAME, | | FIRST-NAME, | | INITIAL, | | STREET-ADDRESS, | | CITY, | | STATE, | | ZIP, | | CREDIT-RATING; | | CAPACITY: 201; | | | | NAME: PRODUCT,MANUAL(13,14/12,18),DISC1;<<PRODUCT MASTER>> | | ENTRY: STOCK#(2), | | DESCRIPTION; | | CAPACITY: 300; | | | | NAME: SUP-MASTER,MANUAL(13/12,18),DISC1; <<SUPPLIER MASTER>> | | ENTRY: SUPPLIER(1), | | STREET-ADDRESS, | | CITY, | | STATE, | | ZIP; | | CAPACITY: 201; | | [REV BEG] | | NAME: INVENTORY,DETAIL(12,14/13,18),DISC2; <<INVENTORY DETAIL>>| | ENTRY: STOCK#(PRODUCT), | | ONHANDQTY, | | SUPPLIER(!SUP-MASTER), <<PRIMARY PATH>> | | UNIT-COST, | | LASTSHIPDATE(DATE-MASTER), | | BINNUM; | | CAPACITY: 1800, 450, 10%; | | | | NAME: SALES,DETAIL(11/14,18),DISC2; <<SALES DETAIL>> | | ENTRY: ACCOUNT(CUSTOMER(PURCH-DATE)), | | STOCK#(PRODUCT), | | QUANTITY, | | PRICE, | | TAX, | | TOTAL, | | PURCH-DATE(DATE-MASTER), | | DELIV-DATE(DATE-MASTER); | | CAPACITY: 1800, 504, 112; | | END.[REV END] | _____________________________________________________________________________ Figure 6-1. ORDERS Database Schema Listing (Continued) [REV BEG] _________________________________________________________________________ | | | PAGE 3 SCHEMA FOR DATABASE ORDERS | | | | DATA SET TYPE FLD PT ENTR MED MAXIMUM BLK BLK DISC | | NAME CNT CT LGTH REC CAPACITY FAC LGTH SPACE| | | | DATE-MASTER A 1 3 3 26 365 19 496 96 | | CUSTOMER M 9 1 41 52 201 7 365 96 | | PRODUCT M 2 2 14 31 300 16 497 80 | | SUP-MASTER M 5 1 31 42 201 12 505 80 | | INVENTORY D 6 3 20 32 1800 15 481 128 | | INITIAL CAPACITY: 450 INCREMENT ENTRIES: 45 | | SALES D 8 4 19 35 1008 14 491 160 | | INITIAL CAPACITY: 504 INCREMENT ENTRIES: 112 | | | | TOTAL DISC SECTORS INCLUDING ROOT: 672 | | | | NUMBER OF ERROR MESSAGES: 0 | | ITEM NAME COUNT: 23 DATA SET COUNT: 6 | | ROOT LENGTH: 1176 BUFFER LENGTH: 505 TRAILER LENGTH: 256 | | ROOT FILE ORDERS CREATED. | _________________________________________________________________________ Figure 6-1. ORDERS Database Schema Listing (Continued) [REV END] Model Program Conventions The following conventions are used throughout the model. n Refers to the option number assigned to each function shown in the main body of the program. _ Indicates an intentional blank. ACCESS Indicates the user access mode, or how the database was opened for a particular routine. Note that for this model the user access mode is always 1 (shared modify access). Buffer_Name is made up Indicates that a data structure is being used. of Buffer_Name is data item name the name given to the structure, and data item name is the data item name name given to the individual parts of that record. data item name data item name BEGIN MAIN LINE Indicates the beginning of the main body of the program. BEGIN ROUTINE Indicates the beginning of a routine. CALL procedure Calls the specific TurboIMAGE/XL intrinsic or internal procedure to be used in this particular portion of the routine, and specifies the values for each parameter. CALLED BY Refers to that portion of the program which called the routine. CALLS Specifies the TurboIMAGE/XL intrinsic (library procedure) or the internal program procedure called by the routine. Note that the intrinsics are listed in the order in which they are used in the routine; as a result, some may be listed more than once. Note that the mode for each call is also shown. DISPLAY Displays any specified data. END LOOP Indicates the end of an iterative block. END MAIN LINE Indicates the end of the main body of the program. END ROUTINE Indicates the end of a routine. ERROR CHECKING If error found, calls a routine that checks the contents of the status array to determine what action to take. EXIT LOOP condition Indicates the condition which terminates an iteration. Not_Used_Parm Indicates a dummy parameter when a particular intrinsic call does not use a specific parameter. OBJECTIVE States the purpose of each routine. OBTAIN <--user input Allows the user to enter the required information interactively. OBTAIN parameter<--value Indicates the assignment of a value to a parameter. ______________________________________________ NOTE For Pascal programmers only: Note that parameters cannot be odd-byte aligned. ______________________________________________ RETURN Transfers control to the beginning of the iterative block in which it is used. START LOOP Indicates the beginning of an iterative block.


MPE/iX 5.0 Documentation