[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Example16 Error



Sender: "Steven Molinaro" <smolinaro@xxxxxxxxxxxxx>


Thanks Scott .. My confusion was that if it were a C routine bombing out,
I'm not sure if it would actually stop at the line in the C source or if it
would return to the RPG and just say there was an error in LoadAddress. 

Thanks for your help .. 

-----Original Message-----
From: Scott Klement [mailto:sk@xxxxxxxxxxxxxxxx] 
Sent: Friday, March 03, 2006 4:24 PM
To: Steven Molinaro
Cc: ftpapi@xxxxxxxxxxxxx
Subject: RE: Example16 Error

Hi Steven,

I'm moving this back to the mailing list.  Sorry, I didn't notice that it 
got off-list somehow.

Here's how you find which statement the program crashes at:

a) Type STRDBG
b) The system will display the source for the program.  Press F12.
c) Type CALL EXAMPLE16 PARM('my tracking number here')

d) The system will run the program, and pop up the source code at the 
exact spot where it's crashing.

When I run it using your tracking number, here's the screen I get:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

                              Display Module Source

  Program:   EXAMPLE16      Library:   LIBHTTP        Module:   EXAMPLE16
    1806       1805
    1807       1806   when  path = '/TrackResponse/Shipment/Package/Activit
    1808       1807                '/ActivityLocation/Address';
    1809       1808
*** the following line is in high-intensity ****
    1810       1809       LoadAddress(name: value: r.package(pc).activity(a
    1811       1810
    1812       1811   when  path = '/TrackResponse/Shipment/Package/Activit
    1813       1812                '/Status/StatusType';
    1814       1813
    1815       1814       select;
    1816       1815       when name = 'Code';
    1817       1816          r.package(pc).activity(ac).statuscode = value;
    1818       1817       when name = 'Description';
    1819       1818          r.package(pc).activity(ac).status = value;
    1820       1819       endsl;
                                                                         Mo
  Debug . . .

  F3=End program   F6=Add/Clear breakpoint   F10=Step   F11=Display variabl
  F12=Resume       F17=Watch variable   F18=Work with watch   F24=More keys
  Range of subscript value or character string error.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

So, it's crashing with an array index error on the "LoadAddress" line 
(statement 1810/1809 above.) Since that line uses two arrays, I display 
what the indexes the arrays are.

e) I type the following in the debugger:

      eval pc

It prints "1", so that's not it.

f) I type the following next:

      eval ac

It prints "6".

g) I look at the source code to see how big these arrays are.  The 
"package" array is 10 elements, but pc was 1.  not a problem.  The 
"activity" array was 5 elements, and ac was 6.  Hmmm... that could be a 
problem.

h) I hit F3 to exit the debugger.

i) I change the size of the "activity" array to be 10 elements.

j) I recompile EXAMPLE16 and run it again without errors.


Using that method, it's actually pretty easy to narrow down where the 
error is, so I figured it might be more valuable for me to explain the 
method than it would be to simply tell you what I found.



On Fri, 3 Mar 2006, Steven Molinaro wrote:
>
> Hi .. I am having a hell of a time trying to actually pinpoint where 
> exactly it is bombing out. I imagine it's because of all the C functions 
> that are being called. If it's any help to you, I am calling the 
> example16 pgm with a parm of '1Zxxxxxxxxxxxxxxxx' .. If you do the same, 
> you'll see it happen and maybe it will be clearer to you.
>


-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubsribe from the list send mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr
-----------------------------------------------------------------------