HP 3000 Manuals

Examples [ HP Transact Reference Manual ] MPE/iX 5.0 Documentation


HP Transact Reference Manual

Examples 

The following annotated examples show various test modes.  The compiler
listing shown below is for the ADD PROGRAMMER command sequence used in
the examples of test modes 1, 3, and 4:

                 starting-location 
                  downarrow
     176.000  0077     $$ADD:      <<Begin the ADD commands>>
     177.000  0077     $$A:
     178.000  0077       $:        <<Help for the ADD command>>
     179.000  0078
     180.000  0078           DISPLAY "The sub commands for ADD are: ",line=2;
     181.000  0080           SET(COMMAND) COMMAND(ADD);
     183.000  0082
     184.000  0084       END;      <<End of help for ADD>>
     185.000  0085
     186.000  0085
     187.000  0085       $PROGRAMMER:
     188.000  0086       $PR:
     190.000  0086
     191.000  0086           LIST PROGRAMMER:
     192.000  0087                PHONE;
     193.000  0088           DATA LNAME:
     194.000  0089                FNAME:
     195.000  0090                PHONE;
     196.000  0091           PUT PROGRAMMERS, list=(PROGRAMMER:PHONE);
     197.000  0095
     198.000  0095       END;      <<End of ADD PROGRAMMER>>
                  uparrow
                 ending-location 

In these examples, the tests are requested by the TEST command just
before executing the ADD PROGRAMMER command sequence.

Test Mode 1 

This test mode displays the error message only when an error occurs.  In
this example, a duplicate key item error occurs.

     > TEST 1,77,95            <---Execute instructions 77 thru 95 in test mode 1 

     > ADD PROGRAMMER 

     Enter programmer's last name: MARTIN      <---duplicate name 

     Enter programmer's first name: JOAN 
     Enter phone extension number: 3803 

     *ERROR: DUPLICATE KEY VALUE IN MASTER  (IMAGE 43,95,PROGRAMMERS)

     +-D-A-T-A---F-I-L-E---D-U-M-P----------+ <---data block for unsuccessful PUT 
     !
     ! PUT               COND: 43  STATUS: 43  RECNO: -1
     ! BASE: PROGB   SET: PROGRAMMERS
     !
     ! POSN: LIST:                        DATA:
     !  0     PROGRAMMER                   MARTIN          JOAN
     !  30    PHONE                        3803
     +--------------------------------------+

     Enter programmer's last name: JONES       <---unique name; no test output 

     Enter programmer's first name: JAMES 

     Enter phone extension number: 3067 

Test Mode 3 

This test mode shows the same information as test mode 2 (the instruction
address and the compiler code for every instruction).  It also shows the
space used by the list and data registers and the remaining processor
work space.

     > TEST 3,77,95              # of entries in list register 
                                  downarrow      # of words in data register 
     > ADD PROGRAMMER             downarrow       downarrow
             00000  000:000   LIST  DATA  CELL  WORK
             00087  032:007      1    15    64   256
             00088  032:005      2    17    64   256

     Enter programmer's last name: FRANCIS 
             00089  024:008      2    17    64   256

     Enter programmer's first name: JAMES 
             00090  024:009      2    17    64   256

     Enter phone extension number: 4835 
             00091  024:005      2    17    64   256
             00092  048:129      2    17    64   256
                  uparrow      uparrow     uparrow                   uparrow      uparrow
                  uparrow     compiler code            uparrow    words left in work space 
                 instruction location           entries left in work space 

Test Mode 4 

In addition to the instruction location and compiler code issued by test
mode 2, this mode displays instruction timings and the location of the
stack pointers, Z, S, Q, and DL. (See Appendix C for more information
about stack pointers.)

     > TEST 4,77,95 
                                             -----stack pointers------ 
     > |ADD PROGRAMMER|                       downarrow                   downarrow
             00000  000:000  000000 000000 : Z     S     Q     D
             00087  032:007  000001 000001 : 07362 05612 05335 00092
             00088  032:005  000001 000002 : 07362 05612 05335 00092
                                 uparrow       uparrow
                                instruction times 
     Enter programmer's last name: MAYOTTE 
             00089  024:008  000016 000018 : 07362 05612 05335 00092

     Enter programmer's first name: MARK 
             00090  024:009  000015 000033 : 07362 05612 05335 00092

     Enter phone extension number: 3303 
             00091  024:005  000014 000047 : 07362 05612 05335 00092
             00092  048:129  000016 000063 : 09922 07735 05335 00092

     > EXIT 

     END OF PROGRAM

