Debugging Application Engine Programs

This section discusses how to:

  • Enable the Application Engine debugger.

  • Set debugging options.

To run a program in debug mode:

  1. Set the debug option.

    You can set the debug option in the following locations:

    • Start PeopleSoft Configuration Manager and select the Process Scheduler tab.

      In the Application Engine group, enable debug by selecting the Debug check box. This method applies to all methods of invocation.

    • If you used the command line option to invoke your Application Engine program, then you can include the −DEBUG Y parameter in the command line you submit to PSAE.EXE.

      If the Debug check box is already selected in PeopleSoft Configuration Manager, then you do not need to include the −DEBUG parameter in your command line.

      Note: Setting debug capabilities in either PeopleSoft Configuration Manager or the command line turns debug mode on. However, if you have debug enabled in Configuration Manager and you submit −DEBUG N on the command line, then the PeopleSoft Configuration Manager setting defines your default command line value and the command line can override the default.

    • If you have PeopleCode in your Application Engine program, enable the PeopleCode debugger.

      When you launch your program and the PeopleCode action runs, enter the PeopleCode debugger.

  2. Run the Application Engine program to debug.

  3. At the Application Engine Debugger prompt, enter a command to enable a debugging option.

    Each command is represented by a single letter, such as X,L, orM. Enter the letter that corresponds to the option you want to engage. To see a list of the available debugging options, enter? at the prompt.

To enable the PeopleCode debugger for Application Engine:

  1. Sign on to PeopleTools using the same user ID that you will use to invoke the Application Engine program.

  2. Open Application Designer.

  3. Select Debug, PeopleCode Debugger Mode.

    Your Application Engine program can be open on the desktop, but you do not need to open the Application Engine program or the PeopleCode action that you want to debug.

  4. Select Debug, Break at Start.

    This command will cause the Application Engine program to break before executing any PeopleCode programs within it.

Each debugger option is represented by a single letter that you specify at the prompt. To engage the option you select, press Enter.

Debugging Tips

Become familiar with these tips about debugging programs:

  • In some cases, such as when setting breakpoints or watch fields, submenus offer additional options.

    After you are familiar with the commands, you can enter multiple items on the command line to combine commands and bypass the submenus. For example, to see a list of the breakpoints, you could enter B L.

    To set a field as a watch field, you could enter W S MY_FIELD.

    To set a field as a watch field on a different state record, enter W S MY_AET.MY_FIELD.

    Note: The exception to this option is Modify, which always displays the current value and then prompts you to enter a new value. You can, however, enter M MY_AET.MY_FIELD to go directly to the new value prompt.

  • Letter commands are not case-sensitive.

    For example, Q and q are valid commands.

Debugging Options

Option

Description

Quit

Enter Q. This option performs a rollback on the current unit of work in the debugging run, and it ends the debugging session. It effectively terminates your Application Engine program.

Quit is useful for testing restart. Have some work committed and some uncommitted. Then, terminate the program at that point and roll back the pending work. You want to make sure the program restarts from the point of the last successful commit.

Exit

This option is valid only after one step has completed and another has not already begun. It is not valid once you reach the action level.

Use this option as an alternative to Quit. Exit ends the program run and the debugging session, but it also commits the current unit of that the program has already completed. This option can be helpful when testing your restart logic.

Commit

Enter C to commit the current unit of work in your program. This option is valid only after a step has completed and before another begins. It is not valid after you reach the action level.

You can use this option, for example, to use your database query tool to check the data in your database.

Break

Enter B to set a breakpoint. When the program reaches the breakpoint, it temporarily halts execution to enable you to observe the state of the current process.

Breakpoint options include:

Set: Enter S to set a breakpoint location.

The breakpoint location appears by default at the current location in the program, but you can specify other sections or steps by overriding the default values that appear in brackets.

Unset: Enter U to remove breakpoints previously set.

List: Enter L to list breakpoints. When you enter this command, make sure that you have entered B first to specify the break option. If you enter L from the main command prompt, you engage the Look option.

Look

Enter L to observe the values currently in the state record associated with the program you are debugging. You must specify the state record at the Record Name prompt. By default, the default state record as specified in your program properties appears in brackets.

