HP 3000 Manuals

TRANSACT/XL and TRANSACT/V Enhancements [ COMMUNICATOR 3000/XL XL RELEASE 2.1 ] MPE/iX Communicators


COMMUNICATOR 3000/XL XL RELEASE 2.1

TRANSACT/XL and TRANSACT/V Enhancements 

by Eleanor Normile 
Santa Clara Software Division 

TRANSACT has been enhanced to include several new language features and a
symbolic debugger, TRANDEBUG. The language enhancements are implemented
in TRANSACT/XL version A.02.01 and in TRANSACT/V version A.07.00.  The
symbolic debugger is implemented in TRANSACT/XL only.

This section provides a detailed description of the TRANSACT language
enhancements.  For each enhancement, the format of the new syntax is
provided along with a discussion of the new options.  Only changes to
current verb syntax are mentioned.  Those aspects of the verbs that
remain unchanged are not discussed.

Additionally, this section provides an overview of TRANDEBUG and a
tutorial on using the debugger.

TRANSACT LANGUAGE ENHANCEMENTS 

The language enhancements extend the TRANSACT language to allow:

 *  Multi-dimensional arrays

 *  Redirection of output from the DISPLAY statement

 *  Selective deletion of entries in the MATCH register

 *  Selective deletion of entries in the UPDATE register

 *  Access to more MPE intrinsics with the PROC statement

 *  Cursor positioning with VPLUS forms

MULTI-DIMENSIONAL ARRAYS 

This feature allows definition of multi-dimensional arrays.  Occurrences
of compound items and child items of compound items can be manipulated as
multi-dimensional arrays via subscripting.

