while copying the value of a MEMPTR to a LONGCHAR variable using GET-STRING, i got an error 9324 . Is there any solution ?
Use COPY-LOB.
Sorry, I had not realised this is duplicate of community.progress.com/.../23797, which is already answered.
note that a longchar is supposed to contain/characters/.
a blob can contain anything, including nulls.
nulls are not allowed in char or longchar, regardless of the character set, ecept as the very last byte.
thansk guys!
Hi all,
I tried , but in vain .Scenario is as follows ,
function x returns longchar():
DEF VAR i_xml_string AS LONGCHAR NO-UNDO.
DEF VAR i_mem AS MEMPTR NO-UNDO.
p_doc:SAVE("memptr":U, i_mem).
COPY-LOB FROM i_mem TO i_xml_string.
return i_xml_string.
end.
below is the error log,
[16/03/17@10:20:58.984-0700] P-009824 T-000001 3 4GL 4GLTRACE Return from ConvertXmlDocToLongString "<LONGCHAR>" [yeai/ye508mu.p]
[16/03/17@10:20:58.984-0700] P-009824 T-000001 1 4GL -- (Procedure: 'GenerateT5008xmlCusipSummaryRecord yeai/ye508mu.p' Line:2536) Attempt to exceed maximum size of a CHARACTER variable. (9324)
[16/03/17@10:20:58.984-0700] P-009824 T-000001 1 4GL -- (Procedure: 'GenerateT5008xmlCusipSummaryRecord yeai/ye508mu.p' Line:2536) ** Unable to evaluate expression for PUT statement. (564)
[16/03/17@10:20:58.984-0700] P-009824 T-000001 3 4GL 4GLTRACE Return from GenerateT5008xmlCusipSummaryRecord "? tmp_cusip_tots yes " [yeai/ye508mu.p]
i could not achieve the functionality . pl. suggest , thanks i advance .
Regards,
Ravi
If you want to use you xml to save into LONGCHAR then why don't you use
p_doc:SAVE("longchar":U,i_xml_string).
it will give you your xml into longchar after it you can write it into a file (if you want )
copy-lob from i_xml_string to file "test.xml".
Hi,
I also have a problem with the .xml
I created the LongChar with TEMP-TABLE: WRITE-XML (), but now I use hDoc: SAVE ("LongChar": U, longstring).
The xml went well structurated on each line when using the temp-table but now with hDoc: SAVE ("LongChar": U, longstring) it does not come out well organized in the text editor,
How can I solve this ?
Regards,
Liliana
Hi Liliana Santiesteban
Temp-table approach is different. Try with hDoc: SAVE ("file": U, "test.xml").
Hi,
I need to create a LongChar.
How can I give a format before use the sentence hDoc: SAVE ("LongChar": U, longstring)?
The log output does not correspond to the code snippet: you have function x, but the log shows function ConvertXmlDocToLongString. If x is the same function as ConvertXmlDocToLongString, then the COPY-LOB did not fail. What failed was what you did with the returned LONGCHAR in GenerateT5008xmlCusipSummaryRecord.
Hi Liliana,
see example below: a sample xml for your reference
def var lv-refxml as handle no-undo.
def var lv-refroot as handle no-undo.
def var lv-refnode as handle no-undo.
def var lv-hText as handle no-undo.
def var lv-longchar as longchar no-undo.
create x-document lv-refxml.
create x-noderef lv-refroot.
create x-noderef lv-refnode.
lv-refxml:CREATE-NODE(lv-refroot,"root","ELEMENT").
lv-refxml:APPEND-CHILD(lv-refroot).
lv-refxml:CREATE-NODE(lv-refnode,"child1","ELEMENT").
lv-refroot:APPEND-CHILD(lv-refnode).
create x-noderef lv-hText.
lv-refxml:create-node(lv-hText, "", "TEXT").
lv-refnode:append-child (lv-hText).
lv-hText:node-value = "Child-1".
delete object lv-hText.
lv-refxml:CREATE-NODE(lv-refnode,"child2","ELEMENT").
lv-refroot:APPEND-CHILD(lv-refnode).
lv-refnode:set-attribute("value","Child-2").
lv-refxml:SAVE("longchar",lv-longchar).
copy-lob from lv-longchar to file "example.xml".
------------------------------
/* OUTPUT */
------------------------------
<?xml version="1.0" ?>
<root>
<child1>Child-1</child1>
<child2 value="Child-2"/>
</root>
-
Thanks,
Ankit
Thanks Ankit!