× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I don't know if this is what you are after, but from debug if you press
F15 you can select the SQL Output View and get the SQL calls. From there
you can check the variables on the parameters before the call.

That's really the only way I know of. Maybe there is something better with
some of graphical debuggers in WDSc, but I have never used them.

James R. Perkins




Pete Helgren <Pete@xxxxxxxxxx>
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
06.09.2007 07:21
Please respond to
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>


To
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
cc

Subject
Re: Viewing the resultant SQL in an RPG program







The thing I am after is a resulting SQL statement that I can read and,
if necessary, submit interactively to check on my logic.

If I had an RPG program with variables and an SQL statement like so:

if employeeid <> 0;
ssn1 = %char(employeeid);
ssn2 = %char(employeeid);
else;
ssn1 = *LOVAL;
ssn2 = *HIVAL;
endif;
if userid <> *blanks;
usr1 = q + userid + q;
usr2 = q + userid + q;
else;
usr1 = *LOVAL;
usr2 = *HIVAL;
endif

select * from myfile where
myssn between :ssn1 and :ssn2 and
myuser between :usr1 and :usr2

Following Joe's (and others) approach, I am OK with the numeric
values. *LOVAL and *HIVAL use -999999 and 999999 respectively in this
case. But what about the character values? What do I use in that
case? For example if I decide to submit the SQL with a 0 employeeid
value and 'PETE' for the userid then I can assume that the resulting SQL
would be something like:

select * from myfile where
myssn between -999999 and 999999 and
myuser between 'PETE' and 'PETE'

But if I submit the SQL with a value of 466 for the employeeid and
*BLANK for the userid then the resulting SQL would be:

select * from myfile where
myssn between 466 and 466 and
myuser between ????????? and ????????? <---what values
would be substituted here for *LOVAL and *HIVAL?

Or if I submitted the SQL with no values then the SQL would be something
like:

select * from myfile where
myssn between -999999 and 999999 and
myuser between ???????? and ??????? <---what values would
be substituted here for *LOVAL and *HIVAL?

I need to see what that would look like so I can submit the SQL
interactively if possible and figure out what I am doing wrong.

That is what I am after. Thanks for the :X suffix trick though, I can
see the hex, I just don't know what to do with it.

Pete


Douglas Handy wrote:
Pete,

When I view the *LOVAL and *HIVAL variables for the character fields in

debug I just see a highlighted empty block which I assume are special
characters.



Add the :X suffix in debug to see the fields in hex format, such as

eval usr1:x

The *Loval contents should be hex 00 and the *hival should be xFF.

Doug


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.