Direct Test Output to File 

The following example directs the test mode output to a file TEST. Test
mode 1 is selected when the program is executed.

     :BUILD TEST; REC=-80,,F,ASCII       <---build file for test output 
     :FILE TRANDUMP=TEST                 <---equate TRANDUMP to that file 
     :RUN TRANSACT.PUB.SYS 

     TRANSACT    HP32247A.00.01 - (C) Hewlett-Packard Co. 1982

     SYSTEM NAME> MYPROG,,-1,77,95       <---send test mode 1 output to TRANDUMP 

     MYPROG  A00.00

      PASSWORD FOR PROGB>

     *INFO: OPENED PROGB,3  (USER 23,-1)

     > ADD PROGRAMMER                    <---command sequence at locations 77-95 

     Enter programmer's last name: MARTIN 

     Enter programmer's first name: JOAN 

     Enter phone extension number: 3803 

     *ERROR: DUPLICATE KEY VALUE IN MASTER  (IMAGE 43,95,PROGRAMMERS)

     Enter programmer's last name: * CONTROL(Y) BREAK

     > EXIT 

     END OF PROGRAM

To see the test mode output, run EDIT/3000 (or another text editor) and
display or list the contents of TEST.

Test Modes 22 through 25 

Test modes 22 through 25 are very similar.  For that reason, only test
mode 25 is shown.  The compiler code used for the example of test mode 25
is shown below.  It uses PUT, REPLACE, and DELETE to access a database.
In the case of the REPLACE(CHAIN), two entries in the chain are replaced.

                 starting location 
                  downarrow
     453.000  0302    $PROGRAMMER:
     454.000  0303    $PR:
     455.000  0303        <<Replace one programmer with another>>
     456.000  0303
     457.000  0303        <<Set up and add entry for new name to PROGRAMMERS>>
     458.000  0303
     459.000  0303        LIST PROGRAMMER:
     460.000  0304             PHONE;
     461.000  0305        DATA LNAME ("Enter new programmer's last name"):
     462.000  0307             FNAME ("Enter new programmer's first name"):
     463.000  0309             PHONE;
     464.000  0310        PUT PROGRAMMERS, LIST=(PROGRAMMER:PHONE);<<add new>>
     465.000  0314        SET(UPDATE) LIST(PROGRAMMER);
     466.000  0316        DATA LNAME ("Enter old programmer's last name"):
     467.000  0318             FNAME ("Enter old programmer's first name");
     468.000  0320        SET(KEY) LIST(PROGRAMMER);
     469.000  0321        RESET(STACK) LIST; <<Release space>>
     470.000  0322
     471.000  0322        <<Update entries in PROG-AUTHOR>>
     472.000  0322
     473.000  0322        DISPLAY "Updating entries in PROG-AUTHOR", line=2;
     474.000  0324        LIST PROG-NAME: <<Temp. storage for update>>
     475.000  0325             PROGRAMMER;
     476.000  0326        REPLACE(CHAIN) PROG-AUTHOR,
     477.000  0326                       LIST=(PROG-NAME:PROGRAMMER);
     478.000  0330        RESET(STACK) LIST; <<Release temp. storage>>
     479.000  0331
     480.000  0331        <<Delete old entry in PROGRAMMERS>>
     481.000  0331
     482.000  0331        DELETE PROGRAMMERS, LIST=();
     483.000  0334
     484.000  0334    END; <<End of REPLACE PROGRAMMER>>
                  uparrow
                 ending location 

Test Mode 25 

