Adding STX ETX to XML in 9.1D

greeshma

Member
Code:
def  VAR hDoc  as handle  no-undo.  /* hDoc contains XML */


DEF  VAR v-result   AS LONGCHAR NO-UNDO.


DEF VAR  mPointer  AS MEMPTR  NO-UNDO.






ll = hDoc:SAVE("LONGCHAR",v-result).


v-result = CHR(02) + v-result + CHR(03) .


COPY-LOB FROM  v-result TO mPointer NO-CONVERT .

The current version is 9.1D and I cant use this code there. 9.1D is not supporting longchar .

XML is very small so that I can use character instead of Long char. Can anyone please suggest how I can read data into character. How I can achieve the same logic for character datatype ?
 

RealHeavyDude

Well-Known Member
Why don't you save the XML document directly to the memory pointer? As far as I know that works in V9.

Code:
hDoc:SAVE("memptr", mPointer).
Heavy Regards, RealHeavyDude.
 

RealHeavyDude

Well-Known Member
Do I understand you correct that you want to prefix the XML with chr(2) and suffix it with chr(3)?

You could do something like this:
Code:
hDoc:SAVE("memptr", mPointer).
v-result  = trim ( get-string ( mPointer, 1 ) ).
v-result = chr(2) + v-result + chr(3).
set-size ( mPointer ) = 0. /* De-allocate the memory */

Or you could write the XML to a file ...

Heavy Regards, RealHeavyDude.
 

greeshma

Member
Do I understand you correct that you want to prefix the XML with chr(2) and suffix it with chr(3)?

You could do something like this:
Code:
hDoc:SAVE("memptr", mPointer).
v-result  = trim ( get-string ( mPointer, 1 ) ).
v-result = chr(2) + v-result + chr(3).
set-size ( mPointer ) = 0. /* De-allocate the memory */

Or you could write the XML to a file ...

Heavy Regards, RealHeavyDude.
Code:
<?xml version="1.0" encoding="utf-16" ?><IccTransactionRequest xmlns="http://servebase.com/2009/06/pedframework" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><PedEndpointAddress><EndpointAddressType>Tcp</EndpointAddressType><TcpEndpointAddress><HostName>192.168.160.43</HostName></TcpEndpointAddress></PedEndpointAddress><TransactionConfig><Site>site</Site><Culture>culture</Culture><CustomerCode>customer</CustomerCode><Workstation>workstation</Workstation><MerchantId>merchant id</MerchantId><Username>username</Username><Password>password</Password><IpAddress>192.1.1.0</IpAddress></TransactionConfig><AuthorizationConnectionType>OnlineAuthorization</AuthorizationConnectionType><TransactionAmount currency="GBP">100</TransactionAmount><TransactionReference>ICC-PreAuthorization-100-UKL-s0000701</TransactionReference><TransactionDateTime>2015-01-05T15:16:17.329+05:30</TransactionDateTime><TransactionType>PreAuthorization</TransactionType></IccTransactionRequest>

This is the content of memptr mPointer, But when I do get-string(mPointer,1) it returns "ÿþ<"
 

RealHeavyDude

Well-Known Member
Works without a fuzz for me. But then again I am on OpenEdge 11.3 and I have no access to any V9 to see whether it is working or not in V9.

How did you prove what the content of the memory pointer is - are you sure it is what you think it is?

Heavy Regards, RealHeavyDude.
 
Top