Syntax 

     (array-item[(subscript1[,subscript2 ... [,subscriptn]))...

Parameters 

array-item          The array-item must be either a compound item or a
                    child item of a compound item.  This parameter is
                    required.

subscript           A subscript can consist of a data item, constant or
                    an arithmetic expression.  Subscripting is more
                    efficient if the subscript is either a constant, a
                    single word integer item or a simple expression (less
                    than three operands) consisting of single word
                    integers, constants or both.  When a data item is
                    used as a subscript it must be enclosed in
                    parentheses within the subscript parentheses.  The
                    first subscript applies to the highest level of the
                    compound item of which the array item is the child.
                    Each succeeding subscript refers to the next level in
                    the array.  Once the first value is specified, any
                    omitted values will automatically default to 1.
                    Since each dimensional level adds to the complexity
                    of the program it is recommended that the number of
                    subscripts be kept at a manageable level.  The
                    maximum number of allowable subscripts is 16.  The
                    subscript value will be evaluated at run time to
                    determine which occurrence of the array item is to be
                    referenced.  A subscript value of 1 refers to the
                    first element in the array.  Subscript values of less
                    than 1 or greater than 32,767 are invalid.  This
                    parameter is optional.  If it is omitted the array
                    item is treated as a single or compound data item.

Discussion 

Array subscripting provides Transact programmers with the ability to
manipulate multi-dimensional arrays by allowing them to subscript array
items.  The ability to subscript compound items is allowed, in most
contexts, for all Transact verbs.  Subscripting is not allowed when any
of the Transact registers are manipulated or updated (i.e.  list, update,
match, key, argument, and input registers), and for items included in the
"LIST=" option of any Transact input/output verb (i.e.  DELETE, FILE,
FIND, GET, PUT, REPLACE, and UPDATE). The error SUBSCRIPT NOT PERMITTED
IN THIS CONTEXT will be generated in these cases.

In addition, Transact generates the following run-time errors when arrays
are improperly used:

     TOO MANY SUBSCRIPTS FOR ITEM

     CANNOT SUBSCRIPT AN ITEM NOT DEFINED AS AN ARRAY

     ARRAY SUBSCRIPT IS OUT OF RANGE

(see examples for specific instances of these error messages).

CAUTION: As array subscripting is an alternative to using LET OFFSET, it
is not advisable to combine the use of the LET OFFSET verb with a
subscripted item.  Doing this may cause the program to update the data
register in areas outside the limits of the item referenced and could
lead to unpredictable results.  However, since this was previously the
only way to simulate multi-dimensional arrays, no error or warning
message will be generated.

Subscripted items will only be allowed in the following contexts:

CALL

     For the data item holding the name of the called system.
     For the data item holding the password.
     For the data item holding the open mode.
     For the data item on the DATA= option.

DATA

     For all data items in the case where DATA has no modifier.
     For all data items in the case of DATA(SET).

DELETE

     For the data item on the RECNO= option.

DISPLAY

     For all the data items to be displayed.

DISPLAY(TABLE)

     For all data items to be displayed.

FILE(CONTROL)

     For the data item on the PARM= option.

FIND

     For the data item on the RECNO= option.

FORMAT

     For all the data items used in the FORMAT.

GET

     For the data item on the RECNO= option.

GET(FORM)

     For the data item holding the name of the form used.
     For the data item on the FKEY= option.
     For the data item holding the name of the highlighted field.
     For the data item holding the message for the window.
     For the data item on the proposed new option CURSOR=.

IF

     For all the data items used as part of the condition.

LET

     For all the data items used as part of the expression (not permitted
     with LET(OFFSET)).

LOGTRAN

     For the data item holding the log message.

MOVE

     For all data items used as source or target fields.
     For the data items on the proposed new options START=, END=, and
     DELIMITER=.

OUTPUT

     For the data item on the RECNO= option.

PROC

     For all the data items used in the parameter list.

PUT

     For the data item on the RECNO= option.

PUT(FORM)

     For the data item holding the name of the form used.
     For the data item on the FKEY= option.
     For the data item holding the name of the highlighted field.
     For the data item holding the message for the window.
     For the data item on the proposed new option CURSOR=.

REPEAT

     For all the data items used as part of the condition.

REPLACE

     For the data item on the RECNO= option.

SET(FORM)

     For the data item holding the name of the form used.
     For the data item on the FKEY= option.
     For the data item holding the name of the highlighted field.
     For the data item holding the message for the window.
     For the data item on the proposed new option CURSOR=.

SET(LANGUAGE)

     For the data item holding the language.

SET(OPTION)

     For the data item on the FORMSTORE= option.
     For the data item on the VPLS= option.

UPDATE(FORM)

     For the data item holding the name of the form used.
     For the data item on the FKEY= option.
     For the data item holding the name of the highlighted field.
     For the data item holding the message for the window.
     For the data item on the proposed new option CURSOR=.

WHILE

     For all the data items used as part of the condition.

Example 

Complex multi-dimensional arrays have one or more child items associated
with each occurrence of the compound parent item.  Such a structure can
be considered an array of arrays.  The following example illustrates how
to use subscripting to describe a multi-dimensional array consisting of
the days of the year.  For simplicity, this example assumes that all
months are 28 days long.  The item "year" will hold one character for
each day of the year.

DEFINE(ITEM) year  x(336):
                          month  12 x(28) = year(1):
                               week  4 x(7) = month(1):
                                   day  7 x(1) = week(1);

The following example displays a specific day of the year:

     DISPLAY day(2,1,5);

This verb displays the fifth day of the first week in the second month.
Since "year" is not a compound item, the first subscript (2) refers to
the highest level compound item (month) of which day is a child.  The
next subscript (1) refers to the "week" which is the next highest parent.
Finally, the last subscript (5), refers to the fifth occurrence of the
compound item "day".

The next example shows what happens when succeeding subscripts are
omitted:

     DISPLAY day(2);

Since the omitted subscripts default to 1, this is equivalent to (2,1,1)
which displays the first day of the first week in the second month.

When the number of subscripts exceeds the number of dimensions specified
by the DEFINE statement an error occurs.  For example:

     DEFINE day(2,1,5,3);

There are not enough parent items to justify four subscripts.  This
example will result in an error and the message:  "TOO MANY SUBSCRIPTS
FOR ITEM" is displayed.

If the subscripts are larger than the specified range an error occurs.
For example:

     DISPLAY day(999);

This example will result in an error and the message "ARRAY SUBSCRIPT IS
OUT OF RANGE because 999 > 336" is displayed.

In some cases, you may want to globally reference all of the elements in
the array.  For example:

     MOVE (day) = " ";

Since there are no subscripts specified, this will set all 336 elements
to blanks.  Note that this is not the same as using day(1) as shown in
the next example:

     MOVE (day(1)) = " ";

Since there is one subscript all the remaining subscripts default to 1,
which is equivalent to specifying day(1,1,1).  In this case, only the
first element is set to a blank.

REDIRECTION OF OUTPUT FROM THE DISPLAY VERB 

This feauture allows redirection of DISPLAY output to an MPE file defined
in the SYSTEM statement.  This allows a program to easily produce
multiple reports by issuing DISPLAY statements to a file for each report
desired.  Page counters and line counters will also apply to the DISPLAYs
which are redirected to files.

Syntax 

     DISPLAY[([TABLE][,FILE=mpe-file])][display-list]...;

Parameter 

mpe-file            The name of an MPE file that will receive the output
                    from the DISPLAY statement.

Discussion 

The formatted output generated by DISPLAY can be redirected to a
specified file by using the FILE= option.  This feature allows you to
generate multiple reports and to save each in a different file.  The only
requirement is that the specified file must first be identified in the
SYSTEM statement using the FILE= option.  If the file is not pre-defined,
an "INVALID FILE NAME" error will occur during compilation.

When using this option, the DISPLAY verb sets the status register to 0 if
the operation was successful.  The status register is not changed if the
operation was unsuccessful.  The status register is not altered if the
FILE= option is not used.

When using SET(OPTION) PRINT the output file must be built with RECORDS=
133 characters.

Example 

The following examples illustrate the use of the FILE= option to redirect
formatted output:

 *  This example routes employee-name to the MPE file "report1".

    DISPLAY(FILE=report1) employee-name;

     *  This example routes employee-name, employee-address and salary to
        the file "report2".

        DISPLAY(FILE=report2) employee-name:  employee-address:  salary;

     *  This example routes employee-name, employee-address and salary to
        the file "report3".

        DISPLAY(TABLE,FILE=report3) employee-name:  employee-address:
        salary;

SELECTIVE DELETION OF MATCH AND UPDATE ENTRIES 

Entries in the MATCH and UPDATE registers may be selectively deleted by
using the RESET verb with the "MATCH" or "UPDATE" option.

Syntax 

     RESET(OPTION) MATCH [LIST({[item-name]})];
                                {  *  }

     RESET(OPTION) UPDATE [LIST({[item-name]})];
                                 {  *  }

Parameters 

item-name           Specifies the name of the item to be deleted.  An
                    asterisk (*) can be used in place of the item name to
                    delete the last entry added to the list register.

Discussion 

When the MATCH option is specified, if there is an entry in the MATCH
register with the specified item name it will be deleted.  If more than
one such entry exists in the MATCH register, (i.e., multiple selection
criteria in an OR chain), all will be deleted.  Only entries which were
created in the current level can be deleted.  The error message "ITEM TO
BE DELETED NOT FOUND IN MATCH REGISTER" is output at run time if the item
specified is not found in the set of entries for the current level.

When the UPDATE option is specified, if there is an entry in the UPDATE
register with the specified item name, it will be deleted.  Only entries
which were created in the current level can be deleted.  The error
message "ITEM TO BE DELETED NOT FOUND IN UPDATE REGISTER" will be output
at run time if the item specified is not found in the set of entries for
the current level.

Example 

 *  The following examples show how to use the MATCH option to delete
    specific items from the MATCH register.

         MOVE (name) = "Fred";
         SET(MATCH) LIST(name);
         MOVE (name) = "BUD";
         SET(MATCH) LIST(name);
         SET(MATCH) LIST(address);
         SET(MATCH) LIST(zip);

 *  This example deletes "address" from the MATCH register.

         RESET(OPTION) MATCH LIST(address);

 *  This example deletes both "name" entries from match register.

         RESET(OPTION) MATCH LIST(name);

 *  This will cause the error message ITEM TO BE DELETED NOT FOUND IN
    MATCH REGISTER since "age" is not one of the items in the MATCH
    register.

         RESET(OPTION) MATCH LIST(age);

 *  The following example shows what happens when using the UPDATE option
    to delete an item not added in the entries for the current level.
    This example will result in an error since "name" was not added in
    the current level.

    SET(UPDATE) LIST(name);
               LEVEL;
                    SET(UPDATE) LIST(address);
                    RESET(OPTION) UPDATE LIST(name);

          END(LEVEL);

ACCESS TO MORE MPE INTRINSICS WITH PROC 

This feauture allows programmers to use DEFINE(INTRINSIC) and to execute
intrinsics with the PROC statement.  Additional intrinsics which can now
be accessed are:

ABORTSESS        Aborts the specified session

FINTEXIT         Causes a return from the user's interrupt procedure

FPARSE           Parses and validates file designators

GETINFO          Gets INFO string and PARM value from the RUN command or
                 the CREATEPROCESS intrinsic

JOBINFO          Returns job/session related information

STARTSESS        Initiates a session on the specified terminal

CURSOR POSITIONING WITH VPLUS FORMS 

The TRANSACT verbs, GET(FORM), SET(FORM), PUT(FORM) and UPDATE(FORM) have
a new option, CURSOR=, to allow a program to position the cursor to a
specified field in a VPLUS form.

Syntax 

     CURSOR={field-name}
            {(item[(sub)])}

Parameters 

field-name          The field-name parameter specifies the field in which
                    the cursor is to be positioned.

item(sub)           Specifies the item containing the name of the field
                    in which the cursor is to be positioned.  The item 
                    may be subscripted if an array element is being
                    referenced.

Example 

The following example positions the cursor in the "phone" field:

GET(FORM) FORM1,
              LIST=(name,address,phone),
              CURSOR=phone;

The following example also positions the cursor in the "phone" field:

DEFINE(ITEM) posn  x(10);
     MOVE (posn) = "phone";

     GET(FORM) FORM1,
               LIST=(name,address,phone),
               CURSOR=(posn);

OVERVIEW OF TRANDEBUG 

TRANDEBUG is an interactive tool that helps you debug native mode
TRANSACT/XL applications.  You use TRANDEBUG to isolate run-time errors
after your program has compiled and linked successfully.  TRANDEBUG
enables you to:

 *  Stop the execution of a program at specific locations, or when
    specified items and registers change values

 *  Display the contents of:

     *  TRANSACT data items

     *  TRANSACT registers

     *  Runtime options

     *  Call stack

     *  Perform stack

     *  VPLUS communications area

 *  Modify the contents of TRANSACT data items, registers and runtime
    options

 *  Trace the execution path of a program

 *  View the source code for the program being debugged

 *  Record and playback TRANDEBUG commands using an MPE/XL file

 *  Issue MPE/XL commands

 *  Invoke the MPE/XL Native Mode Debug Facility, NMDEBUG

 *  Trace KSAM, MPE/XL file and TurboIMAGE intrinsic calls

Features and Benefits 

TRANDEBUG offers the following major features and benefits:

Symbolic Debugger 

TRANDEBUG is a symbolic debugging interface for TRANSACT/XL. You can
interactively monitor your program execution, program location and
examine contents of TRANSACT data items and registers without knowing
memory addresses.

Breakpoints 

TRANDEBUG lets you stop your program at specific points of interest
called breakpoints.  The BREAK SET command sets a breakpoint at a
specified segment number and P-code offset.  You can set breakpoints at
data items and registers.  You can also list and delete breakpoints
during a TRANDEBUG session.

TRANSACT Display Functions 

TRANDEBUG lets you display information about your TRANSACT/XL program
with the numerous options of the DISPLAY command.  You can display the
contents of TRANSACT data items, registers, runtime options, database or
file information, call and perform stack, and the VPLUS communications
area.  The data and list registers are displayed by the DISPLAY ITEM
command.  Other registers that can be displayed are the match, key,
update, status, statusin, argument and input run-time registers.

TRANSACT Modify Functions 

TRANDEBUG lets you modify values of TRANSACT data items, registers and
runtime options.  The MODIFY ITEM command enables you to update the
content of a data register.  You can modify the input, data, key,
argument, match, status and update registers.

Program Execution Control 

You can control your program execution when you use TRANDEBUG. The
CONTINUE command resumes program execution.  When breakpoints are
encountered, TRANDEBUG suspends program execution so that you can
examine or manipulate data.  You can also execute a program on a
statement-by-statement basis by using the STEP command.

MPE/XL Subsystem Support 

TRANDEBUG lets you take advantage of the MPE/XL native mode environment.
You do not have to convert TRANSACT/XL applications to compatibility mode
to troubleshoot programming problems.  Statements that begin with a colon
(":") are automatically passed to the MPE/XL Command Interpreter for
execution.  TRANDEBUG allows you to invoke the native mode debugger
(NMDEBUG.PUB.SYS) when you want to monitor your program's execution at
the machine instruction level.

Source Code Window 

TRANDEBUG includes a window through which you can view source code for
the program being debugged.  This window can be turned on and off any
time during a TRANDEBUG session.  You use the WINDOW ON command to
display the source file.  You can change the window size, page forward or
backward through the source file, or jump to a specified statement.

TRANDEBUG Log and Command Files 

With TRANDEBUG, you can log your interactive debug commands to MPE/XL
files.  You can use this feature to create a procedure for establishing
frequently used breakpoints in a program under development.  The LOG ON
command starts a recording session where your subsequent keystrokes are
recorded to a log file.  The LOG OFF command ends the recording session,
and LOG CLOSE saves the recording to a permanent file.  You then invoke
the commands in the log file with the USE command.  You can also use an
editor to create command files that can be invoked with the USE command.

Arithmetic Trapping 

TRANDEBUG provides a mechanism to gain control of your program when
arithmetic traps occur.  For example, an integer overflow or division by
zero set an arithmetic trap.  When this happens, an error message is
displayed and control returns to TRANDEBUG so you can determine what
caused the error.

CONTROL-Y Trapping 

When CONTROL-Y is pressed during a debugging session, program control
returns to TRANDEBUG. At this point, any valid TRANDEBUG commands can be
entered.  This gives you the ability to regain control of TRANDEBUG
before the next breakpoint is reached.

Online Help 

The HELP subsystem provides a way to gain information regarding command
syntax, parameter descriptions and examples.  Any time you need help in
executing a command, simply type HELP and optionally the command name.
Commands are also listed in the Command Description section of this
chapter.

Compatability 

TRANDEBUG provides debugging support exclusively for TRANSACT/XL
applications.  TRANSACT/XL programs compiled from TRANCOMP/V generated
P-code files are not supported.  You must compile your program from a
source file in order to use TRANDEBUG.

TRANDEBUG does not support other programming languages, such as COBOL,
FORTRAN or Pascal.  The native mode debugger, NMDEBUG, can be invoked
from within TRANDEBUG for this purpose.

USING TRANDEBUG 

This section provides a tutorial introduction to the frequently used
TRANDEBUG commands.  Its purpose is to help you become familiar with
using TRANDEBUG.

After reading this section, you will know how to perform the following
tasks:

 *  Compile a program with the TRANDEBUG option

 *  Start and end a TRANDEBUG session

 *  View source code in TRANDEBUG

 *  Set breakpoints

 *  Continue program execution from within TRANDEBUG

 *  Display data items

 *  Modify data items

 *  Step through a program

Compiling with the TRANDEBUG Option 

To use TRANDEBUG, you first compile your TRANSACT/XL program(s) using the
TRANDEBUG option.  You specify this option in addition to any other
compiler options that your application requires.  The following example
shows how to compile and link a main program using the TRANDEBUG option:

     :TRANXLLK MYSOURCE,MYPROG,MYLIST;INFO="TRANDEBUG,NOLIST"

The compiled output appears as follows:

     PAGE 1 HEWLETT-PACKARD HP30138A.00.02 TRANSACT/XL (C)HEWLETT-PACKARD
       CO. 1987  MON, SEP 12, 1988,  7:42 AM

       COMPILING WITH OPTIONS: CODE,DICT,ERRS

       NUMBER OF ERRORS =   0          NUMBER OF WARNINGS =   0
       PROCESSOR TIME  0:00:02.1       ELAPSED TIME  0:00:03

       END OF COMPILE
       HP Link Editor/XL (HP30315A.00.25) Copyright Hewlett-Packard CO. 1986

       LinkEd> link from=$oldpass;to=myprog

       END OF LINK
       :

If your TRANSACT application includes TRANSACT subprograms, each
subprogram that requires debugging must also be compiled with the
TRANDEBUG option.

Starting and Ending a TRANDEBUG Session 

After your program has successfully compiled and linked with the
TRANDEBUG option, you run your program to start a TRANDEBUG session.  The
following example shows how TRANDEBUG identifies itself:

     :RUN MYPROG
_________________________________________________________________________
|                                                                       |
|     TRANDEBUG Symbolic Debugger  (c)Copyright Hewlett-Packard CO. 1988|
|                                                                       |
|     TRANDEBUG>  _                                                     |
|                                                                       |
|                                                                       |
|     F1 F2 F3 F4                  F5 F6 F7 F8                          |
|                                                                       |
_________________________________________________________________________

          Figure 7-7.  The TRANDEBUG Screen 

To terminate a TRANDEBUG session, type ABORT at the TRANDEBUG prompt:

     TRANDEBUG> ABORT

This command forces your program to abort in addition to exiting
TRANDEBUG. After you have completed your debugging session, you must
recompile your program without the TRANDEBUG compiler option.  Be careful
not to move program files compiled with TRANDEBUG to production.

Displaying Source Code in TRANDEBUG 

TRANDEBUG offers a source code window that enables you to view statements
in the source code as they execute.  This window can be controlled
through the use of the WINDOW and PAGE commands.  Your program can run
with the windows turned on or off.  You can change the size of the window
and scroll forward and backward through the source code listing
independent of the program's execution.

To display source code for the program being debugged, type WINDOW ON at
the TRANDEBUG> prompt as follows:

     TRANDEBUG> WINDOW ON

TRANDEBUG immediately displays the source code for the program being
debugged.  An example source code window appears as follows:
_________________________________________________________________________
|                                                                       |
|     TRANDEBUG Symbolic Debugger  (c)Copyright Hewlett-Packard CO. 1988|
|       0000        entry = "Enter programmer's last name":             |
|       0000      FNAME    U(14) = PROGRAMMER(17),  <<First Name>>      |
|       0000        entry = "Enter programmer's first name":            |
|       0000 <<end of data item definitions>>                           |
|       0000 <<initialize>>                                             |
|      >0000 set (delimeter) "";                                        |
|       0001                                                            |
|       0001 $$ADD:   <<begin the ADD command>>                         |
|       0001   $PROGRAMMER:                                             |
|       0002     <<add programmer>>                                     |
|     System: PTRAC     SOURCE CODE WINDOW     Segment: 0  Offset: 0    |
|                                                                       |
|     TRANDEBUG> _                                                      |
|                                                                       |
|     F1 F2 F3 F4                  F5 F6 F7 F8                          |
_________________________________________________________________________

          Figure 7-8.  TRANDEBUG Source Code Window 

In the example shown, the ">" (right arrow) is the current location 
marker.  It points to the statement that will be executed next.  In this
example, the current location marker points to the first executable
program statement.  The current system, segment and offset are displayed
within the source code window.

Setting a Breakpoint 

When you want to stop at a specific location in your program, you can set
a breakpoint.  With TRANDEBUG, you set a breakpoint by specifying the
segment number and P-code offset within a TRANSACT/XL program.  If a
breakpoint is to be set in the current segment, just specify the P-code
offset.

Figure 7-9 shows a compiled listing for a program that adds programmers
to a TurboIMAGE database.  This program is used in the remaining examples
presented in this section.

     Line 
     No.        Pcode 
         |   Offset 
        1.000   |       system PTRAC,
        2.000  0000            base = PROGB ( ,3),
        3.000  0000            signon = "PTRAC   A00.00";
        4.000  0000
        5.000  0000     << PTRAC is a program that adds programmers to     >>
        6.000  0000     << a TurboIMAGE database called PROGB.             >>
        7.000  0000     <<PROGB is opened with exclusive modify access.   >>
        8.000  0000
        9.000  0000     define(item)
       10.000  0000
       11.000  0000         PHONE        U(4), <<programmer's phone extension #>>
       12.000  0000           head = "Phone Number",
       13.000  0000           entry = "Enter phone extension number":
       14.000  0000
       15.000  0000         PROGRAMMER   U(30),   <<programmer's name>>
       16.000  0000           head = "Programmer":
       17.000  0000             LNAME    U(16) = PROGRAMMER(1),  <<last name>>
       18.000  0000               entry = "Enter programmer's last name":
       19.000  0000             FNAME    U(14) = PROGRAMMER(17), <<first name>>
       20.000  0000               entry = "Enter programmer's first name";
       21.000  0000      << end of data item definitions>>
       22.000  0000      << initialize>>
       23.000  0000     set(delimiter) "";
       24.000  0001
       25.000  0001     $$ADD:  << begin the ADD command>>
       26.000  0001       $PROGRAMMER:
       27.000  0002           << add programmer to PROGRAMMERS master dataset>>
       28.000  0002
       29.000  0002           list PROGRAMMER:
       30.000  0003                PHONE;
       31.000  0004           data LNAME:
       32.000  0005                FNAME:
       33.000  0006                PHONE;
       34.000  0007           put PROGRAMMERS, list=(PROGRAMMER:PHONE);
       35.000  0011       end;  << end of ADD PROGRAMMER>>
       36.000  0012
       37.000  0012     end PTRAC;

          Figure 7-9.  Sample TRANSACT/XL Program 

In Figure 7-9, only the P-code offset is required to set a breakpoint.  A
segment number is not required since only the current segment is being
debugged.

To specify a breakpoint at P-code offset 7, type BREAK SET at the
TRANDEBUG prompt:

     TRANDEBUG> BREAK SET 7

After the breakpoint is set, TRANDEBUG displays the following:

     Breakpoint Set:
          System      Segment      Offset     Count       Command List
          ------------------------------------------------------------
       0. PTRAC             0           7         1

When the breakpoint is reached, TRANDEBUG suspends program execution and
displays the TRANDEBUG prompt.

Continuing Program Execution 

The CONTINUE command resumes the execution of the program being debugged.
Once you have set up initial breakpoints during a debugging session, you
can resume program execution by typing CONTINUE at the TRANDEBUG> prompt.
TRANDEBUG continues execution of your program until a breakpoint is
encountered or the program terminates.

The following example uses the CONTINUE command for the sample program
shown in Figure 7-9:

     TRANDEBUG> CONTINUE
     >ADD PROGRAMMER
       Enter programmer's last name> LORENZ
       Enter programmer's first name> JAMES
       Enter phone extension number> 5000
                   BREAKPOINT ENCOUNTERED, EXECUTION STOPPED:

                         SYSTEM          SEGMENT      OFFSET
                         -----------------------------------
                         PTRAC                 0           7
          TRANDEBUG>

Normal program execution resumes after you issue the CONTINUE command.
The program continues until a breakpoint is reached.  When the breakpoint
is encountered, TRANDEBUG suspends program execution and displays the
TRANDEBUG prompt.

When CONTROL-Y is invoked during a debugging session, program control
returns to TRANDEBUG. You can then set additional breakpoints and type
CONTINUE to resume execution of your program, or issue any other valid
TRANDEBUG commands.

Here is an example of using CONTROL-Y:

     TRANDEBUG> CONTINUE
        >ADD PROGRAMMER
        Enter programmer's last name: <CONTROL-Y>
        TRANDEBUG> BREAK SET 7
        TRANDEBUG> CONTINUE

Displaying the Values of Data Items 

To display the value of a data item, you issue the DISPLAY ITEM command
at the TRANDEBUG prompt.  When you use this command, you can display the
contents of all items in the list and data registers or specific items.

The following example displays all items in the list and data registers:

     TRANDEBUG> DISPLAY ITEM

         LIST REGISTER:
        PROGRAMMER          :   LORENZ     JAMES
        PHONE               :   5000

The following example displays a specific data item:

     TRANDEBUG> DISPLAY ITEM PROGRAMMER

        PROGRAMMER          :   LORENZ     JAMES

Modifying the Values of Data Items 

To modify the value of a data item, type MODIFY ITEM followed by the data
item name at the TRANDEBUG prompt.  You can modify the content of the
data register, but not the list register.  After you issue the MODIFY
ITEM command, TRANDEBUG displays the specified data item value and
prompts you for the new value.  Pressing RETURN without entering a new
value leaves the data item unchanged.

The following example modifies the FNAME child data item:

     TRANDEBUG> MODIFY ITEM FNAME
        FNAME            : < JAMES                  > : = JIM

        TRANDEBUG> DISPLAY ITEM PROGRAMMER

        PROGRAMMER:  LORENZ JIM
        TRANDEBUG>

Stepping Through a Program 

The STEP command causes one or more groups of instructions to be
executed.  It can be used when you want to examine the contents of
variables both before and after the groups of instructions are executed.

The TRANSACT/XL compiler determines the level of granularity at which you
can single step through a program.  TRANDEBUG enables you to single step
through programs at a level that is meaningful to the TRANSACT/XL
language.

When single stepping through the LIST and DATA statements, TRANDEBUG
returns control to you after each data item is loaded into the list and
data registers.

When single stepping through other TRANSACT/XL verbs, TRANDEBUG returns
control to you after each statement is executed.

The following example uses the STEP command to control program execution:

   1.  The current location marker points to the LIST PROGRAMMER
       statement (pcode offset = 2).  The user types DISPLAY ITEM at the
       TRANDEBUG prompt as shown below:
_________________________________________________________________________
|                                                                       |
|     TRANDEBUG Symbolic Debugger  (c)Copyright Hewlett-Packard CO. 1988|
|        0001                                                           |
|        0001  $$ADD:   << begin the ADD command>>                      |
|        0001    $PROGRAMMER:   <<add programmer>>                      |
|        0002                                                           |
|       >0002        list  PROGRAMMER:                                  |
|        0003              PHONE;                                       |
|        0004        data  LNAME:                                       |
|        0005              FNAME:                                       |
|        0006              PHONE;                                       |
|     System: PTRAC     Source Code Window     Segment: 0  Offset: 2    |
|                                                                       |
|     TRANDEBUG> DISPLAY ITEM                                           |
|      *ERROR: LIST REGISTER EMPTY (TDEBUG 300)                         |
|                                                                       |
|     TRANDEBUG>_                                                       |
|                                                                       |
|     F1 F2 F3 F4                  F5 F6 F7 F8                          |
_________________________________________________________________________

   2.  Program execution is resumed briefly with the STEP 3 command.  Th
       "Lorenz" is entered in response to a program prompt.  Control
       returns to TRANDEBUG after the 3 program instructions are
       executed.  The user then types the DISPLAY ITEM command at the
       TRANDEBUG prompt:
_________________________________________________________________________
|                                                                       |
|     TRANDEBUG Symbolic Debugger  (c)Copyright Hewlett-Packard CO. 1988|
|        0001                                                           |
|        0001  $$ADD:   << begin the ADD command>>                      |
|        0001    $PROGRAMMER:   <<add programmer>>                      |
|        0002                                                           |
|        0002        list  PROGRAMMER:                                  |
|        0003              PHONE;                                       |
|        0004        data  LNAME:                                       |
|       >0005              FNAME:                                       |
|        0006              PHONE;                                       |
|     System: PTRAC     Source Code Window     Segment: 0  Offset: 5    |
|                                                                       |
|     TRANDEBUG> STEP 3                                                 |
|     Enter programmer's last name> LORENZ                              |
|     TRANDEBUG> DISPLAY ITEM                                           |
|                                                                       |
|        LIST REGISTER :                                                |
|     PROGRAMMER          :   LORENZ                                    |
|     PHONE               :                                             |
|                                                                       |
|     TRANDEBUG>_                                                       |
|                                                                       |
|     F1 F2 F3 F4                  F5 F6 F7 F8                          |
_________________________________________________________________________

TRANDEBUG Startup Initialization File 

When TRANDEBUG begins execution of a program, it searches for a startup
file before returning control to you.  This startup file must be named
"TDBGINIT" and reside in the same group as the program file.  The file
must be in ASCII format with each line representing a command line for
TRANDEBUG.

When all the commands in the startup TDBGINIT file have executed, control
returns to you.  This startup file can be used if a series of commands
must be executed each time the debugger is started.

Controlling Input and Output Destinations 

To debug an application program which uses VPLUS, you may redirect the
program's VPLUS input and output forms to another terminal.

For example, to redirect your VPLUS forms to display on logical device 40
you would issue the following file equation before starting your
debugging session:

     :FILE TRANVPLS; DEV=40
     :RUN MYPROG

Disabling the Debugger 

Under some circumstances, it might be desirable to turn off TRANDEBUG
without having to recompile the program without the TRANDEBUG compiler
option.  The TRANDEBUG debugger examines the TRANDEBUG MPE/XL system
variable and disables debugging if this variable is set.

To disable TRANDEBUG for your session, type the following command before
running your program:

     :SETVAR TRANDEBUG,"OFF"

The debugger can then be turned on by typing the following command:

     :SETVAR TRANDEBUG,"ON"


NOTE If the TRANDEBUG system variable is not set, then a program compiled with the TRANDEBUG option will by default run in debug mode.
Alternate Debug Entry Points You may sometimes have a large complex application composed of many TRANSACT systems under development. When performing integration testing, you might have all systems compiled with TRANDEBUG enabled at the same time, but desire to run only one of the many systems in debug mode. It is possible to do this using the TRANDEBUG system variable. To begin your debugging session at a TRANSACT/XL system other than the main program, you can use the TRANDEBUG system variable as follows: :SETVAR TRANDEBUG,"startsystem" This enables your program to execute without invoking TRANDEBUG until startsystem begins execution. TRANDEBUG Run Time Environment By default, TRANDEBUG is automatically invoked after you compile your program with the TRANDEBUG compiler option. Unless you specify which system you want to debug by using the SETVAR TRANDEBUG system command (see "Alternate Debug Entry Points"), TRANDEBUG is invoked for the main program. In order for TRANDEBUG to be invoked for a particular system, the following two conditions must be met: * The system must be compiled with the TRANDEBUG compiler option. * The work file ITxxxxxx (where xxxxxx is the system name) generated by the TRANSACT/XL compiler, must be accessible. Arithmetic Traps TRANDEBUG provides a mechanism to gain control of your program when arithmetic traps occur. When an arithmetic trap occurs, the error message is displayed and control returns to TRANDEBUG so that you can display data item values and determine what caused the error. Once you resume execution from TRANDEBUG, the same program flow takes place as before. Control is transferred to the TRANDEBUG prompt if you are running a command driven program or the EXIT/RESTART? prompt appears if your program is not command driven.


MPE/iX Communicators