MIDRANGE dot COM Mailing List Archive



Home » MIDRANGE-L » August 2014

Re: Debugging SQL - question re character variables



fixed

On 29-Aug-2014 12:23 -0500, Gary Thompson wrote:
On 29-Aug-2014 11:38 -0500, Gary Thompson wrote:
First time creating SQL Stored Procedure and using the Debugger as
described in Kent Milligan's pdf.
Thank you Kent!

First part of mysql definition is:

CREATE PROCEDURE test/mysql
( IN out_loc CHARACTER (4)
, IN cto_num DECIMAL(13,0)
, IN bat_dat DECIMAL(7,0)
)

I called mysql from Run Sql Scripts with:

call testlib/mysql('82 ',8268773,1140627)

My question: why does the character variable show on the Console
tab like:
MYSQL.OUT_LOC = SPP:0000800000000270

Decimal variables show like:
MYSQL.CTO_NUM = 0000008268773.
MYSQL.BAT_DAT = 1140627.

Hmm, reading further in Kent's pdf:

DECLARE z CHAR(5)
"the following EVAL command can be used to display . . . contents":
"EVAL *SP.z :S 5"
Must be a "C thing" ?


In the debugger command-line, type HELP and press Enter. Click on _EVAL_ then navigate to the _Expression_ help wherein can be found some help entitled _C/C++ language examples_ that should be helpful in that regard; given the SET OPTION DBGVIEW=*LIST produces a C program listing, that form of the EVAL is indeed a "C thing" that must be dealt with. The asterisk asks to /de-reference/ [I think that is the correct terminology] the variable which is a pointer to the storage that addresses the first character of a null-terminated string.

Apparently there have been some improvements to SQL routine debug capabilities that should enable avoiding that somewhat frustrating experience for someone unfamiliar with the language trying to debug C [strings; and C-code generally]. I seem to recall the enhancements that allow debugging the SQL routine [as SQL code], had appeared in a "what's new" document somewhere.






Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2014 by MIDRANGE dot 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 here. If you have questions about this, please contact