This test mode, like test modes 22 through 24, displays the data block
(DATA FILE DUMP) for instructions that access files or data sets.  As
part of the data block display, test mode 25 shows the contents of all
the registers used by each database or file operation.  Note in the
example below that the data block for REPLACE(CHAIN) is issued every time
an entry is selected in the chain of the detail set PROG-AUTHOR.

     > TEST 25,302,334 

     > REPLACE PROGRAMMER 
             00303  032:007
             00304  032:005
             00305  040:008

     Enter new programmer's last name: KING 
             00307  040:009

     Enter new programmer's first name: WENDY 
             00309  024:005

     Enter phone extension number: 3818 
             00310  048:129
     +-D-A-T-A---F-I-L-E---D-U-M-P----------+         <---data block for PUT 
     !
     ! PUT               COND: 0  STATUS: 0  RECNO: 21
     ! BASE: PROGB   SET: PROGRAMMERS
     !                                                <---contents of list and 
     ! POSN: LIST:                        DATA:             data registers 
     !  0     PROGRAMMER                   KING            WENDY
     !  30    PHONE                        3818
     +--------------------------------------+
             00314  031:000
             00316  040:008

     Enter old programmer's last name: CINTZ 
             00318  040:009

     Enter old programmer's first name: SIMON 
             00320  198:007
             00321  208:254
             00322  081:028
             00323  080:000

     Updating entries in PROG-AUTHOR
             00324  032:006
             00325  032:007
             00326  067:132

     +-D-A-T-A---F-I-L-E---D-U-M-P----------+         <---data block for 1st REPLACE 
     !
     !
     ! REPLACE(CHAIN)    COND: 0  STATUS: 0  RECNO: 1
     ! BASE: PROGB   SET: PROG-AUTHOR
     !   KEY: PROGRAMMER   ARGUMENT: CINTZ           SIMON  <--key/argument regs 
     !
     !       UPDATE:                     VALUE:
     !        PROGRAMMER                   KING            WENDY <--update value 
     !
     ! POSN: LIST:                        DATA:       <--list/argument regs 
     !  0     PROG-NAME                    PROG1A
     !  8     PROGRAMMER                   CINTZ           SIMON
     +--------------------------------------+

     +-D-A-T-A---F-I-L-E---D-U-M-P----------+         <---data block for 2nd REPLACE 
     !
     ! REPLACE(CHAIN)    COND: 0  STATUS: 0  RECNO: 2
     ! BASE: PROGB   SET: PROG-AUTHOR
     !   KEY: PROGRAMMER   ARGUMENT: CINTZ           SIMON
     !
     !       UPDATE:                     VALUE:
     !        PROGRAMMER                   KING            WENDY
     !
     ! POSN: LIST:                        DATA:
     !  0     PROG-NAME                    PROG2B
     !  8     PROGRAMMER                   CINTZ           SIMON
     +--------------------------------------+

     2 RECORDS REPLACED
             00330  208:254
             00331  068:129

     +-D-A-T-A---F-I-L-E---D-U-M-P----------+         <---data block for DELETE 
     !
     ! DELETE            COND: 0 STATUS: 0 RECNO: 14
     ! BASE: PROGB   SET: PROGRAMMERS
     !   KEY: PROGRAMMER   ARGUMENT: CINTZ           SIMON
     !
     ! POSN: LIST:                        DATA:
     +--------------------------------------+
             00334  000:000

     > EXIT 

Note that this test mode displays only that part of the list and data
registers included in a LIST= option of the data management statement.

Test Mode 34 

This test mode is used to trace instructions that access VPLUS forms.
The output from test mode 34 should always be sent to an alternate device
rather than your terminal.  Otherwise, the output interferes with the
forms displayed on the screen.

The compiler code used for this example is shown below.

                 starting location 
                  downarrow
      98.000  0035     ADD-CUSTOMER:
      99.000  0035
     100.000  0035         GET(FORM) ADDFORM,
     101.000  0035            INIT,
     102.000  0035            LIST=(ACCOUNT:DATE),
     103.000  0035            WINDOW=("Please enter a new customer"),
     104.000  0035            F7=START-OF-PROGRAM,
     105.000  0035            F8=END-OF-PROGRAM,
     106.000  0035            AITPREAD;
     107.000  0051
     108.000  0051     PUT-CUSTOMER:
     109.000  0051
     110.000  0051         SET(KEY) LIST(ACCOUNT);    <<Set up key register>>
     111.000  0052         FIND CUSTOMER, LIST=();    <<Check if customer exists>>
     112.000  0055
     113.000  0055         IF STATUS <> 0 THEN        <<Customer already in base>>
     114.000  0055 1         GO TO ADD-CUST-ERROR;
     115.000  0058
     116.000  0058         PUT CUSTOMER,
     117.000  0058            LIST=(ACCOUNT:DATE),
     118.000  0058            ERROR=PUT-ERROR(*);     <<Process PUT verb error>>
     119.000  0064
                  uparrow
                 ending location 

