Applied PBL Peeper
How do I check for memory leaks?
Using the Find Page, search for both Create and Destroy in the same pass. Ensure that
Destroys are executed for all Creates.
How do I migrate my application back from PowerBuilder 9 to
Create an empty directory. Load your application into PBL Peeper 9. Go to the Export
Page and the Mass Export subpage. Export the application to that empty directory. Exit
PBL Peeper 9. Edit all exports to remove any PowerBuilder 9 specific code, such as
HTMLDW specifications in DataWindows. Load any application in the PBLs Page of
PBL Peeper 8. Use a tool like PowerGen (http://www.ecrane.com) To Bootstrap Import
the exports into PBLs. (People back migrating to PowerBuilder 9 or later have the option
of using ORCAScript to bootstrap the PBLs. Library Painter becomes problematic when
loading cross-dependent or circularly dependent objects.) Go to PowerBuilder 8 and run a
full regeneration of the new PBLs.
How do I check that all objects are built based on my class library?
Load the application. Go to the Lists Page, the Objects subpage. Run the View / Show
menu item and select Ancestor Information. Set the filter to Lower (Ancestor) = Lower
(Type). The objects shown should only be the class library objects. Repeat the same
process on the Controls subpage, or produce the Inheritance report and include controls,
reviewing the System Inherited Controls section at the end.
Overriding scripts that are inherited from your class library can defeat your ability to
implement universal logic in the ancestors. Scripts that override the ancestor without
calling the ancestor anywhere in its script should be reviewed as to why the override was
done, and the framework should be evaluated to determine if the functionality being
avoided should be configurable from the descendant. To get a list of these scripts, go to
the Scripts List subpage, and select Show... / Extended. A filter that looks something
like this should give you a list of scripts that should be reviewed for internal calls to the
(Type = “Function” AND Scripted_Ancestor = “Yes”) OR
(Type = “Event” AND Extended = “Overridden” AND
( (Event_Type = “System” AND Owner_Has_Ancestor = “Yes”) OR
(Event_Type = “Custom” AND Custom_Defn = “Ancestor”)
How do I ensure that GUI standards have been kept?
To check simple attribute-based GUI standards (e.g. font face, font height, colour), go to
the appropriate subpage (Objects, Controls or DW Objects) on the Lists page. Run the
View / Show menu item and select Attributes, selecting the attribute(s) to check. Sort by
the attribute to review, and look for any items that do not meet the standard.
To check complex GUI standards (e.g. distance between controls), go to the appropriate
subpage (Objects or Controls) on the Lists page. Run the View / Show menu item and
select Attributes, selecting the attribute(s) to check. Export the data and the syntax.
Import the syntax to review the DataWindow’s table structure. Then build an external
DataWindow with identical table structure that includes additional groupings, computed
columns, etc... that will be necessary to determine GUI standard compliance. Import the
data exported from PBL Peeper and review.
I want to browse an object, but I don’t know what PBL it’s in.
Go to the Lists page, the Objects subpage. Use the Edit / QuickFind function (with focus
in the Object column) or the Edit / Find function to locate the object in the list. Use the
View / Browser function to switch to that object on the Browse Page (this menu item is
also available on the toolbar, using the same icon as the Browse Page).
Or, go to the Browse Page and use the Edit / QuickFind function (with focus on the
treeview). Use the Up function to move to the PBL.
I want to review all the DataWindow Clicked (or other) scripts.
Go to the Lists page, the Scripts subpage (be prepared to wait as it indexes all objects
containing scripts). Select the View / Show menu item, and select Owner Type from the
list. Sort and filter as appropriate. To review within PBL Peeper, select from the list
successive scripts to review and select the View / Browser menu item (or the
corresponding toolbar item). To review all the scripts at once, or to review outside of
PBL Peeper, select all the rows for the scripts to review, and select the File / Print menu
item, selecting Print selected scripts’ contents from the list. Select the Output Target as
Rich Text Window. This will produce a rich text window containing the scripts you want
to review. These can be searched online, or saved or printed for later review.
My application GPFs.
Run your application with PBDebug turned on (search your manuals for how this works).
Be warned that your application will run quite slowly for this, and may produce a rather
large trace file. Load your application into PBL Peeper. Go to the Trace page and load the
trace file. Select the View / Last menu item (or toolbar icon). This will take you to the last
line your application executed before it GPF’d. Selecting View / Show... / Current Call
Stack will give you the context from which the last function was called.
How do I use PBL Peeper for producing reports on my system?
The type of reports you want will determine how you use PBL Peeper for reporting. In
the Reports Page, using the Application Print report is a good start. The resolve type
will significantly influence the type of information this conveys (see Preferences).
Those wanting to include the contents of objects in their documentation can use Rich
Text Window as the Output Target. On the Lists Page, several lists can be used as
produced immediately. The View / Show menu item gives opportunity to add extra
information to the lists, including any PowerBuilder attribute (e.g. X, Y, Width, Height)
for objects, controls and DataWindow objects. If the format of the lists is unsuitable, or
additional groupings or calculated fields are desired, exporting the data and syntax can be
exported for later customization. The Reports Page may also include reports suitable for
Can I produce system metrics from PBL Peeper?
On the Lists Page, sums and counts are always included at the bottom of every list. The
View / Show menu item also shows information useful in collecting statistics, such as
script line count or object line count. For ad-hoc reporting of metrics, these lists can be
filtered to produce statistics (e.g. filter the Objects list on Type to get a count of
windows). For reproducible reports, export the syntax and data from a basic list (without
using the Show option to display additional information), and produce a report with
appropriate groupings and computed fields with identical data structure to the list
DataWindow. Import the exported data whenever metrics are required.
I want to move an object to another application, but I don’t know what
other objects it needs.
The Lists Page, References subpage provides this information. Select the object in the
left panel, with Ancestors, References and Cascading all checked. The resulting set of
objects in the right pane, if copied over to the other application, will allow for a clean
regen without ancestor missing errors or reference missing errors.
I want to find how many times a function is being called during runtime for
a certain task.
Produce a text debug trace of a sample application run using PowerBuilder’s PBDEBUG
functionality. Start PBL Peeper with the application and load the trace file into the Trace
Page. Use the View / Show menu item and select Call stacks matching.... In the window
that pops up, enter the name of the function and press Find. The window that is produced
will show all instances in the trace file where that function was called, including the call
stack that produced the call to that function.
How do I see all the instance variables?
Using the Find Page, search for “type variables” (the internal header for instance
variables in exports) in character-by-character mode, searching All portion types,
outputting the entire script/portion. Similar methods can be used for shared variables and
How do I launch PBL Peeper from the source PBLs in Windows Explorer
You can associate PBL Peeper with PBLs and assign actions to them that occur if you
double click them or bring up their context menu. The following should get you started in
the right direction. It is based on what I did on a Win98SE system; see your OS
documentation for details.
• In Windows Explorer, View / Folder Options.... / File Types
• Assuming there’s no existing definition for PBL, press New Type
• Press Change Icon... and select the icon you want to associate with PBLs
(I browsed to the PowerBuilder executable and associated the
• Put PowerBuilder Library in Description of Type
• Under actions, select New...
• Put Open PBL’s App in Action; put "G:\Program
Files\Techno-kitten\PBL Peeper 9\pblpeeper9.exe" /pblapp:%1 in
Application used to perform action (the path to the PBL Peeper
executable is, of course, specific to your installation); press OK
• Optionally, repeat for Open PBL using the /pbl:%1 parameter
• Optionally, repeat for Find in PBL’s App, using the /initpage:find
/pblapp:%1 parameters (this loads the app to the Find page much more
• Optionally, select one for default using Set Default
• Similar steps can be done for PBT files and PBW files, with the /target and
/workspace command line parameters.
• Assuming there’s no existing definition for DBG, press New Type
• Select appropriate descriptions and icons
• Under actions, select New...
• Put Open with current app in Action; put "G:\Program
Files\Techno-kitten\PBL Peeper 9\pblpeeper9.exe" /current
/initpage:trace /dbg:%1 in Application used to perform action (the
path to the PBL Peeper executable is, of course, specific to your
installation); press OK
• Optionally, set this action as the default
Now, when you double click a PBL or DBG, or select the appropriate context menu, you
will automatically launch PBL Peeper. See Command Line Parameters for details on
how these parameters work.
How do I search / review an object and its ancestors?
To most exhaustively search an object and its ancestors, set resolve levels to the highest
levels: scripts and optionally DataWindow tables and controls. Go to either the Browse
page or the Lists / Objects page and print the object contents to a rich text window.
When selecting print parameters, be sure to check: Attribute Ancestors, Script
Ancestors, Script Contents: All and both Show Ghosts. The resultant rich text
window can be used with its Find functionality.
How do I selectively search and replace?
This method is granular only to the object level. Go to the Find page. Enter the search
parameters. Select DataWindow Output. In the output, select the rows (Ctrl-Click and
Shift-Click) for the objects in which you want the target items replaced. Select Edit /
Object Filter / Set Object Filter From Selected. Go to the Process page and your
search and replace will be restricted to the objects specified by the object filter you just
Can I use Script or SQL formatting from the PowerBuilder IDE?
In the PowerBuilder IDE, custom icons can be added to the toolbar to call external
programs. Set up a custom icon to format scripts, provide a command line similar to this:
"D:\PowerBuilder Projects\PBL Export\PB8\pblpeeper8.exe" /win:scriptformatter
/loadclipboard /saveclipboard /autoclose
Then, while developing, Select All and Copy from the script painter, press your custom
icon, and when PBL Peeper disappears, Paste. To create a toolbar icon for SQL
formatting, use SQLFormatter as the window parameter.
How do I create a class hierarchy diagram in Visio?
While PowerDesigner will reverse engineer your PBLs and create a class hierarchy
diagram, you may need to do the same thing with Visio, depending on the available tool
set. To accomplish this (details may vary between Visio versions):
• Load the Lists / Objects page
• Go to the menu and select View / Show... / Ancestor Information
• For each object type of “userobject”, “window” and “menu” (and optionally for
various types of user objects)
• Select View / Filter and set the filter to type = the selected object type
• Select File / Save As... and save the list as Text with Headers
• Inconsistently, Visio requires a line in the text file defining the top
level entity (the object type). To create this, copy one of the lines
of text for an object and replace the object name and ancestor fields
with something appropriate
• In Visio, select File / New / Organization Chart / Organization Chart
• Load the file
• Set the Name field to ObjectName
• Set the Reports To field to Ancestor
• Optionally, add PBLName and Comments to the Displayed
• Specify the option to take control over how much data is displayed
on each page (I prefer putting everything on one Visio page, and
tiling onto multiple sheets of paper at printing.)
How do I compare specific attributes between versions?
Sometimes a full comparison of applications versions produces too much data; sometimes you
need to compare specific sets of data. If you can view a set of attributes in a List, you can
compare them between versions. Loading each version in turn, load the data into a List, then File
/ Save As / SQL to create SQL to load the data into a temporary table for each version.
(Depending on the DBMS you’re using, you may need to tweak the SQL that creates the table.)
Then you can compare attributes using standard SQL.