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

RE: Pointer not set to location referenced problem in HTTPAPI



Thanks Scott, it worked.

Vikas Mishra

-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Scott Klement
Sent: Tuesday, September 02, 2008 3:18 PM
To: HTTPAPI and FTPAPI Projects
Subject: Re: Pointer not set to location referenced problem in HTTPAPI


Vikas M wrote:
> I am stuck up at this problem. Can somebody help?
> 
> I am Running this API. In debug log the data looks fine till it aborts
> and control comes to "Incoming routine".
> 
> It aborts saying "Pointer not set to location referenced" after it has
> received the data.

HTTPAPI is going to pass your 'ResponseCd' variable by REFERENCE to your 
subprocedure. The HTTPAPI spec *only* allows this parameter to be passed 
by reference.

Change your procedure to look like this:

    D Incoming        PI
    D   ResponseCd                  10I 0
    D   depth                       10I 0 value
    D   name                      1024A   varying const
    D   path                     24576A   varying const
    D   value                    65535A   varying const
    D   attrs                         *   dim(32767)
    D                                     const options(*varsize)

(See?  I removed the word 'value' from your ResponseCd parameter.)

Since HTTPAPI was passing by reference (which, under the covers means 
it's passed by pointer) but your routine was receiving the variable by 
value, the pointer was being corrupted and causing the error you describe.

Note that even if HTTPAPI somehow understood that it needed to pass by 
VALUE, using VALUE would never work anyway.  VALUE is input-only to the 
procedure (it means that a copy of the data is made).   So you can't 
ever use the 'value' keyword on something you expect to be returned back 
to the caller.

Hope that made sense.
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------