Before running the program VTEST in test mode -34, build a file named
TEST to receive the test data and then equate TRANDUMP to that file:

     :BUILD TEST; REC=-80,,F,ASCII 
     :FILE TRANDUMP=TEST 
     :RUN TRANSACT.PUB.SYS 

     SYSTEM NAME> VTEST,,-34,35,64                    <---run VTEST in test mode 34 with  
                                                            test output sent to file TEST 

The test output from file TEST looks like this:

     +-V-P-L-U-S---B-U-F-F-E-R---D-U-M-P----+  \
     !                                          \
     ! PUT(FORM)       CODE: 0     FKEY: 0       \
     ! FORM: MENU                FILE: CUSTF  TF  \
     !                                             \
     +--------------------------------------+       <--from previous form access 
     +-V-P-L-U-S---B-U-F-F-E-R---D-U-M-P----+      /    statements 
     !                                            /
     ! UPDATE(FORM)    CODE: 0     FKEY: 1       /
     ! FORM: MENU                FILE: CUSTF    /
     !                                         /
     +--------------------------------------+
             00035  160:131
     +-V-P-L-U-S---B-U-F-F-E-R---D-U-M-P----+      <--output from location 35 
     !
     ! GET(FORM)       CODE: 0     FKEY: 0         <--last key pressed is ENTER 
     ! FORM: ADDFORM          FILE: CUSTFORM
     !
     ! OFFSET: LIST:                 DATA:
     !  0       ACCOUNT               1113434343        \
     !  10      FIRST-NAME            MARGARET           \
     !  28      INITIAL               S                   \
     !  29      LAST-NAME             TRUEMAN              \
     !  49      STREET-ADDR           524 East 79th Street  <--entered data 
     !  71      CITY                  New York             /
     !  85      STATE                 NY                  /
     !  87      ZIP                   10024              /
     !  96      DATE                  07/21/82          /
     !
     +--------------------------------------+
             00051  198:000
             00052  065:137
             00055  011:001
             00058  048:137
             00064  004:000
             00035  160:131

     +-V-P-L-U-S---B-U-F-F-E-R---D-U-M-P----+       <--back to location 35 
     !
     ! GET(FORM)       CODE: 0     FKEY: 8          <--f8 pressed to exit 
     ! FORM: ADDFORM          FILE: CUSTFORM
     !
     ! OFFSET: LIST:                 DATA:
     !  0       ACCOUNT               ...w...;b.               \
     !  10      FIRST-NAME            .W...$...,...B,H..        \
     !  28      INITIAL               S                          \
     !  29      LAST-NAME             TRU..AN......  ...Z.        \
     !  49      STREET-ADDR           Y..>..5"......,.X.?...       <--garbage 
     !  71      CITY                  .......3......              /
     !  85      STATE                 >.                         /
     !  87      ZIP                   .........                 /
     !  96      DATE                  ..2....                  /
     !
     +--------------------------------------+

Test Mode 42 

This test mode lists the contents of the list and data registers only
when the list register is changed.

The compiler listing shown below is for two subcommands that are part of
a LIST command sequence; this code is executed by entering LIST
PROGRAMMER and LIST PROGRAM respectively.

                    starting location 
                     downarrow
         97.000  0019       $PROGRAMMER:
         98.000  0020       $PR:
         99.000  0020           <<list programmers>>
        100.000  0020
        101.000  0020           LIST PROGRAMMER:
        102.000  0021                PHONE;
        103.000  0022           OUTPUT(SERIAL) PROGRAMMERS,
        104.000  0022                          LIST=(PROGRAMMER:PHONE),
        105.000  0022                          SORT=(PROGRAMMER),
        106.000  0022                          NO COUNT;
        107.000  0028
        108.000  0028       END; <<end of LIST PROGRAMMER>>
        109.000  0029
        110.000  0029
        111.000  0029       $PROGRAM:
        112.000  0030       $P:
        113.000  0030           <<list programs>>
        114.000  0030
        115.000  0030           LIST PROG-NAME:
        116.000  0031                DESCRIPTION;
        117.000  0032           OUTPUT(SERIAL) PROGRAMS,
        118.000  0032                          LIST=(PROG-NAME:DESCRIPTION),
        119.000  0032                          SORT=(PROG-NAME),
        120.000  0032                          NO COUNT;
        121.000  0038
        122.000  0038       END; <<end of LIST PROGRAM>>
                     uparrow
                    ending location 

