Q

How can I display a variable?

I'm using an interactive debugger (STRISDB) and wanted to display the variable, i.e. X (Y Z). However, I received a message that this variable requires a basing pointer. I tried using the command, "Watch X (1 2)" but there is still an error in the command. How can I display the variable?
A Basing Pointer is a variable defined in your program that sets the address of the variable you are trying to watch. Look at the source code and see what the name of the variable is in the BASED D-spec keyword that will be associated with the field definition. That name is the name of the basing pointer.

If the pointer has not yet been set, you will get an error or a wildly inaccurate result.

If the variable or the pointer is defined in a subprocedure, trying to see the value outside of that procedure will give you an inaccurate result.

As for WATCH, try not to use it if you can use another method, since WATCH is system-wide (you can only have 16 Watches at a time in the whole machine!) and it is very hungry for system resources. Instead, look through the source and place breakpoints where the variable you are interested in changes.

Note: I tend to use STRDBG for interactive debugginging of ILE programs, and this behaves correctly with basing pointers. I do not know whether STRISDB behaves in the same way. If you are debugging non-ILE programs, there shouldn't be any pointer data types in them anyway. If you have problems with STRISDB and basing pointers in ILE programs use STRDBG instead.

==================================
MORE INFORMATION ON THIS TOPIC
==================================

The Best Web Links: tips, tutorials and more.

Visit the ITKnowledge Exchange and get answers to your developing questions fast.

Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.

This was first published in April 2005

Dig deeper on iSeries application development tools

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

SearchEnterpriseLinux

SearchDataCenter

Close