Getting Started with TRANSACT/V HP 3000 MPE/iX Computer Systems Edition 2 Manufacturing Part Number: 32247-90007 E0788 U.S.A.
Notice The information contained in this document is subject to change without notice. Hewlett-Packard makes no warranty of any kind with regard to this material, including, but not limited to, the implied warranties of merchantability or fitness for a particular purpose. Hewlett-Packard shall not be liable for errors contained herein or for direct, indirect, special, incidental or consequential damages in connection with the furnishing or use of this material.
Contents 1. Getting Started Compiling and Executing Transact Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Reporting From a Dataset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Getting a Complete Listing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Sorting the Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Contents Form Independence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .157 Adding, Deleting, and Changing Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .161 User Exits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .170 Transactions Across Multiple Datasets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Figures Figure 1-1. . Compiling and Executing a TRANSACT Program . . . . . . . . . . . . . . . . . . . . 15 Figure 1-2. . Program to Display a Dataset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Figure 1-3. . Report from a Single Dataset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Figure 1-4. . Program to Sort and Report Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Figure 1-5. .
Figures Figure 2-8. . Program to Update Data in a Dataset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .42 Figure 2-9. . Interactive Updating of a Dataset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .43 Figure 2-10. . Program Using a Record Already Retrieved . . . . . . . . . . . . . . . . . . . . . . . . .44 Figure 2-11. . Program to Change a Key Field Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . .45 Figure 2-12. . Changing a Key Field Value. . . . . .
Figures Figure 3-15. . VPLUS Form for Customer Header . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 Figure 3-16. . VPLUS Form to be Appended . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 Figure 3-17. . Program with VPLUS Freeze and Append . . . . . . . . . . . . . . . . . . . . . . . . . . 69 Figure 3-18. . Result of VPLUS Freeze and Append . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 Figure 3-19. . VPLUS Form for Main Menu . . . . . . . . .
Figures Figure 6-3. . Comparable PASCAL Data Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .97 Figure 6-4. . LIST(AUTO) Equivalent with LIST. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .98 Figure 6-5. . VPLUS Default with no LIST= . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .98 Figure 6-6. . VPLUS Explicit LIST= . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .99 Figure 6-7. . LIST= Item Range . . . . .
Figures Figure 8-6. . Report/V Program to Create Backlog Report . . . . . . . . . . . . . . . . . . . . . . . . 122 Figure 8-7. . Using Report/V Without the Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 Figure 8-8. . One Dimensional Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 Figure 8-9. . One Dimensional Array (Continued) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 Figure 8-10. .
Figures Figure 9-11. . Screen Independence, Form Cross Reference File . . . . . . . . . . . . . . . . . . .160 Figure 9-12. . Customer Main Menu, Change Size of cust-no . . . . . . . . . . . . . . . . . . . . .161 Figure 9-13. . Marketing Customer Update, Change Size of cust-no . . . . . . . . . . . . . . . .161 Figure 9-14. . Finance Customer Update, Add, Change, Delete Elements . . . . . . . . . . .162 Figure 9-15. . AP Customer Update, Add, Change, Delete Elements . . . . . . . . . . . . . . . .
Preface This manual is intended to be used as a supplement to the Transact Reference Manual, part number 32247-90001. It illustrates many of the features of Transact through programming examples, and is designed to serve as a task-oriented learning aid. Readers are expected to be programmers who have a working knowledge of at least one programming language. They should also understand the basic concepts of the IMAGE database system, Dictionary/V and VPLUS.
1 Getting Started This document is designed to give the novice Transact user a easy-to-use starting point from which to quickly gain an understanding of the language. Beginning with a simple three-line program to display the data in a dataset, we move on to introduce many of the important concepts of Transact, always with simple, yet complete, programs. Later sections point up some of the ways Transact can be most beneficially used to increase programming efficiency.
Getting Started Compiling and Executing Transact Programs Compiling and Executing Transact Programs Transact programs are written using an editor such as EDIT/V or TDP. The source is then compiled using TRANCOMP and the resulting program is executed using TRANSACT. If you are using DICTIONARY/V to hold the definition of your database, TRANCOMP expects the dictionary to be called DICT and to reside in the PUB group.
Getting Started Compiling and Executing Transact Programs Figure 1-1. Compiling and Executing a TRANSACT Program 1 :file dict.pub=dict 2 :run trancomp.pub.sys 3 TRANSACT/3000 COMPILER 4 SOURCE FILE> ex1 5 LIST FILE> 6 CONTROL> 7 TRANSACT/3000 COMPILER 8 LISTING OF FILE EX1.HOWTO.MILLER 9 COMPILING WITH OPTIONS: LIST,CODE,DICT,ERRS HP32247A.02.02 - (C) Hewlett-Packard Co. 1984 A.02.02 : TUE, MAR 19, 1985, 11:07 AM COMPILED 10 1.000 11 2.000 0000 list(auto) customer; 12 3.
Getting Started Compiling and Executing Transact Programs Let’s look at what is happening in the above example on a line by line basis. 1 By default, the compiler TRANCOMP expects the user dictionary to be in the PUB group of the logon account. We are changing the default to be the logon group by issuing a file equation. 2 We run the Transact compiler to transform the source input into intermediate code which can then be executed using the processor (see line 18 below).
Getting Started Reporting From a Dataset Reporting From a Dataset The first program we look at is a simple, three-line program to report the contents of a dataset. Then we will expand this program and give it many more capabilities as the section progresses. However, this should not be viewed as implying that Transact is a report writer.
Getting Started Reporting From a Dataset street-addr: city-state: zipcode; A statement is terminated with a semicolon. Within the statement, item names are separated by colons. 3 The OUTPUT verb sets up a data retrieval and reporting loop; the (SERIAL) option specifies that the customer set be read serially and that each item of each record be retrieved and reported. The output from this program might look like the report below. Figure 1-3.
Getting Started Sorting the Data Sorting the Data Let’s change the report to be all elements except cust-no so that it will fit on one line. Also, we will sort the report by city-state. Figure 1-4. Program to Sort and Report Data 1 system ex2,base=orders; 2 list name: street-addr: city-state: zipcode; 3 output(serial) customer,sort=(city-state); 2 Since we do not want access to all items from the customer set, we must individually list the items that we do want.
Getting Started Sorting the Data Either of these programs produces a report that looks like the one below: Figure 1-6. The Sorted Report on Customers NAME: STREET-ADDR: CITY-STATE: ZIPCODE: Hold A Hill Planter 651 El Camino Dallas, Texas 45623 Balcon's Bridal 1775 Capitol Express Fresno, Ca. 98167 Hobie Cat 3410 Monterey Rd Gilroy, Ca. 96144 Furtado Inports 1396 E Santa Clara Los Angeles, Ca. 90189 Cobalt Boats 2250 San Ramon Louisville, Ky.
Getting Started Sorting the Data Formatting Options The FORMAT verb also provides extensive reporting options for such things as field editing, heading text, line breaks, column positioning, etc. The following program illustrates a few of the options available on the FORMAT verb. Figure 1-7. Options for FORMAT 1 system ex2b,base=orders; 2 list(auto) customer; 3 format $today,edit="3w.
Getting Started Sorting the Data 10 Line 10 prints rint the city and state immediately under the street address and suppresses generation of a column heading. 11 The JOIN= option specifies that this item is to be joined to the previous item by leaving only one blank space between the two items. For example, the data item CITY-STATE is 20 bytes long. It only takes 13 bytes to store the value “San Jose, Ca.”. Thus there are 7 trailing blanks in the CITY-STATE item for this value.
Getting Started Sorting the Data Selective Reporting Now let’s see some examples of selective reporting. The first program below prints all orders for a particular customer. Figure 1-9. Program to Select Data for Reporting 1 system ex3,base=orders; 2 list(auto) orderhead; 3 data cust-no; 4 set(match) list (cust-no); 5 output(serial) orderhead; 3 The DATA verb is a data entry verb. When the program is run, the user is prompted to enter the cust-no.
Getting Started Sorting the Data Here is an example of running the program listed in Figure 1-9. Figure 1-10. Report of Selected Data CUST-NO> 1 ORDER-NO: CUST-NO: ORDER-STATUS: ORDER-DATE: po1001 1 o 850101 po1002 1 o 850203 po1003 1 o 850127 po1004 1 o 850301 po1005 1 c 850212 5 RECORDS FOUND EXIT/RESTART(E/R)?> Setting up match criteria and serially reading datasets and files will work against any kind of file.
Getting Started Sorting the Data The following example is an expansion of the example in Figure 1-9. Figure 1-12. Program to Let User Set Selection Criteria 1 system ex4a,base=orders; 2 list(auto) orderhead; 3 data(match) cust-no: order-status: order-date; 4 output(serial) orderhead; We have combined lines 3 and 4 into a single DATA(MATCH) verb. This verb not only provides data entry, but also recognizes a variety of relational conditions that can be provided by the user at run time.
Getting Started Sorting the Data No relational conditions were provided for items order-status or order-date. Thus, no data is excluded based on these two items. Figure 1-14.
Getting Started Reporting from Multiple Datasets Reporting from Multiple Datasets The following program prints the customer’s name rather than the customer’s cust-no. This requires data to be retrieved from both the customer set and the orderhead set. Figure 1-15.
Getting Started Reporting from Multiple Datasets Figure 1-16 shows the report produced by this program. Figure 1-16. Report from Two Datasets CUST-NO> 1 NAME: ORDER-NO: ORDER-STATUS: Able-1 Answering po1001 o Able-1 Answering po1002 o Able-1 Answering po1003 o Able-1 Answering po1004 o Able-1 Answering po1005 c 5 RECORDS FOUND EXIT/RESTART(E/R)?> Now let’s create a program to retrieve all orders that are open, i.e., all orders that have order-status equal to “o”.
Getting Started Reporting from Multiple Datasets Figure 1-17.
Getting Started Reporting from Multiple Datasets data elements in the orderhead dataset are to be retrieved (for each record) that is selected. For each record that is retrieved, control is transferred to the label get-orderdata as specified by the PERFORM= option. 8 We use LEVEL to take advantage of some automatic housekeeping provided by Transact. This statement and the END(LEVEL) statement on line 16 specify a program area where data elements retrieved from data sets are temporarily stored.
Getting Started Reporting from Multiple Datasets Figure 1-18.
Getting Started Reporting from Multiple Datasets Figure 1-19.
Getting Started Reporting from Multiple Datasets 14 Replace the FORMAT and OUTPUT verbs with a FIND verb which performs a routine to display the data. 18 DISPLAY displays the information. The TABLE option specifies that we want Transact to print the headings at the start of each new page. The items to be reported are specified as a part of the DISPLAY verb. Our report now looks like this: Figure 1-20.
Getting Started Reporting from Multiple Datasets Figure 1-21.
Getting Started Reporting from Multiple Datasets 9 Lines 9-11 get the order information from orders before retrieving the customer information. 16 Lines 16-18 set up and retrieve the parts record for the current part number. 19 A further screening is done on the record. 20 If the record passes the screening in line 19, then lines 20-25 are performed. 21 Lines 21-23 get the customer name. An example of the report follows: Figure 1-22.
Getting Started Reporting from Multiple Datasets 36 Chapter 1
2 Using Character Mode I/O The next logical step in learning about Transact is to look at how to maintain Image datasets. This section therefore considers the three types of maintenance: adding data, changing data, and deleting data. As the programs that we examine develop in capability, we will also look at some of the useful features of Transact, like the many ways to loop, or repeat, activity, and command mode, which lets the user control program flow.
Using Character Mode I/O Adding Data to a Dataset Adding Data to a Dataset This first program adds new customers to the customer set. Figure 2-1. Program to Add Data to a Dataset 1 system ex8,base=orders(";"); 2 level; 3 prompt cust-no: name: street-addr: city-state: zipcode; 4 5 put customer; end; 1 By including the database password (“;”) in the SYSTEM statement, we avoid prompting the user for it.
Using Character Mode I/O Adding Data to a Dataset Figure 2-2. Interactive Data Entry to a Dataset CUST-NO> 301 NAME> Joe's Bike Shop STREET-ADDR> 1243 East Julian CITY-STATE> San Jose, Ca. CUST-NO> ] EXIT/RESTART(E/R)?> END OF PROGRAM : The program repeats, or loops, indefinitely. When the last customer has been added, The user stops the loop by entering the special character “]”. This character is reserved in Transact to signify the end of user interaction.
Using Character Mode I/O Adding Data to a Dataset 2 The SET(DELIMITER) statement makes the field separator a slash rather than the comma. An example of a terminal session is shown in Figure 2-4. Figure 2-4. Using a Programmer-Defined Field Delimiter CUST-NO> 303 NAME> John's Consulting STREET-ADDR> 5489 El Camino CITY-STATE> Santa Clara, Ca. ZIPCODE> 95143 CUST-NO> 304/The Flower Shop/123 1st Street/San Jose, Ca.
Using Character Mode I/O Adding Data to a Dataset Figure 2-6. Program to Check Item Entered by User 1 system ex10,base=orders(";"); 2 set(delimiter) "/"; 3 level; 4 prompt cust-no,checknot=customer; 5 prompt name: street-addr: city-state: zipcode; 6 7 put customer; end; 4 The CHECKNOT=CUSTOMER causes the cust-no input to be validated against the customer dataset to verify that an entry does not already exist.
Using Character Mode I/O Adding Data to a Dataset Updating Data in a Dataset The programs that follow demonstrate three types of updating. These are changing data for non-key items, changing data for key items, and deleting records. Figure 2-8.
Using Character Mode I/O Adding Data to a Dataset become spaces or zero, depending on whether it was an alphanumeric or numeric item. 10 UPDATE moves the record into the customer set. Figure 2-9. Interactive Updating of a Dataset CUST-NO> 305 *ERROR: NO ENTRY FOUND (IMAGE 17,9,CUSTOMER) CUST-NO> 301 CUST-NO: NAME: STREET-ADDR: CITY-STATE: ZIPCODE: 301 1243 East Julian San Jose Ca.
Using Character Mode I/O Adding Data to a Dataset Figure 2-10. Program Using a Record Already Retrieved 1 system ex12,base=orders(";"); 2 set(delimiter) "/"; 3 list(auto) customer; 4 level; 5 data cust-no,check=customer; 6 get(current) customer; 7 display; 8 data(set) name: street-addr: city-state: zipcode; 9 10 6 update customer; end; We know that Transact already retrieved the record in order to do the validation check in step 5.
Using Character Mode I/O Adding Data to a Dataset Figure 2-11. Program to Change a Key Field Value 1 system ex13,base=orders(";"); 2 set(delimiter) "/"; 3 list(auto) customer; 4 level; 5 data cust-no,check=customer; 6 get(current) customer; 7 display; 8 delete(current) customer; 9 data cust-no ("enter new cust-no"),checknot=customer; 10 data(set) name: street-addr: city-state: zipcode; 11 12 put customer; end; 8 The DELETE statement removes the old customer record.
Using Character Mode I/O Adding Data to a Dataset Figure 2-12. Changing a Key Field Value CUST-NO> 301 CUST-NO: NAME: STREET-ADDR: 301 123 Worthy Street The Cannery CITY-STATE: ZIPCODE: Waltham, Ma. 46534 enter new cust-no> 303 *ERROR: ENTRY ALREADY EXISTS (IMAGE 1,16,CUSTOMER) enter new cust-no> 302 NAME> STREET-ADDR> CITY-STATE> ZIPCODE> 46533 CUST-NO> 302 CUST-NO: NAME: 302 The Cannery STREET-ADDR: 123 Worthy Street CITY-STATE: ZIPCODE: Waltham, Ma.
Using Character Mode I/O Adding Data to a Dataset Figure 2-13. Program to Change Key Values Using REPLACE 1 system ex14,base=orders(";") 2 set(delimiter) "/"; 3 list(auto) customer; 4 level; 5 data(key) cust-no ("enter old cust-no"); 6 get customer; 7 display; 8 data(update) cust-no ("enter new cust-no") ,checknot=customer; 9 10 replace customer; end; 5 The KEY option automatically sets up the IMAGE key, preparing us to retrieve the customer record.
Using Character Mode I/O Adding Data to a Dataset Figure 2-14. Program to Delete Records 1 system ex15,base=orders(";"); 2 list(auto) customer; 3 level; 4 data(key) cust-no ("enter cust-no to delete"); 5 get customer; 6 display; 7 input "delete this customer?"; 8 if input = "Y","YES" 9 then delete(current) customer 10 11 else display "customer not deleted"; end; 7 The INPUT verb is used to get a value from the user that is to be tested by an IF statement.
Using Character Mode I/O Adding Data to a Dataset Figure 2-15. Interactively Deleting Records enter cust-no to delete> 301 CUST-NO: NAME: STREET-ADDR: 301 123 Worthy Street The Cannery CITY-STATE: ZIPCODE: Waltham, Ma. 46533 delete this customer? n customer not deleted enter cust-no to delete> 301 CUST-NO: NAME: STREET-ADDR: 301 123 Worthy Street The Cannery CITY-STATE: ZIPCODE: Waltham, Ma.
Using Character Mode I/O Looping Structures Looping Structures In most of the examples, we have used LEVEL as the way to get a program to loop. Transact also has the verbs REPEAT, UNTIL, and WHILE to control looping. For example, we could have written the last program using REPEAT as follows: Figure 2-16.
Using Character Mode I/O Looping Structures Figure 2-17.
Using Character Mode I/O Looping Structures Figure 2-18.
Using Character Mode I/O Command Mode Command Mode Much of the control of a program can be removed altogether from the program logic and put into the hands of the user via built-in commands. The following program illustrates a way to build the functions of adding, updating, and reporting customer data into a program. Figure 2-19.
Using Character Mode I/O Command Mode 3 A command is identified to Transact by the special characters “$$”. In our program we have identified four commands. These are: HELP, ADD, UPDATE, and DISPLAY. We can think of commands as entry points into a program. Typically a command will do a unit of work or a transaction. We do not need to do anything special to identify the end of a command sequence.
Using Character Mode I/O Command Mode Figure 2-20.
Using Character Mode I/O Command Mode The user merely types in the command to be executed. After Transact finishes the transaction, it prompts for the next command. The user can cause a command to be iterative by prefacing the command with the special command REPEAT as in REPEAT DISPLAY, where DISPLAY is one of the commands in our program. We can add one additional level of commands to our program, called a subcommand.
Using Character Mode I/O Command Mode Figure 2-21.
Using Character Mode I/O Command Mode Figure 2-22. User Interaction with Subcommands > help List of transactions: HELP ADD UPDATE DISPLAY > add help types of add maintenance: HELP CUSTOMER PARTS > add parts PART-NUMBER> p001 DESCRIPTION> air socket > add customer CUST-NO> 501 NAME> Foot Appeal STREET-ADDR> 323 Bottom Ave. CITY-STATE> Atlanta, Ga.
3 Using VPLUS and IMAGE This section illustrates how easily VPLUS forms can be used to maintain and get information from an IMAGE dataset.
Using VPLUS and IMAGE Adding Data to a Dataset Adding Data to a Dataset The SHOW FILE command in Dictionary/3000 reports the following for our form called vcustomer and a dataset called customer. This form and dataset are used in the following examples. Figure 3-1.
Using VPLUS and IMAGE Adding Data to a Dataset form, and the parallel data items have compatible data types and lengths. All of the forms in our formsfile are shown in appendix H. The form vcustomer is also shown below: Figure 3-2. VPLUS Form for Adding Customer Data vcustomer add a customer number [ name [ ] address [ ] city,state zipcode [ ] [ ] ] The program below causes the VPLUS form vcustomer to be displayed on the terminal.
Using VPLUS and IMAGE Adding Data to a Dataset Figure 3-4. Using Command Mode with VPLUS for Looping 1 system ex21,base=orders,vpls=formfile; 2 $$add: 3 list(auto) customer; 4 get(form) vcustomer,init; 5 put customer Another way to get the program to loop is to build the repeating structure into the program, using either a LEVEL or a REPEAT statement. The following programs show these two possibilities. Figure 3-5.
Using VPLUS and IMAGE Adding Data to a Dataset Figure 3-7.
Using VPLUS and IMAGE Updating Data in a Dataset Updating Data in a Dataset Now that we have added data to the customer dataset, how do we go about updating this data? This section shows two approaches. The only difference between the two is the way in which we ask for input of the cust-no. The first example uses the form vcustomer for both input of the cust-no and input of the data. The second example sets up a separate form vcustno for entering the customer number.
Using VPLUS and IMAGE Updating Data in a Dataset Figure 3-9. Using REPEAT with VPLUS to Update Data 1 system ex26,base=orders,vpls=formfile; 2 list(auto) customer; 3 repeat 4 do 5 get(form) vcustomer,init; 6 if (cust-no) <> 0 7 then 8 do 9 set(key) list (cust-no); 10 get customer; 11 put(form) vcustomer; 12 get(form) vcustomer; 13 update customer; 14 doend; 15 doend 16 until (cust-no) = 0; 6 The IF statement instructs Transact to quit if a customer number is not input.
Using VPLUS and IMAGE Updating Data in a Dataset Figure 3-11. VPLUS Form for Customer Number vcustno update customer data enter customer number to update [ ] To implement this, we need only change the name of the form in line 5 of Figure 3-9 above and we now have a program working with two forms. Figure 3-12.
Using VPLUS and IMAGE Reporting Data from a Dataset Reporting Data from a Dataset Now let’s use VPLUS to display data from the customer dataset. One way to display the data is to display a record at a time using the same form we used to add and update data. The following program illustrates this. Figure 3-13.
Using VPLUS and IMAGE Reporting Data from a Dataset Figure 3-14. Dictionary Definitions for Customer Forms to be Appended >show file FILE vcustomerrh FILE TYPE: RESPONSIBILITY: VCUSTOMERRH FORM > show file FILE vcustomerrd FILE TYPE: RESPONSIBILITY: VCUSTOMERRD FORM ELEMENT(ALIAS): PROPERTIES: ELEMENT(PRIMARY): CUST-NO 9 (4,0,4) CUST-NO NAME X (20,0,20) NAME STREET-ADDR X (20,0,20) STREET-ADDR CITY-STATE X (20,0,20) CITY-STATE ZIPCODE X (6,0,6) ZIPCODE Figure 3-15.
Using VPLUS and IMAGE Reporting Data from a Dataset Figure 3-17.
Using VPLUS and IMAGE Reporting Data from a Dataset 5 PUT(FORM) displays the report heading form to the terminal. The FREEZE option freezes the form on the terminal so that the scrolling portion of the screen begins below this form. 6 The LIST= option designates the items in the program list that the FIND verb is to retrieve. If we didn't do this, it would attempt to retrieve the item counter from dataset customer and would be unable to do so.
Using VPLUS and IMAGE Reporting Data from a Dataset Figure 3-18. Result of VPLUS Freeze and Append customer address [14 ] [Furtado Inports ] [1396 E Santa Clara ] [Los Angeles, Ca. ] [90189 ] [15 ] [Saxon's ] [518 W San Carlos ] [Santa Clara, Ca. ] [94168 ] [16 ] [Pour House ] [1475 Lipton Place ] [San Jose, Ca.
Using VPLUS and IMAGE Setting Up a Menu-Driven System Setting Up a Menu-Driven System Now all we need to do is tie the pieces together with a menu and we have a complete system for adding, updating, and reporting data. A mainmenu form does the trick. The format of the form is: Figure 3-19.
Using VPLUS and IMAGE Setting Up a Menu-Driven System Figure 3-20.
Using VPLUS and IMAGE Setting Up a Menu-Driven System 4 The GET statement drives the program. The mainmenu is displayed and, depending on the function key entered, various routines are executed. When any of the three tasks finishes, END returns control to the first line in the present level, which is line 4. The options F1=, F2=, and F3= specify a conditional transfer of control depending on the function key pressed. This is like a GOTO rather than a PERFORM.
4 Using KSAM and MPE The examples in this section explain how to use Transact to maintain KSAM and MPE files. They assume that the KSAM and MPE file definitions have been added to a Dictionary/V dictionary. Appendix G contains file definitions for the file referenced by these examples.
Using KSAM and MPE Using KSAM Using KSAM Adding Records Adding a record to a KSAM file uses the same verbs and syntax as adding a record to an IMAGE dataset. Compare this program with Ex9 in Figure 2-3. Figure 4-1. Program to Add Data to a KSAM File 1 system ex32,ksam=kcust(update); 2 set(delimiter) "/"; 3 level; 4 prompt cust-no; 5 prompt name; 6 put kcust; 7 end; 1 The KSAM= option names the KSAM file to be accessed. The default access is READ only. The most inclusive capability is UPDATE.
Using KSAM and MPE Using KSAM Figure 4-3. Program to Update Data in a KSAM File 1 system ex33,ksam=kcust(update); 2 set(delimiter) "/"; 3 list(auto) kcust; 5 data cust-no; 6 set(key) list (cust-no); 7 get kcust; 8 display; 9 data name; 10 set(update) list(name); 11 replace kcust; 12 end; 10 In the KSAM file, both data items are key fields. Therefore, to change a field we need to add a new record and delete the old.
Using KSAM and MPE Using MPE Files Using MPE Files Adding Records Adding a record to an MPE file uses the same verb and syntax as does adding a record to an IMAGE dataset or a KSAM file. We have the option of using LIST with DATA or just using PROMPT alone. Figure 4-5. Program to Add Data to an MPE File 1 system ex34,file=batchinv(update); 2 list(auto) batchinv; 3 level; 4 data part-number: 5 location: 6 quantity; 7 1 put batchinv; The FILE= option names the MPE file we are going to access.
Using KSAM and MPE Using MPE Files Updating Records Figure 4-7.
Using KSAM and MPE Using MPE Files Figure 4-8. Updating Records in an MPE File PART-NUMBER> p102 PART-NUMBER: LOCATION: QUANTITY: p102 bin2 105 is this the record to update? y LOCATION> INV-QUANTITY> 110 PART-NUMBER> p102 PART-NUMBER: LOCATION: QUANTITY: p102 bin2 110 is this the record to update? n PART-NUMBER> ] Direct access to an MPE file is possible if the MPE record number is known. Use the FIND verb with both the DIRECT and RECNO= options to accomplish this.
5 Automatic Error Handling and Prototyping This section will demonstrate how easy it is to develop a working prototype of an application system by taking advantage of Transact’s power, in particular the automatic error handling facility. We will take a particular example and follow it from the initial prototype attempt until the finished product emerges. Usually, when prototyping of a system is discussed, it is thought of in terms of throwaway code. This need not be the case with Transact.
Automatic Error Handling and Prototyping Figure 5-1. Basic Prototype Program for Adding Data 1 system ex36,base=orders,vpls=formfile; 2 list(auto) vorderhead; 3 list(auto) vorderline; 4 get(form) vorderhead,init,freeze; 5 put orderhead,list=(order-no, 6 cust-no, 7 order-status, 7.
Automatic Error Handling and Prototyping When we have entered the last order line, pressing [[ F8 ]] gets us back to the point where we can either exit the program or restart it. Thus with just a small amount of code, we can generate a program that adds data to two datasets. We can use this program to verify with the user that we are creating the correct solution and we can also use this program to enter data that can be used to test other modules within the system.
Automatic Error Handling and Prototyping Figure 5-3. Prototype Program to Add Multiple Master Records 1 system ex37,base=orders,vpls=formfile; 1.1 define(item) lastkey i(4): 1.2 1.3 1.4 enter i(4),init=0; list lastkey: enter; 2 list(auto) vorderhead; 3 list(auto) vorderline; 3.1 level; 4 get(form) vorderhead,init,freeze; 5 put orderhead,list=(order-no, 6 cust-no, 7 order-status, 7.01 order-date); 8 level; 9 get(form) vorderline,init,append,fkey=lastkey; 9.
Automatic Error Handling and Prototyping In order to find out what key was pressed by the user, line 9 was modified by adding an option to tell Transact where to put this information and lines 1.1 to 1.4 were added to define the variable lastkey. As a side note, the variable enter was set up to improve program readability when checking if [[ENTER]] was pressed.
Automatic Error Handling and Prototyping Figure 5-6. Automatic Error Handling with VPLUS Append vorderhead order data order number [123 ] customer [CUST1] status [0 ] date [850101]| line number [1 ] part-number [PART1 ] quantity [10 ] line number [ part-number [ ] quantity [ ] ] Up to this point, no order line has been added to the database. The valid line number, part-number, and quantity would be entered into the blank form line.
Automatic Error Handling and Prototyping Figure 5-7. Functional Prototype with Automatic Error Handling 1 system ex38,base=orders,vpls=formfile; 1.1 define(item) lastkey i(4): 1.2 1.3 enter i(4),init=0; list lastkey: 1.4 enter; 2 list(auto) vorderhead; 3 list(auto) vorderline; 3.01 set(form) vorderhead,init,list=(); 3.1 level; 4 4.1 get(form) vorderhead,fkey=lastkey; if (lastkey) <> (enter) 4.2 then 4.3 do 4.4 set(form) vorderhead,init,list=(); 4.5 end(level); 4.6 end; 4.
Automatic Error Handling and Prototyping This version delays specifying whether a form is to be frozen or appended to another form until the last possible moment. Recall that our goal is to first display a blank form for entering global order information. If there are any errors in the data, then the form should not be cleared, since that would require the user to re-enter all data. Once the global information has been entered, then each line of the order is entered.
Automatic Error Handling and Prototyping Figure 5-8. Prototype with Programmatic Data Validation 1 system ex39,base=orders,vpls=formfile; 1.1 define(item) lastkey i(4): 1.2 1.3 enter i(4),init=0; list lastkey: 1.4 enter; 2 list(auto) vorderhead; 3 list(auto) vorderline; 3.01 set(form) vorderhead,init,list=(); 3.1 level; 4 get(form) vorderhead,fkey=lastkey; 4.1 if (lastkey) (enter) 4.2 then 4.3 do 4.5 end(level); 4.6 end; 4.7 doend; 4.8 set(key) list (order-no); 4.
Automatic Error Handling and Prototyping Figure 5-8 will help you see how automatic error handling can work for you. In this version, lines 4.8 and 4.9 have been added to verify that the order now being entered does not already exist. The NOFIND option on line 4.9 specifies that it is not an error if a record is not found. It is an error if a record is found. If the error occurs, automatic error handling will display a message and restart at the data collection point, which is line 4. Lines 4.91 and 4.
Automatic Error Handling and Prototyping Figure 5-11.
Automatic Error Handling and Prototyping Figure 5-12. Production Version of Prototype Program 1 system ex40,base=orders,vpls=formfile; 1.1 define(item) lastkey i(4): 1.2 1.21 enter i(4),init=0; define(item) valid i(4): 1.22 yes i(4),init=1: 1.23 no i(4),init=0; 1.24 list valid: 1.25 yes: 1.26 no; 1.3 list lastkey: 1.4 enter; 2 list(auto) vorderhead; 3 list(auto) vorderline; 3.1 level; 3.2 set(form) vorderhead,init,list=(); 3.3 repeat 3.4 do 3.
Automatic Error Handling and Prototyping Figure 5-13. Production Version of Prototype Program (Continued) 4.92 4.93 4.94 4.95 4.96 4.97 4.98 4.99 4.991 5 6 7 7.01 7.1 7.2 8 8.1 8.2 8.3 9 9.1 (enter) 9.2 9.3 9.5 9.6 9.7 9.8 9.9 9.91 9.92 9.93 9.94 9.95 9.96 9.97 9.98 9.99 9.991 9.992 9.993 9.994 9.995 9.996 9.
Automatic Error Handling and Prototyping The main thing done to this version is to replace the automatic looping on data errors until the data is valid with explicit programmatic looping until the errors are corrected. Lines 1.21 to 1.26 define new variables to programmatically detect whether a data entry form contains valid data or not. Valid can be viewed as a switch which is either yes or no depending on whether the data entered is valid or not. Lines 3.3, 3.4, 4.99, and 4.
6 Data Structures So far, the examples have made little reference to Transact’s data structures. However, if you go back and scan each example, you will find that some form of the LIST verb exists in each example. For many applications, what you see in the examples is all that is needed. However, there are times when it is necessary to programmatically take more control over Transact’s temporary data storage. COBOL and Pascal have very well defined data structures.
Data Structures This same definition in COBOL might be: Figure 6-2. Comparable COBOL Data Structures 1 01 valid pic 9(4) comp. 2 01 yes pic 9(4) comp value 1. 3 01 no pic 9(4) comp value 0. 4 01 lastkey pic 9(4) comp. 5 01 enter pic 9(4) comp value 0. 6 01 ws-vorderhead. 7 02 order-no pic x(8). 8 02 cust-no pic 9(4). 9 02 order-status pic x(2). 10 02 order-date pic x(6). 11 01 ws-vorderline. 12 02 line-no pic 9(2). 13 02 part-number pic x(8). 14 02 quantity pic 9(6) comp.
Data Structures Figure 6-3. Comparable PASCAL Data Structures 1 const yes=1; 2 no=0; 3 enter=0; 4 type small_int=-32768..32767; 5 char2=packed array[1..2] of char; 6 char4=packed array[1..4] of char; 7 char6=packed array[1..6] of char; 8 char8=packed array[1..
Data Structures In the Transact example, DEFINE(ITEM) (lines 1.1 to 1.23) defines the name, format, and size of five data items. All five are of single word integer or binary format. In addition, whenever storage space is reserved for enter, yes, or no, the space is initialized to contain the values 0, 1, or 0, respectively. Note that DEFINE does not reserve space for the data items. It more closely resembles the Pascal TYPE construct. Lines 1.24 to 1.
Data Structures Figure 6-6. VPLUS Explicit LIST= 9 get(form) vorderline,fkey=lastkey 9.01 ,list=(line-no, 9.02 part-number, 9.03 quantity); or alternatively: Figure 6-7. LIST= Item Range 9 get(form) vorderline,fkey=lastkey 9.01 ,list=(line-no: 9.02 quantity); to indicate a range of data items. Lines 10 to 13 add a new record to dataset orderline using data items order-no, line-no, part-number, quantity. Figure 6-8.
Data Structures Another COBOL example is the following: Figure 6-9. COBOL Redefinition of Data Storage 1 01 record-data. 2 02 dte pic 9(6). 3 02 date-redef redefines dte. 4 04 yy pic 99. 5 04 mm pic 99. 6 04 dd pic 99. This same example in Transact is handled as follows: Figure 6-10. Transact Redefinition of Data Storage 1 define(item) date 9(6): 2 yy 9(2)=date: 3 mm 9(2)=date(3): 4 dd 9(2)=date(5); 5 list date; In Transact, these items are referred to as parent and child items.
Data Structures Figure 6-11. COBOL Array Definitions 1 01 empl-table. 2 02 empl-rec occurs 10. 3 04 empl-no pic x(6). 4 04 empl-name pic x(30). 5 04 empl-salary pic 9(8)v99 comp. 6 7 8 9 10 01 reg-sales-by-mo. 02 region-line occurs 10. 04 region pic x(4). 04 month pic 9(8) comp occurs 12. This would be implemented in Transact as follows: Figure 6-12.
Data Structures Line 9 defines a second dimension of this array. The first dimension holds the data for 10 regions. The second dimension is made up of 12 months of data for each region. As we have seen, Transact does have definite data structures which in many respects correlate quite closely with those in COBOL. Transact works best when you keep in mind that you only want to add new information to your data structure, not define anything twice.
Data Structures Figure 6-14.
Data Structures time during program execution. Unlike COBOL and Pascal, Transact does not map physical data storage at compile time. Storage is allocated at run time as the program processes LIST verbs. There are also verbs to deallocate storage when it is no longer needed or when it needs to be remapped. These verbs are illustrated in the program below which solves the same problem as the program shown in Figure 6-14. Figure 6-15.
Data Structures In this example program, the data storage always exists in one of two forms. When lines 15 to 18 and 26 to 27 are executed, the data storage looks like: Figure 6-16. LIST Register Map with Same Item Twice 5 part-number 6 quantity 8 tot-inv 14.1 quantity During the remainder of the program, the data storage looks like: Figure 6-17. LIST Register After SET(STACK) 5 part-number 6 quantity 8 tot-inv This is all controlled by the repeated execution of lines 14.1 and 18.1. Line 14.
Data Structures In the last example we can take advantage of both usages of marker items as follows: Figure 6-19. Use of Marker Items 1 system ex59,base=orders; 4 define(item) tot-inv i(6),head="inventory"; 4.1 define(item) begin-orderline @: 4.2 end-orderline @; 4.3 list tot-inv; 5 list begin-orderline: 5.1 part-number: 6 quantity: 7 end-orderline; 9 find(serial) orderline,list=(begin-orderline:end-orderline) 10 11 ,perform=100-get-inv; end; 12 13 100-get-inv: 14 14.
Data Structures Lines 4.1 and 4.2 define the marker items. Lines 5 and 7 put the markers around the items that we want to use from the orderline set. Line 9 now uses the markers to indicate the data item range to be used. With this implemented, at some later date we could decide that the program also needs to retrieve order-no from the orderline set and no changes would have to be made to line 9. Order-no would only need be added to the LIST verb between lines 5 and 7. In line 18.
Data Structures Figure 6-20.
Data Structures Figure 6-21.
Data Structures The above program performs a bubble sort of valid part-numbers. You will never want to do this, since it is much easier to let Transact do the sort for you via the SORT=(part-number) option, but it does illustrate the dynamics of Transact's data structures. Lines 20 to 28 serially read the master set that contains part-numbers and dynamically adds each to the program data storage. Line 22 reserves an additional 8 bytes of storage each time it is executed.
7 Using Transact Without a Dictionary Transact can be used with either Dictionary/3000 or System Dictionary. It can also be used without a dictionary and can still interface with IMAGE, MPE, KSAM, and VPLUS. This section uses examples from previous sections, modifying them so that they work independent of the dictionary. All that has to be done is to replace the common data definitions in the dictionary with program data definitions. These examples are shown below with the changes highlighted.
Using Transact Without a Dictionary IMAGE IMAGE The following program shows the modifications made to the program listed in Figure 1-17 in order to make it independent of the dictionary. Figure 7-1. IMAGE Access Without the Dictionary 1 system ex61,base=orders; 2 define(item) order-no x(8): 2.1 cust-no 9(4): 2.2 order-status x(2): 2.21 order-date x(6): 2.3 name x(20): 2.4 street-addr x(20): 2.5 city-state x(20): 2.6 zipcode x(6): 2.61 line-no 9(2): 2.62 part-number x(8): 2.
Using Transact Without a Dictionary IMAGE Figure 7-2. IMAGE Access Without the Dictionary (Continued) 8 get-orderdata: 9 9.01 9.1 9.11 level; set(key) list (cust-no); list name: 9.12 street-addr: 9.13 city-state: 9.14 zipcode; 9.2 get customer,list=(name:zipcode); 10 set(key) list (order-no); 10.01 list line-no: 10.02 part-number: 10.03 quantity; 11 find(chain) orderline,list=(line-no:quantity) 11.01 ,perform=displayit; 11.
Using Transact Without a Dictionary MPE MPE The following program is a modification of the program listed in Figure 4-5. The items are explicitly defined in lines 1.1 to 1.3, and LIST(AUTO) is replaced with a list of the items. Figure 7-3. MPE Access Without the Dictionary 1 system ex62,file=batchinv(update); 1.1 define(item) part-number x(8): 1.2 location x(4): 1.3 quantity i(6); 2 list part-number: 2.1 location: 2.
Using Transact Without a Dictionary KSAM KSAM The following program is a modification of the program listed in Figure 4-3. Changes are the same as for the preceding two programs. Figure 7-4. KSAM Access Without the Dictionary 1 system ex63,ksam=kcust(update); 2 set(delimiter) "/"; 2.1 define(item) cust-no 9(4): 2.2 3 name x(20); list cust-no: 3.
Using Transact Without a Dictionary VPLUS VPLUS For forms access without a dictionary, the form and its fields must be spelled out in the SYSTEM statement, then the fields must be defined. The following program is a modification of the program listed in Figure 3-3. Figure 7-5. VPLUS Access Without the Dictionary 1 system ex64,base=orders,vpls=formfile(vcustomer(cust-no,name, 1.1 1.2 street-addr,city-state,zipcode)); define(item) cust-no 9(4): 1.3 name x(20): 1.4 street-addr x(20): 1.
8 Special Topics Interface to Report/V In previous sections, we looked at examples of using Transact as a report generator. These examples illustrated features of Transact but were not meant to indicate that one of the strengths of Transact is its report writing capability. In fact, Transact is not meant to be a report writer. Although some high level benefits are gained, most reporting controls, like sort control breaks and subtotals, still have to be coded in Transact.
Special Topics Interface to Report/V Figure 8-1. Part Number Balances by Location INVENTORY DETAILS PART-NUMBER LOCATION QUANTITY -----------------------------PART1 LOC1 100 LOC2 200 LOC3 300 PART2 LOC1 100 PART3 LOC2 200 Figure 8-2.
Special Topics Interface to Report/V Figure 8-3.
Special Topics Interface to Report/V Figure 8-4.
Special Topics Interface to Report/V Figure 8-5.
Special Topics Interface to Report/V Figure 8-6.
Special Topics Interface to Report/V The Transact program extracts the data desired and writes it to an MPE file called shortage. When it is finished, it calls the report program in line 21. That's all there is to it. There is a similar interface between Transact and Inform. If the report were defined using Inform, line 21 would become: call ex65r,inform; The example above took advantage of Dictionary/V by defining the file shortage in the dictionary.
Special Topics Interface to Report/V Figure 8-7. Using Report/V Without the Dictionary 1 report ex65r; 2 option nohead; 2.1 define(item) cust-no 9(4): 2.2 part-number x(8): 2.3 order-no x(8): 2.4 order-date x(6): 2.5 line-no 9(2): 2.6 quantity i(6): 2.
Special Topics Arrays Arrays It is possible to set up multi-dimensional arrays in Transact. We will look at examples of one- and two-dimensional arrays. The bubble sort example illustrated in Figure 6-20 can be implemented replacing the dynamic part-number data structure with a static list or one-dimensional array of part numbers. The resulting program might look like this: Figure 8-8. One Dimensional Array 1 2 2.1 2.2 3 4 5 6 7 8 9 10 11 12 12.1 12.2 13 14 15 16 17 18 19 20 21 22 23 24 24.1 25 25.1 25.
Special Topics Arrays Figure 8-9.
Special Topics Arrays Lines 2.1 through 4 define the part number array and the individual items within the array that we need to access. Line 2.1 defines the array to contain 20 occurrences of 8 bytes each. Lines 2.2 through 4 define individual items within the array that we will use for storing, retrieving, and comparing. The verbs used for IMAGE access cannot refer to subscripted items. The items must be parent items. Thus, line 23 retrieves the next part-number from the database.
Special Topics Arrays Figure 8-10.
Special Topics Arrays Line 2 defines an array consisting of 10 occurrences of 10 bytes each. Each occurrence is made up of a 2-byte line number and an 8-byte part number (lines 3 and 4). Notice again that the IMAGE access verbs cannot reference array items. Thus lines 16-17 retrieve the next values of line-no and part-number, then lines 30-31 move these values into the next array occurrence, and line 32 increments the array occurrence subscript.
Special Topics Arrays Figure 8-12.
Special Topics Arrays Lines 2 through 6 define the array. The array is intended to hold up to 10 years of data by month. The data that is to be accumulated into the table is the order quantity for each order and part number. Line 2 specifies that the first dimension of the array is 10 years of information. At this time, we must also specify the total byte length of all information for a year (which is 50).
Special Topics Arrays Figure 8-13.
Special Topics Arrays Figure 8-14. Two-Dimensional Array with LET OFFSET (Continued) 34 find(chain) orderline,list=(quantity) 35 36 ,perform=200-each-line; return; 37 38 200-each-line: 39 let (indx) = -1; 40 let (dun) = (no); 41 while (dun) = (no) 42 do 43 let (indx) = (indx) + 1; 43.
Special Topics Arrays Notice that once the proper offsets for an item have been established, the item can be referenced directly without any further qualification (lines 44, 51, and 56). The above example is not the only way a two-dimensional array can be implemented. It is perhaps as close as it is possible to get to the way COBOL or Pascal might define the same array, recognizing that Transact always requires you to specify byte offsets rather than an occurrence number.
Special Topics Arrays Figure 8-16.
Special Topics Arrays In this example, the definition of the array makes no reference to the number of years or the number of months in a year. It is just 500 bytes long, which is the same as the previous example of 10 years by month where the data for each year is a 2-digit year and 12 months of 4 bytes each. The only items that will ever be referred to in this array are ot-year and ot-mo. These are the only items defined and the definition of them does not indicate where they are within the array.
Special Topics Subprograms Subprograms Transact allows you to call other programs from within Transact. We have already seen an example of calling a Report/V program from Transact. You can also call another Transact Program, Inform report, or a program written in another language such as COBOL or Pascal. The CALL verb is used to call another Transact, Report/V, or Inform program. The PROC verb is used to call a program written in another language.
Special Topics Subprograms Figure 8-17.
Special Topics Subprograms Figure 8-18.
Special Topics Subprograms In this example, the main program and subprogram share the same data. The two programs do not have to define the data storage identically, but both must be aware that they are working with the same space. In our example, both programs do define the data storage the same way. The example can be modified so that the two programs only share the data that both need. Figure 8-19.
Special Topics Subprograms Figure 8-20.
Special Topics Subprograms In this example, the main program only contains definitions for the data that it needs and at the level that it needs access. For example, it does not contain a detail definition of the array. The subprogram does contain a detail definition of the array. The main program also specifies how much data the subprogram has access to by way of the DATA=ORDER-DATE option on the CALL. This protects order-no from being accessed by the subprogram.
Special Topics Subprograms Figure 8-22. The Called COBOL Procedure 1 $control dynamic 1.1 identification division. 1.2 program-id. ex72a. 1.3 environment division. 1.4 data division. 1.5 working-storage section. 1.6 01 i pic 9(4) comp. 1.7 linkage section. 1.8 01 yr pic 99. 1.9 01 mo pic 99. 2 01 data-table. 2.1 02 yrs occurs 10. 2.2 04 tab-yr pic 99. 2.3 04 tab-qty pic 9(4) occurs 12. 2.4 01 end-tab pic 9(4) comp. 2.5 01 qty pic 9(6) comp. 2.
Special Topics Subprograms Figure 8-23. Adding a COBOL Procedure to an SL :cobol ex72a PAGE 0001 HP32213C.02.12 (C) HEWLETT-PACKARD CO. 1983 DATA AREA IS %000172 WORDS. CPU TIME = 0:00:01. WALL TIME = 0:00:03. END COBOL/3000 COMPILATION. NO ERRORS. NO WARNINGS. END OF COMPILE :segmenter HP32050A.01.09 SEGMENTER/3000 (C) HEWLETT-PACKARD CO 1983 -buildsl sl,1000,100 -usl $oldpass -listusl USL FILE $OLDPASS.HOWTO.
Special Topics Intrinsics Intrinsics The PROC verb can also be used to call intrinsics. These intrinsics can be the MPE intrinsics, VPLUS intrinsics, IMAGE, KSAM, etc., intrinsics. The example below illustrates the use of several of the MPE intrinsics.
Special Topics Intrinsics Figure 8-24.
Special Topics Intrinsics The example is a program that builds a file using the COMMAND intrinsic and then writes a record to the file using the FOPEN and FWRITE intrinsics. Line 21 sets up the buffer for the COMMAND intrinsic to be the BUILD command. The buffer for a command has to end with a [[RETURN]] which is what lines 22 and 23 accomplish. Line 41 executes the FOPEN intrinsic. This line illustrates several important points to remember when calling intrinsics.
Special Topics Test Facility Test Facility Transact provides an extensive test facility to aid in the debugging of a program. The Transact Reference Manual provides a detailed description of this facility. Three of the options that provide the answers to most debugging problems are options 25, 34, and 42. Option 25 provides information whenever a database or file access occurs.
Special Topics Test Facility 6.100 0017 end; 7.000 0018 8.000 0018 add-customer: 9.000 0018 10.000 0018 get(form) vcustomer; 11.000 0019 put customer; 12.000 0020 end; 13.000 0021 14.000 0021 update-customer: 15.000 0021 16.000 0021 get(form) vcustno; 16.100 0022 set(key) list (cust-no); 17.000 0023 get customer; 18.000 0025 put(form) vcustomer; 19.000 0026 get(form) vcustomer; 20.000 0027 update customer; 21.000 0028 end; 22.000 0029 23.000 0029 report-customer: 24.000 0029 25.
Special Topics Test Facility 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 150 | OFFSET: LIST: DATA: | 0 CUST-NO 1 | +--------------------------------------+ 1 00022 198:000 1 00023 064:139 1 00025 161:002 +-V-P-L-U-S---B-U-F-F-E-R---D-U-M-P----+ | | PUT(FORM) CODE: 0 FKEY: 0 | FORM: ..VCUSTOMER FILE: ..
9 Creating Custom Applications In this section, we look at coding techniques that use the power of Transact and Dictionary/V. One of the most time-consuming functions of an application system's programming team is program maintenance. Quite often this time is related to the kinds of activity that can be greatly reduced or even eliminated by taking full advantage of the integration of Transact and the dictionary.
Creating Custom Applications Finally, a localizable application should allow logic to be added to handle such things as: special field edits for any of the transaction’s data elements, data calculations, etc. With this brief background, let’s look at how Transact can achieve this level of localization. Our objective is to write an application program such that if we choose to change the application as described above, we need not modify the program.
Creating Custom Applications Figure 9-2. Dictionary Definitions for Customer VPLUS Form FILE customer FILE TYPE: RESPONSIBILITY: CUSTOMER MAST ELEMENT(ALIAS): CUST-NO PROPERTIES: * ELEMENT(PRIMARY): I+(4,0,2) CUST-NO NAME X (20,0,20) NAME STREET-ADDR X (20,0,20) STREET-ADDR CITY-STATE X (20,0,20) CITY-STATE ZIPCODE X (6,0,6) ZIPCODE The following program illustrates how a transaction to update a customer might be written without allowing for any localization.
Creating Custom Applications Figure 9-3.
Creating Custom Applications Rearranging the Form Rearranging the Form Perhaps the easiest form of localization is to rearrange the order of elements on the form. Our program form specification does not include any element ordering information. This is controlled through the dictionary. Thus, this localization can be accomplished by modifying the form using FORMSPEC, changing the element sequence on the form definition in the dictionary, and recompiling our program using TRANCOMP.
Creating Custom Applications Rearranging the Form Figure 9-5. Dictionary Changes to Specify a Rearranged Screen :run dictdbm.pub.sys DICTIONARY/3000 HP32244A.02.01 - (C) Hewlett-Packard Co. 1984 PASSWORD FOR DICT.
Creating Custom Applications Form Independence Form Independence Now let’s see how to implement generic transaction code that can handle multiple form formats. This will be illustrated by modifying the program above. Keep in mind that we could have written the program this way to start with. It is not a program modification that we must make every time we want to add another form. The following program provides generic update customer capability and is form independent.
Creating Custom Applications Form Independence Figure 9-6.
Creating Custom Applications Form Independence This program uses Transact’s indirect referencing capability for forms. Notice that all verbs which reference a form name do not actually specify the form name. Each verb specifies the name of an element which contains the name of the form to be referenced. The program sets up a menu-driven customer update capability such as the following series of forms depict. Figure 9-7.
Creating Custom Applications Form Independence Figure 9-10. Screen Independence, Accounts Payable Customer Update custupdate3 accounts payable customer update customer number [1 ] name [name of customer 1 address [108 Lincoln Ave. city,state [So. Bend, Ind. ] ] ] zipcode [12345 ] update? - f1=yes, f2=no There are many ways to implement a form-independent program. The above is just one illustration.
Creating Custom Applications Adding, Deleting, and Changing Elements Adding, Deleting, and Changing Elements Now let’s take on a major localization step. Let’s redefine the customer dataset, expanding the size of cust-no from 4 to 6 digits long, deleting the zipcode field and adding a new field called area. The following Figures illustrate what must be done to accomplish all of this. The important point for Transact is that we only need to recompile the program to incorporate the new structure.
Creating Custom Applications Adding, Deleting, and Changing Elements Figure 9-14. Finance Customer Update, Add, Change, Delete Elements custupdate2 finance customer update customer number [ ] area [ ] custupdate3 is changed to reflect the 6-digit customer number, delete of zipcode, and addition or area, because accounts payable needs to be able to update all fields. Figure 9-15.
Creating Custom Applications Adding, Deleting, and Changing Elements Figure 9-16. Changing dictionary definitions, add, change, Delete Element :run dictdbm.pub.sys DICTIONARY/3000 HP32244A.02.01 - (C) Hewlett-Packard Co. 1984 PASSWORD FOR DICT.
Creating Custom Applications Adding, Deleting, and Changing Elements Figure 9-17.
Creating Custom Applications Adding, Deleting, and Changing Elements Next the database is unloaded using DICTDBU. Figure 9-18. Unloading the Database with DICTDBU :run dictdbu.pub.sys DICTIONARY/3000 DB UNLOADER P32244A.02.01-(C)Hewlett-Packard Co.
Creating Custom Applications Adding, Deleting, and Changing Elements Figure 9-19. Purging the Database with DBUTIL :run dbutil.pub.sys HP32215B.04.61 IMAGE/3000: DBUTIL C)COPYRIGHT HEWLETT-PACKARD COMPANY 1978 >>pur orders Data base has been PURGED. >>exit END OF PROGRAM : Then the new database root file is created using DICTDBC. Figure 9-20. Creating the Database with DICTDBC :run dictdbc.pub.sys DICTIONARY/3000 DB CREATOR HP32244A.02.01 - (C) Hewlett-Packard Co.
Creating Custom Applications Adding, Deleting, and Changing Elements Figure 9-21.
Creating Custom Applications Adding, Deleting, and Changing Elements The new database is created using DBUTIL. Figure 9-22. Creating the New Database with DBUTIL run dbutil.pub.sys HP32215B.04.61 IMAGE/3000: DBUTIL (C) COPYRIGHT HEWLETT-PACKARD COMPANY 1978 >>cre orders Data base ORDERS has been CREATED. >>exit END OF PROGRAM : The database is reloaded using DICTDBL. Figure 9-23. Reloading the Database with DICTDBL run dictdbl.pub.sys DICTIONARY/3000 DB LOADER HP32244A.02.01 - (C) Hewlett-Packard Co.
Creating Custom Applications Adding, Deleting, and Changing Elements Figure 9-24. Compiling Transact Program to Resolve Data Changes run trancomp.pub.sys TRANSACT/3000 COMPILER HP32247A.02.02 - (C) Hewlett-Packard Co. 1984 SOURCE FILE> custup LIST FILE> CONTROL> dBlist TRANSACT/3000 COMPILER A.02.02 : TUE, MAY 14, 1985, LISTING OF FILE CUSTUP.CUSTOMIZ.
Creating Custom Applications User Exits User Exits In general, there are two types of application development environments. First there are application software companies who build application solutions to sell to other companies. Second, there are companies who build application solutions for use internally. Localization is attractive to both environments. Ignoring the fact that the software is sold in one case, both types of environments have a similar structure.
Creating Custom Applications User Exits Figure 9-25.
Creating Custom Applications User Exits Figure 9-26.
Creating Custom Applications User Exits MENUNAME is the index into the program specifying the current menu or form. USEREXIT-PROG contains the name of the Transact subprogram to be called. As this program illustrates, there can be some data defined within the program for its own use (lines 10 through 26). This data could also be defined in the dictionary. There can also be global data that is of importance to both the program and the user exit program (lines 28 through 31).
Creating Custom Applications User Exits The program sets up a marker element which it uses to denote the point in the list register that the subprogram has access to (line 27 and 48). The form is displayed without erasing the information, if the user exit program detected an error. Otherwise an initialized form is displayed. Lines 34 to 45 handle this. Lines 46 to 48 implement the user exit by searching for a match on form name in the cross-reference file.
Creating Custom Applications User Exits Figure 9-30. User-Modified Customer Main Menu, Adding an Element custupdatemm customer update main menu enter customer number [ ] f1 - marketing (custupdate1) f2 - finance (custupdate2) f3 - accounts payable (custupdate3) *********************************************** or enter screen name [ password [ market- finance ing ] ] accounts exit payable Figure 9-31.
Creating Custom Applications Transactions Across Multiple Datasets Transactions Across Multiple Datasets All of the above concepts are still valid even if the transaction affects multiple datasets. The following program illustrates a way to write generic code that accesses more than one dataset. This code could be expanded to include the topics previously discussed to provide form independence, user exits, etc. Figure 9-32.
Creating Custom Applications Transactions Across Multiple Datasets Figure 9-33.
Creating Custom Applications Transactions Across Multiple Datasets Figure 9-34. Multiple Dataset Screen addpart add a part part number [ ] description [ location [ quantity [ vendor code [ vendor name [ ] ] ] ] ] The key to understanding how to write generic code is to understand how the VPLUS and Image interface work with the list register. The first thing to understand is that the list register can have as many definitions of an element on it as you want.
A Building the Dictionary The following is an example of a terminal session creating the dictionary. After the dictionary is created, then it is loaded with database definitions, form definitions, and elements. Appendices B,C, E, and F are examples of this. :run dictinit.pub.sys DICTIONARY/3000 INITIALIZATION HP32244A.02.00 - (C) Hewlett-Packard Co. 1983 Initialization/Re-initialization (I/R) >i USER PASSWORD > ACCOUNT PASSWORD > GROUP PASSWORD > #J70 END OF PROGRAM : FROM/J70 MARV.
Building the Dictionary PROCEDURE-PROCED will have capacity 100 CATEGORY-CATEGOR will have capacity 100 GROUP-GROUP will have capacity 250 FILE-ELEMENT will have capacity 2000 FILE-EL-SECOND will have capacity 100 FILE-PATH will have capacity 400 FILE-SORT will have capacity 400 Press RETURN to continue > PROCEDURE-ELEMEN will have capacity 500 CATEGORY-ELEMENT will have capacity 500 GROUP-ELEMENT will have capacity 1000 CLASS-CLASS will have capacity 500 CLASS-ELEMENT will have capacity 300
B Entering the Database Definition The following is an example of entering database and file definitions into the dictionary. The IMAGE database ORDERS, KSAM file KCUST, and MPE files BATCHINV and SHORTAGE which are all used by the examples of this manual, are the definitions entered by this example. The example is also complete, that is it completely defines the files and database. The example shows the minimum data that must be added.
Entering the Database Definition DESCRIPTION FILE orderhead LONG NAME TYPE detl RESPONSIBILITY DESCRIPTION FILE orderline LONG NAME TYPE detl RESPONSIBILITY DESCRIPTION FILE inventory LONG NAME TYPE detl RESPONSIBILITY DESCRIPTION FILE kcust LONG NAME TYPE ksam RESPONSIBILITY DESCRIPTION ADDITIONAL FILE ATTRIBUTES(N/Y)?> FILE batchinv LONG NAME TYPE mpef RESPONSIBILITY DESCRIPTION ADDITIONAL FILE ATTRIBUTES(N/Y)?> FILE shortage LONG NAME TYPE mpef RESPONSIBILITY DESCRIPTION ADDITIONAL FILE ATTRIBUTES(N/Y)?
Entering the Database Definition CHILD ALIAS CAPACITY 100 BLOCKMAX DESCRIPTION CHILD FILE order CHILD ALIAS CAPACITY 100 BLOCKMAX DESCRIPTION CHILD FILE parts CHILD ALIAS CAPACITY 100 BLOCKMAX DESCRIPTION CHILD FILE orderhead CHILD ALIAS CAPACITY 100 BLOCKMAX DESCRIPTION CHILD FILE orderline CHILD ALIAS CAPACITY 100 BLOCKMAX DESCRIPTION CHILD FILE inventory CHILD ALIAS CAPACITY 100 BLOCKMAX DESCRIPTION CHILD FILE > repeat create element ELEMENT cust-no LONG NAME TYPE 9 SIZE 4 DECIMAL STORAGE LENGTH(4) COUN
Entering the Database Definition HEADING TEXT ENTRY TEXT EDIT MASK MEASUREMENT UNITS BLANK WHEN ZERO(N/Y)?> RESPONSIBILITY DESCRIPTION ELEMENT name LONG NAME TYPE x SIZE 20 STORAGE LENGTH(20) COUNT(1) HEADING TEXT ENTRY TEXT EDIT MASK MEASUREMENT UNITS RIGHT JUSTIFY(N/Y)?> RESPONSIBILITY DESCRIPTION ELEMENT street-addr LONG NAME TYPE x SIZE 20 STORAGE LENGTH(20) COUNT(1) HEADING TEXT ENTRY TEXT EDIT MASK MEASUREMENT UNITS RIGHT JUSTIFY(N/Y)?> RESPONSIBILITY DESCRIPTION ELEMENT city-state LONG NAME TYPE x S
Entering the Database Definition COUNT(1) HEADING TEXT ENTRY TEXT EDIT MASK MEASUREMENT UNITS RIGHT JUSTIFY(N/Y)?> RESPONSIBILITY DESCRIPTION ELEMENT zipcode LONG NAME TYPE x SIZE 6 STORAGE LENGTH(6) COUNT(1) HEADING TEXT ENTRY TEXT EDIT MASK MEASUREMENT UNITS RIGHT JUSTIFY(N/Y)?> RESPONSIBILITY DESCRIPTION ELEMENT order-no LONG NAME TYPE x SIZE 8 STORAGE LENGTH(8) COUNT(1) HEADING TEXT ENTRY TEXT EDIT MASK MEASUREMENT UNITS RIGHT JUSTIFY(N/Y)?> RESPONSIBILITY DESCRIPTION ELEMENT order-status LONG NAME TYP
Entering the Database Definition STORAGE LENGTH(2) COUNT(1) HEADING TEXT ENTRY TEXT EDIT MASK MEASUREMENT UNITS RIGHT JUSTIFY(N/Y)?> RESPONSIBILITY DESCRIPTION ELEMENT order-date LONG NAME TYPE x SIZE 6 STORAGE LENGTH(2) COUNT(1) HEADING TEXT ENTRY TEXT EDIT MASK MEASUREMENT UNITS RIGHT JUSTIFY(N/Y)?> RESPONSIBILITY DESCRIPTION ELEMENT line-no LONG NAME TYPE 9 SIZE 2 DECIMAL STORAGE LENGTH(2) COUNT(1) HEADING TEXT ENTRY TEXT EDIT MASK MEASUREMENT UNITS BLANK WHEN ZERO(N/Y)?> RESPONSIBILITY DESCRIPTION ELEM
Entering the Database Definition TYPE i SIZE 6 DECIMAL STORAGE LENGTH(4) COUNT(1) HEADING TEXT ENTRY TEXT EDIT MASK MEASUREMENT UNITS SYNCHRONIZED(N/Y)?> RESPONSIBILITY DESCRIPTION ELEMENT part-number LONG NAME TYPE x SIZE 8 STORAGE LENGTH(8) COUNT(1) HEADING TEXT ENTRY TEXT EDIT MASK MEASUREMENT UNITS RIGHT JUSTIFY(N/Y)?> RESPONSIBILITY DESCRIPTION ELEMENT description LONG NAME TYPE x SIZE 20 STORAGE LENGTH(20) COUNT(1) HEADING TEXT ENTRY TEXT EDIT MASK MEASUREMENT UNITS RIGHT JUSTIFY(N/Y)?> RESPONSIBILIT
Entering the Database Definition ELEMENT location LONG NAME TYPE x SIZE 4 STORAGE LENGTH(4) COUNT(1) HEADING TEXT ENTRY TEXT EDIT MASK MEASUREMENT UNITS RIGHT JUSTIFY(N/Y)?> RESPONSIBILITY DESCRIPTION ELEMENT back-order LONG NAME TYPE i SIZE 6 STORAGE LENGTH(4) COUNT(1) HEADING TEXT ENTRY TEXT EDIT MASK MEASUREMENT UNITS RIGHT JUSTIFY(N/Y)?> RESPONSIBILITY DESCRIPTION ELEMENT > repeat add file FILE order KEY ELEMENT order-no ELEMENT ALIAS DESCRIPTION FILE customer KEY ELEMENT cust-no ELEMENT ALIAS DESCRIPT
Entering the Database Definition DESCRIPTION ELEMENT street-addr ELEMENT ALIAS DESCRIPTION ELEMENT city-state ELEMENT ALIAS DESCRIPTION ELEMENT zipcode ELEMENT ALIAS DESCRIPTION ELEMENT FILE parts KEY ELEMENT part-number ELEMENT ALIAS DESCRIPTION ELEMENT description ELEMENT ALIAS DESCRIPTION ELEMENT FILE orderhead ELEMENT order-no ELEMENT ALIAS PATH MASTER FILE order SORT ELEMENT PRIMARY PATH(N/Y)?> DESCRIPTION ELEMENT cust-no ELEMENT ALIAS PATH MASTER FILE customer SORT ELEMENT PRIMARY PATH(N/Y)?> DESCRIP
Entering the Database Definition PATH MASTER FILE DESCRIPTION ELEMENT FILE orderline ELEMENT order-no ELEMENT ALIAS PATH MASTER FILE order SORT ELEMENT PRIMARY PATH(N/Y)?> DESCRIPTION ELEMENT line-no ELEMENT ALIAS PATH MASTER FILE DESCRIPTION ELEMENT part-number ELEMENT ALIAS PATH MASTER FILE parts SORT ELEMENT PRIMARY PATH(N/Y)?> DESCRIPTION ELEMENT quantity ELEMENT ALIAS PATH MASTER FILE DESCRIPTION ELEMENT FILE inventory ELEMENT part-number ELEMENT ALIAS PATH MASTER FILE parts SORT ELEMENT PRIMARY PATH(
Entering the Database Definition PATH MASTER FILE DESCRIPTION ELEMENT FILE shortage PRIMARY/SECONDARY (P/S)?> ELEMENT cust-no ELEMENT ALIAS DESCRIPTION ELEMENT part-number ELEMENT ALIAS DESCRIPTION ELEMENT order-no ELEMENT ALIAS DESCRIPTION ELEMENT order-date ELEMENT ALIAS DESCRIPTION ELEMENT line-no ELEMENT ALIAS DESCRIPTION ELEMENT quantity ELEMENT ALIAS DESCRIPTION ELEMENT back-order ELEMENT ALIAS DESCRIPTION ELEMENT FILE batchinv PRIMARY/SECONDARY (P/S)?> ELEMENT part-number ELEMENT ALIAS DESCRIPTION E
Entering the Database Definition ELEMENT FILE kcust PRIMARY/SECONDARY (P/S)?> ELEMENT cust-no ELEMENT ALIAS KEY ELEMENT(N/Y)?> y PRIMARY KEY(N/Y)?> y DUPLICATES (N/Y)?> n DESCRIPTION ELEMENT name ELEMENT ALIAS KEY ELEMENT(N/Y)?> y DUPLICATES (N/Y)?> y DESCRIPTION ELEMENT FILE >exit END OF PROGRAM 192 Appendix B
C Loading Definitions from IMAGE Appendix B showed how to enter a database definition manually into the dictionary. If the IMAGE database already exists, it is not necessary to load the data manually into the dictionary. DICTDBD is a dictionary utility that loads the database definitions for you. The following is an example of loading the definitions for the database ORDERS into the dictionary. :file dict.pub=dict :run dictdbd.pub.sys DICTIONARY/3000 DB INFO LOADER HP32244A.02.00 - (C) Hewlett-Packard Co.
Loading Definitions from IMAGE 194 Appendix C
D Creating the Physical Database If the IMAGE database has not been created, then after entering in the database definition to the dictionary as shown in appendix B, this definition is used by DICTDBC to create the IMAGE root file for the database. The example below shows the physical creation process for the database ORDERS, KSAM file KCUST, and MPE files SHORTAGE and BATCHINV. These are the database and files used by the examples throughout the manual. :run dictdbc.pub.
Creating the Physical Database END OF PROGRAM :run dbutil.pub.sys HP32215B.03.10 IMAGE/3000: DBUTIL (C) COPYRIGHT HEWLETT-PACKARD COMPANY 1978 >>cre orders data base ORDERS has been CREATED. >>exit END OF PROGRAM :build shortage;rec=-36,,,ascii;disc=100 :build batchinv;rec=-16,,,ascii;disc=100 :run ksamutil.pub.sys >build kcust;rec=-24,,,ascii;keyfile=keycust > ;key=numeric,1,4 > ;key=byte,5,20,,duplicate KCUST.group.acct & KEYCUST ARE CREATED.
E Entering Form Definitions The following is an example of entering VPLUS form definitions into the dictionary. The appendix uses the formfile used by the examples in this manual to illustrate loading the definitions. The example is complete in that it shows how to load each form used in the manual. :run dictdbm DICTIONARY/3000 HP32244A.02.00 - (C) Hewlett-Packard Co. 1983 PASSWORD FOR DICT.
Entering Form Definitions RESPONSIBILITY DESCRIPTION FILE vcustomerrh LONG NAME TYPE form RESPONSIBILITY DESCRIPTION FILE vorderhead LONG NAME TYPE form RESPONSIBILITY DESCRIPTION FILE vorderline LONG NAME TYPE form RESPONSIBILITY DESCRIPTION FILE > repeat add file FILE vcustno ELEMENT cust-no ELEMENT ALIAS FIELD NUMBER DESCRIPTION ELEMENT FILE vcustomer ELEMENT cust-no ELEMENT ALIAS FIELD NUMBER DESCRIPTION ELEMENT name ELEMENT ALIAS FIELD NUMBER DESCRIPTION ELEMENT street-addr ELEMENT ALIAS FIELD NUMBER
Entering Form Definitions ELEMENT city-state ELEMENT ALIAS FIELD NUMBER DESCRIPTION ELEMENT zipcode ELEMENT ALIAS FIELD NUMBER DESCRIPTION ELEMENT FILE vcustomerrd ELEMENT cust-no ELEMENT ALIAS FIELD NUMBER DESCRIPTION ELEMENT name ELEMENT ALIAS FIELD NUMBER DESCRIPTION ELEMENT street-addr ELEMENT ALIAS FIELD NUMBER DESCRIPTION ELEMENT city-state ELEMENT ALIAS FIELD NUMBER DESCRIPTION ELEMENT zipcode ELEMENT ALIAS FIELD NUMBER DESCRIPTION ELEMENT FILE vorderhead ELEMENT order-no ELEMENT ALIAS FIELD NUMBER
Entering Form Definitions FIELD NUMBER DESCRIPTION ELEMENT order-status ELEMENT ALIAS FIELD NUMBER DESCRIPTION ELEMENT order-date ELEMENT ALIAS FIELD NUMBER DESCRIPTION ELEMENT FILE vorderline ELEMENT line-no ELEMENT ALIAS FIELD NUMBER DESCRIPTION ELEMENT part-number ELEMENT ALIAS FIELD NUMBER DESCRIPTION ELEMENT quantity ELEMENT ALIAS FIELD NUMBER DESCRIPTION ELEMENT FILE > relate file PARENT FILE formfile CHILD FILE mainmenu CHILD ALIAS DESCRIPTION CHILD FILE vcustomer CHILD ALIAS DESCRIPTION CHILD FILE
Entering Form Definitions CHILD ALIAS DESCRIPTION CHILD FILE vcustomerrh CHILD ALIAS DESCRIPTION CHILD FILE vcustomerrd CHILD ALIAS DESCRIPTION CHILD FILE vcustno CHILD ALIAS DESCRIPTION CHILD FILE Appendix E 201
Entering Form Definitions 202 Appendix E
F Loading Form Definitions The utility DICTVPD may be used to load form definitions to the dictionary. When the forms are defined using FORMSPEC, you must be careful to define the field names to be the same as the names you want to identify with the form in the dictionary. For example, the following is the FORMSPEC listing of the form vorderhead.
Loading Form Definitions Name Alias NEW/OLD Type FORMFILE NEW VPLS VORDERHEAD NEW FORM ORDER-NO OLD X ( 8, 0, 8) CUST-NO OLD 9 ( 4, 0, 4) ORDER-STATUS OLD X ( 2, 0, 2) ORDER-DATE OLD X ( 6, 0, 6) END OF PROGRAM : Note that the form definition used the underscore character. DICTVPD will convert the underscore to a hyphen if directed to do so.
G Element and File Dictionary Reports The following reports from DICTDBM list the elements and file definitions for the database and files used in the examples throughout this manual. Figure G-1 graphically portrays the relationship of the datasets and data items.
Element and File Dictionary Reports CITY-STATE X (20,0,20) CITY-STATE ZIPCODE X (6,0,6) ZIPCODE FILE(ALIAS): TYPE: ORDER AUTO FILE(PRIMARY): ORDER 100 ELEMENT(ALIAS): PROPERTIES: ORDER-NO FILE(ALIAS): * TYPE: PARTS MAST DETL CAPACITY: 100 PROPERTIES: * DESCRIPTION ORDERHEAD ORDER-NO PARTS PART-NUMBER TYPE: ELEMENT(PRIMARY): X (8,0,8) FILE(PRIMARY): ELEMENT(ALIAS): FILE(ALIAS): CAPACITY: X (8,0,8) PART-NUMBER X (20,0,20) DESCRIPTION FILE(PRIMARY): ORDERHEAD ELEMENT(ALI
Element and File Dictionary Reports PRIMARY/SECONDARY (P/S)?> FILE TYPE: RESPONSIBILITY: KCUST KSAM ELEMENT(ALIAS): PROPERTIES: ELEMENT(PRIMARY): CUST-NO ! 9 (4,0,4) CUST-NO NAME * X (20,0,20) NAME > show file FILE shortage PRIMARY/SECONDARY (P/S)?> FILE TYPE: RESPONSIBILITY: SHORTAGE MPEF ELEMENT(ALIAS): PROPERTIES: ELEMENT(PRIMARY): CUST-NO 9 (4,0,4) CUST-NO PART-NUMBER X (8,0,8) PART-NUMBER ORDER-NO X (8,0,8) ORDER-NO ORDER-DATE X (6,0,6) ORDER-DATE LINE-NO 9 (2,0,2) L
Element and File Dictionary Reports Figure G-1.
H Application Forms Formats MAINMENU mainmenu Customer module f1 = add customer f2 = update customer f3 = report customer f8 = exit VCUSTOMER vcustomer customer data number [ name [ ] address [ ] city,state zipcode ] [ [ ] ] 209
Application Forms Formats VCUSTNO vcustno enter customer number [ ] VCUSTOMERRD [ ] [ ] [ ] [ ] [ ] VCUSTOMERRH customer address VORDERHEAD vorderhead order number [ order data ] customer [ ] status [ ] date [ ] VORDERLINE line number [ 210 ] part-number [ ] quantity [ ] Appendix H
Application Forms Formats Appendix H 211