MIDRANGE dot COM Mailing List Archive



Home » MIDRANGE-L » March 2013

Re: Help with debugging external UDF



fixed

Thomas -

Try debugging it in an interactive session:

(1) Start a green-screen session (from where you will be calling the program later...)

(2) Start a *second* green-screen session,
and in it use STRSRVJOB to start a service on the green-screen session started in (1),
then start debug on the service program and set a breakpoint.

(3) go back to the first green-screen session and call the program, then

(4) Go back to the second session and see if it stopped at the breakpoint.

I have written a number of UDF's which I use interactively from within the STRSQL interface, and this is the way that I always debug them...

-sjl




"Thomas Garvey" wrote in message news:mailman.17822.1362695972.10847.midrange-l@xxxxxxxxxxxx...

Yes.
Specifically, I start the debug (STRDBG) using the program name running in
the submitted job, then I add the service program as a called module inside
the debug session (using F14 to display module list, then option 1 to add
the service program). I then set the breakpoints in the module of the
service program. I set the break at the first executable line (there is no
initialization subroutine).


-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Peter Connell
Sent: Thursday, March 07, 2013 4:13 PM
To: Midrange Systems Technical Discussion
Subject: RE: Help with debugging external UDF

Thomas,
Just to be certain.
You are submitting a job which at some point runs the UDF.
You are running STRSRVJOB from a command line that specifies the submitted
job as the targeted job.
You are running the STRDBG SRVPGM(DT2ISOSRV) from the command line to debug
the *SRVPGM program containing the UDF (note the use of the SRVPGM keyword
instead of the PGM keyword on STRDBG)

Peter

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Thomas Garvey
Sent: Friday, 8 March 2013 11:03 a.m.
To: 'Midrange Systems Technical Discussion'
Subject: RE: Help with debugging external UDF

Finally got back to this after a few days...

I executed a DROP function command and then a CREATE FUNCTION, verified the
function is defined in my library (using Navigator).

Here's the CREATE...

CREATE FUNCTION GARVEY/DT2ISOSRV (
TESTVALUE VARCHAR(50) ,
DATEFMT VARCHAR(4) )
RETURNS DATE
LANGUAGE RPGLE
SPECIFIC GARVEY/DT2ISOSRV
NOT DETERMINISTIC
NO SQL
CALLED ON NULL INPUT
NO EXTERNAL ACTION
NOT FENCED
EXTERNAL NAME 'GARVEY/DATE2ISO(DATE2ISO)'
PARAMETER STYLE GENERAL ;

I am trying to debug the function when it gets called by SQL, so I am adding
the Service Program (DT2ISOSRV) to my program list and setting a break point
(in DATE2ISO module). I know the function is getting called because my job
log is filled up with messages that the calls to CEEDATE (which is called
from within the function) are failing...

For example...
Timestamp picture mismatch.
The value for month is not valid.

The problem is that I can't get it to stop at my breakpoints. I suppose
that I am probably setting breaks in something OTHER than what is actually
being called, but I thought I dealt with that by dropping the function and
then CREATEing it again.

I did look at the SYSFUNCS and SYSROUTINES files and everything looks
correct.

Any thoughts?



-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of CRPence
Sent: Monday, March 04, 2013 5:38 PM
To: midrange-l@xxxxxxxxxxxx
Subject: Re: Help with debugging external UDF

On 04 Mar 2013 14:37, Thomas Garvey wrote:
<<SNIP>>
The system does call something because each step of the original
program returns a zero in SQLCOD, AND it returns a value from the UDF.
The problem is the value is wrong and I can't get to debug the service
program to find what is going wrong.

I am not sure I understood what was being done to effect debugging, but
it seems what is described for the batch job attempts to suggest that the
UDF code being run in the batch job, is not the code being debugged; i.e.
the breakpoint in the code chosen to debug was never hit.
For that... The output from a TRCJOB would show what specific code was
being run; and presumably would be again on the next run.

Consider that the library list is less relevant if the SQL PATH is not
*LIBL, and furthermore if the EXTERNAL NAME for the routine directs to a
specific [a qualified] service program name [which could be outside of the
library list]. What specific version of the function being invoked is the
first thing to determine, then what that function defines to be invoked.
Library qualifying the function is best to ensure the former, and that also
makes finding-out the latter easier, by a very specific query of the
catalogs.

The CREATE FUNCTION was not offered nor any variants either for SPECIFIC
name or SOURCED; i.e. there might be overloaded or effective duplicates
defined. Verify the routine definition(s) in SYSFUNCS or SYSROUTINES.

--
Regards, Chuck
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/midrange-l.



--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/midrange-l.

############################################################################
#########

This correspondence is for the named person's use only. It may contain
confidential or legally privileged information, or both. No confidentiality
or privilege is waived or lost by any mistransmission. If you receive this
correspondence in error, please immediately delete it from your system and
notify the sender. You must not disclose, copy or rely on any part of this
correspondence if you are not the intended recipient.
Any views expressed in this message are those of the individual sender,
except where the sender expressly, and with authority, states them to be the
views of Veda.
If you need assistance, please contact Veda on either :- Australia
1300-762-207 or New Zealand +64 9 367 6200
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/midrange-l.







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