HP 3000 Manuals

Ch 2. Program Structure [ HP Transact Reference Manual ] MPE/iX 5.0 Documentation


HP Transact Reference Manual

Chapter 2  Program Structure 

To program in the Transact language you must understand the Transact
program structure, which includes the following basic elements:

   *   SYSTEM statement

   *   DEFINE(ITEM) statement

   *   LIST statement

   *   END and EXIT statements

   *   Statements

   *   Comments

   *   Delimiters

   *   Reserved words

This chapter discusses each of these elements.  Figure 2-1 shows a sample
Transact program with comments identifying the components of the program
structure.
____________________________________________________________________________________
|                                                                                  |
|      SYSTEM ORDINF, KSAM=ORDER(READ(OLD,ASCII)),       <<SYSTEM Statement>>      |
|             SIGNON="Customer Order Information";                                 |
|                                                                                  |
|      DEFINE(ITEM) CUST-NAME    X(20):                  <<DEFINE(ITEM) Statement>>|
|                   ORDER-DATE   X(8):                                             |
|                   ORDER-NUMBER X(10):                                            |
|                   AMOUNT-DUE   I(5,,2);                                          |
|                                                                                  |
|      LIST   CUST-NAME:                                 <<LIST Statement>>        |
|             ORDER-DATE:                                                          |
|             ORDER-NUMBER:                                                        |
|             AMOUNT-DUE;                                                          |
|                                                                                  |
|      << Request the user enter the customer name  >>   <<Comment>>               |
|      << for the order information needed.  The    >>                             |
|      << information is printed from each record   >>                             |
|      << that matches the name entered by the user.>>                             |
|                                                                                  |
|      REPEAT                                            <<verb>>                  |
|        DO                                                                        |
|      <<verb modifier>>                                                           |
|                downarrow                                                         |
|        DATA(MATCH) CUST-NAME ("ENTER CUSTOMER NAME ");                           |
|        FIND(SERIAL) ORDER, LIST=(CUST-NAME:AMOUNT-DUE), PERFORM=PRINT-IT;        |
|        RESET(OPTION) MATCH LIST(CUST-NAME);                                      |
|        INPUT "MORE NAMES? (Y OR N)";                                             |
|        DOEND                                                                     |
|      UNTIL INPUT = "N";                                                          |
|                                                                                  |
|      EXIT;                                             <<EXIT statement>>        |
|      PRINT-IT:                                                                   |
|        DISPLAY CUST-NAME:          <<delimiters>>                                |
|                ORDER-NUMBER:               downarrow                             |
|                ORDER-DATE, EDIT="^^/^^/^^":                                      |
|                AMOUNT-DUE, EDIT="$$$$$!^^";                                      |
|      RETURN;                                           <<end of PERFORM>>        |
|                                                                                  |
|      END ORDINF;                                       <<END statement>>         |
____________________________________________________________________________________

          Figure 2-1.  Sample Transact Program 



MPE/iX 5.0 Documentation