How to Copy MEMPTR to/from a LONGCHAR variable with out getting error or NULL value?

最后都变了- 提交于 2019-12-12 19:04:23

问题


while copying the value of a MEMPTR to a LONGCHAR variable using GET-STRING, i got an error 9324 . Is there any solution ?

I've tried this:

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.

But got the following errors:

[16/03/17@10:20:58.984-0700] P-009824 T-000001 3 4GL 4GLTRACE Return from ConvertXmlDocToLongString "" [yeai/ye508mu.p] [16/03/17@10:20:58.984-0700] P009824 T-000001 1 4GL -- (Procedure: 'GenerateT5008xmlCusipSummaryRecordyeai/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] P009824 T-000001 3 4GL 4GLTRACE Return from GenerateT5008xmlCusipSummaryRecord "? tmp_cusip_tots yes " [yeai/ye508mu.p]


回答1:


GET-STRING operates on ordinary character strings. Those are limited in size to around 31,000 bytes. Use COPY-LOB to to get MEMPTR data in and out of LONGCHAR.

Something like:

copy-lob from my_memptr to my_longchar.

PUT is also restricted to ordinary CHAR strings. If you want to work with LONGCHAR and MEMPTR you need to use COPY-LOB.



来源:https://stackoverflow.com/questions/36065947/how-to-copy-memptr-to-from-a-longchar-variable-with-out-getting-error-or-null-va

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!