You can also specify a specific field name on the state record in the Field Name prompt. To look at all the fields in the state record, leave the asterisk (*) within the brackets unchanged.

Modify

Enter M to modify the value of a state record value for debugging purposes. Suppose the previous steps did not set a value correctly but you want to see how the rest of the program would perform if the appropriate value existed in the state record. This option enables you to help your program in the debugging or testing phase.

As with the Look command, you must specify the appropriate state record (if you are using multiple state records), and you must specify one field. You can modify only one field at time.

Watch

Enter W to specify a field as a watch field. The program stops when the field value changes.

Similar to the Break command, you can specify options for Set, Unset, and List.

Step Over

Enter S to run the current step to completion and stop at the next step in the current section.

The behavior depends on the current level or the program. You start at the step level, and then can step into the action level. If you are at the step level and use step over, you go to the next step in the current section, skipping over all actions (including any call sections). If you are at the action level, step over executes the current action and stops at the next action in the current step, or at the next step in the current section.

Step Into

Enter I to observe a step or called section in more detail. For instance, you can check each SQL statement and stop. By using this option and checking the state record at each stop, you can easily isolate problem SQL or PeopleCode.

As with Step Over, the behavior depends on the level. At the step level, you can step into the action level and stop before the first action in the step. At the action level, if the current action is a call section, this option takes you to the first step in the called section. For other action types, this option acts the same as the Step Over option because no deeper level exists in which to step.

Step Out of

Liz Enter O. After you’ve stepped into a step or called section, use the Step Out of option to run the rest of the current step or called section and stop. As with the previous step options, the behavior of Step Out of depends on the current level of the program.

At the step level, Step Out of completes the remaining steps in the current section, returns to the calling section or step, and stops at the next action in that step. If the section is MAIN and is not called by another section or step, then Step Out of behaves the same as the Go option.

At the action level, Step Out of completes the current step and stops at the next step in the current section, or if the program is at the end of a section, Step Out of returns to the calling section or step.

Go

Enter G. After the program has stopped at a specific location, and you’ve examined its current state, you can use the Go command to resume the execution of the program. This is a helpful command when you have breakpoints set. With this command, the program won’t stop at a step or action; it only stops at the next breakpoint or watch field, or when the program runs to completion.

Run to commit

Enter R. Resumes execution of your program after it has stopped. This command forces the program to stop again after the next commit. This is a good option to use when observing your commit strategy and how it will affect a restart.

Example of the Look Option

To view the value stored in a specific field of the state record after a step or action, enter the appropriate field name at the Field Name prompt. For example, if you entered AE_TESTAPPL_AET at the Record Name prompt and AE_INT_6 at the Field Name prompt, you would see the value of the AE_INT_6 field in the AE_TESTAPPL_AET record.

You can also use an asterisk (*) as a wildcard to get a partial list. For example, if you enter AE_INT* at the Field Name prompt, you see only the fields that start with AE_INT; this is also true for the Record Name prompt. This feature is useful for both listing multiple fields across multiple records and as a shortcut. If you know that only one state record starts with XXX, you do not have to type the full name, just typeXXX.

Example of the Modify Option

If you wanted to set the AE_INT_15 field in the AETESTPROG to 10, you would enter the record (AE_TESTAPPL_AET) at the Record Name prompt and the field (AE_INT_15) at the Field Name prompt.

Then you would see the current value of the field. At the prompt, you could enter a new value.

Using the Look command, you can check to see that the value you specified now exists in the state record.

Example of the Watch Option

Enter S to set a watch field. After you enter S, you enter the record name (such as AE_TESTAPPL_AET) and field name (such as AE_INT_7) at the appropriate prompts.

Enter U to unset, or remove, a watch field from the list. After you enter U, you see a list of active watch fields. Enter the watch field ID number to remove a field. For example, if the field AE_INT_7 were second in the watch field list, you would enter 2 to remove it.

After a step or action completes, enter L to list, or view, the values of all the fields that you included in the watch list.

Note: You cannot set a watch on a long text field.