Note that in the following test output, the current contents of the data
register are never shown.  Only the previous contents are shown.  Thus,
the data register display in the test output from LIST PROGRAMMER
contains garbage.  Similarly, the data register display in the test
output from LIST PROGRAM contains data from the previous command
sequence.

     > TEST 42,19,38 

     > LIST PROGRAMMER 
             00020  032:007
     +-L-I-S-T---D-U-M-P--------------------+         <--issued for LIST PROGRAMMER 
     ! POSN: LIST:                        DATA:
     !  0     PROGRAMMER                   .a.B.a..b..............B.H....
     +--------------------------------------+
             00021  032:005
     +-L-I-S-T---D-U-M-P--------------------+         <--issued for LIST PHONE 
     ! POSN: LIST:                        DATA:
     !  0     PROGRAMMER                   .a.B.a..b..............B.H....
     !  30    PHONE                        ....
     +--------------------------------------+
             00022  066:129

     Programmer                     Phone Number
      CRESSMAN        PETE           3805
      ERCOLANI        JOE            4343
      KING            WENDY          3818
      LEDERMAN        ABE            3753
      VANN            KEITH          4046
             00028  000:000

     > LIST PROGRAM 
             00030  032:006
     +-L-I-S-T---D-U-M-P--------------------+         <--issued for LIST PROG-NAME 
     ! POSN: LIST:                        DATA:
     !  0     PROG-NAME                    VANN
     +--------------------------------------+
             00031  032:002
     +-L-I-S-T---D-U-M-P--------------------+         <--issued for LIST DESCRIPTION 
     ! POSN: LIST:                        DATA:
     !  0     PROG-NAME                    VANN
     !  8     DESCRIPTION                          KEITH         4046.........6.B..
     !                                     ........"........X.?
     +--------------------------------------+
             00032  066:130

     Program Name  Program Description
       CRUNCH        Compacts ASCII files.
       DISCOPY       Copies disc files.
       GTDATA        Generates random test data.
       PROJMAN       Project management using the critical path method.
       SGEN          Generates STREAM job files.
       TLIST         Lists the contents of a "STORE" tape.
       UNCRUNCH      Expands a file compacted by CRUNCH.
              00038  000:000

     > EXIT 

Test Modes 101 and 102 

These test modes allow you to keep track of the list and data register
size, and whether work-space recovery was needed.  Test mode 101 displays
test data at the end of every command sequence; test mode 102 displays
test data only at the end of the program.

     > TEST 101                          <---request test mode 101 

     > ADD PROGRAMMER                    <---start of command sequence 

     Enter programmer's last name: MARTIN 

     Enter programmer's first name: JOAN 

     Enter phone extension number: 3803 

     +-S-E-Q-U-E-N-C-E---D-U-M-P--+      <---current status of list/data regs 
     !                                      at end of this command sequence 
     !   MAXIMUM LIST= 2 ITEMS
     !   MAXIMUM DATA= 17 WORDS
     !   WORKSPACE RECOVERY= 0
     !
     +----------------------------+

     > ADD PROGRAM                       <---new command sequence 

     Enter program name: MYPROG 

     Program description: Test program for Manual 

     +-S-E-Q-U-E-N-C-E---D-U-M-P--+      <---status at end of second 
     !                                      command sequence 
     !   MAXIMUM LIST= 2 ITEMS
     !   MAXIMUM DATA= 34 WORDS
     !   WORKSPACE RECOVERY= 0
     !
     +----------------------------+

     > TEST 102                          <---request test mode 102 

     > LIST PROGRAMMER 

     Programmer                     Phone Number
      CRESSMAN        PETE           3805
      ERCOLANI        JOE            4343
      KING            WENDY          3818
      LEDERMAN        ABE            3753
      MARTIN          JOAN           3803
      VANN            KEITH          4046

     > LIST PROGRAM 
     Program Name     Program Description
      CRUNCH           Compacts ASCII files.
      DISCOPY          Copies disc files.
      GTDATA           Generates random test data.
      MYPROG           Test program for Manual
      PROJMAN          Project management using the critical path method.
      SGEN             Generates STREAM job files.
      TLIST            Lists the contents of a "STORE" tape.
      UNCRUNCH         Expands a file compacted by CRUNCH.

     > EXIT 

     +-R-U-N---D-U-M-P------------+      <---test output only issued 
     !                                      at end of program 
     !   MAXIMUM LIST= 2 ITEMS
     !   MAXIMUM DATA= 34 WORDS
     !   WORKSPACE RECOVERY= 0
     !
     +----------------------------+



MPE/iX 5.0 Documentation