character to memptr

Posted by ankitshukla on 01-Jun-2015 06:39

How to convert the character variable to memptr variable?If possible quote an simple example please. 

All Replies

Posted by Brian K. Maher on 01-Jun-2015 06:45
 
define variable someString as character no-undo.
define variable somePointer as memptr no-undo.
define variable someLongChar as longchar no-undo.
 
someString = "blah blah blah".
 
set-size(somePointer) = length(someString) + 1.  /* +1 to include the null at the end of the string */
 
put-string(somePointer,1) = someString.
 
If your character data is in a longchar variable it is easier...
 
someLongChar = someString.
 
copy-lob from someLongChar to somePointer.
 
Posted by ankitshukla on 01-Jun-2015 07:23

Thanks Brian,

character to longchar and then to memptr through copy-lob is giving me error (9082) i.e. X-NODEREF or X-DOCUMENT <method-name> got an error: <xml-exception>. (9082) in xml parsing.

Posted by Brian K. Maher on 01-Jun-2015 07:33
That makes no sense as copy-lob does not do anything with XML.
 
Perhaps you need to debug your code and determine what line of code is returning that error.
 
 
[collapse]
From: ankitshukla [mailto:bounce-ankitshukla@community.progress.com]
Sent: Monday, June 01, 2015 8:24 AM
To: TU.OE.Development@community.progress.com
Subject: RE: [Technical Users - OE Development] character to memptr
 
Reply by ankitshukla

Thanks Brian,

character to longchar and then to memptr through copy-lob is giving me error (9082) i.e. X-NODEREF or X-DOCUMENT <method-name> got an error: <xml-exception>. (9082) in xml parsing.

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]
Posted by James Palmer on 01-Jun-2015 07:40

It would also help to know what version of Progress.

Posted by ankitshukla on 01-Jun-2015 07:49

it is OpenEdge 11.4. While hdoc:load("memptr",<memptrvariable>,FALSE) is giving the error 9082. Definitely something problem with memptr variable. 

hDoc is a X-DOCUMENT handle. i.e create X-DOCUMNET hDoc.

Posted by Brian K. Maher on 01-Jun-2015 08:01
I seriously doubt it.  More likely something wrong with the data itself or perhaps a conversion issue since putting data into a longchar by default converts it to UTF-8.
 
Please provide the code and the exact error text or put the data into a disk file and try opening it in IE or Chrome to see if they can properly format it.
 
 
 
[collapse]
From: ankitshukla [mailto:bounce-ankitshukla@community.progress.com]
Sent: Monday, June 01, 2015 8:50 AM
To: TU.OE.Development@community.progress.com
Subject: RE: [Technical Users - OE Development] character to memptr
 
Reply by ankitshukla

it is OpenEdge 11.4. While hdoc:load("memptr",<memptrvariable>,FALSE) is giving the error 9082. Definitely something problem with memptr variable.

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]
Posted by Simon L. Prinsloo on 01-Jun-2015 09:34

Why go such a long route? You can read the LONGCHAR directly.

hDoc:LOAD("LONGCHAR",longcharvar,FALSE).

But 9082 indicates that there is something wrong with the XML. You can write the lonchar variable to a text file and inspect it with a text editor and see if you can find the reason.

COPY-LOB loncharvar TO FILE "filename.xml".

Posted by ankitshukla on 01-Jun-2015 11:15

Thanks Guys,

There was an extra space included in the starting of the XML that is why it is creating the problem.

Now it is working fine.

This thread is closed