Read F95630 Blob

josigolive

Member
Hi!

First of all, thanks in advance to JDEList for providing all of us with this forum. I hope you can help me with this problem:

According to metalink´s document E1: UBE: Understanding UBE Execution Process [ID 1502974.1]: where they say “If the UBE version is running in association a Report Definition, upon conclusion, a record is inserted to system table F95630, containing Report Definition Source (the XML output) of the report.” I´m trying to read from F95630 the BLOB field ‘xdrpdubblb’ in order to extract the XML; but I´m afraid it´s not in plain text. I´ve tried to extract it through PL/SQL and Java, but seems it´s compressed or codified because I can only read binary data.

I have found a document that says that it could be compressed (but it doesn’t mention how
laugh.gif
) so I also tried to uncompress with standard compressors like zip or tar unsuccessfully.

Does anyone know how it´s compressed or how I can read it?

Regards.
 
Hi, the JDE 'C' API

<font class="small">Code:</font><hr /><pre>
EXTERNC XMLPCRTN(int) JDEWINAPI xmlpUncompress (BYTE** pDestination, ulong* uncompLength,
const BYTE* pSource, ulong sourceLength);
</pre><hr />

does exactly what you're asking.
 
Just to follow-up on Craig's response. Note that API allocates the memory for the returned uncompressed data (pDestination) so it is up to you to free that memory when you're done using that parameter. You can just use jdeFree.
 
Hi Craig, JRM

Thanks a lot for your comments but I need to go further….

I have an external application made in Java and only have connection to JDE Database so at first I couldn´t call to do that.

I searched information about xmlpuncompress function but I found nothing at metalink. It would be great if I knew how that function is implemented or had access to the source code in order to replicate it on my external application ( also searched into ‘E900/PD900’ folder but without success again
frown.gif
)

Thanks in advance!
 
Hi Sviardot,

Yes you are right, it could be done calling from Java, I had that option as a possible solution; or even better I thought it could be encapsulated into a stored procedure with the plain xml as an output parameter (I think C code can also be executed from PL/SQL) so no need to install in each machine.

But my main goal here is not to depend on a JDE C library; reading blobs from database is as easy as reading another database types so it bothers me a bit to call a C function only for getting a blob. If I knew how it´s compressed the XML I could figure out how to uncompress it.
smile.gif


Thanks!
 
After several tests I got it!

Using InflaterInputStream java class I can read plain XML.

Thank you all!
 
Hi Craig,

Happened to find your post in this thread about accessing the f95630.rpdubblb. Your remark that API xmlpUncompress would do exactly what is asked for completely fits my needs. However, I am lost about implementing this API in a C business function. Do you happen to have any samples or references?

Thanks a lot.
 
I have got xmlpUncompress working, but was curious if you know what the return codes are (defined as int) so I can test if it was successful.
 
Hi josigolive!

Can you remember details how you used the inflater class? I'm always getting an unknown compression format exception!
 
Hi Craig,

I have a similar request to josigolive and I am failing using the xmlpUncompress API.
I don't know how to intiialize the different variables nor to convert the F95630 blob to BYTE*.

Do you have some examples I could follow ?

Regards

Nicolas
 
Warning ... this API (xmlpUncompress) seems to be removed in 9.2 TR

Craig
 
Warning ... this API (xmlpUncompress) seems to be removed in 9.2 TR

Craig

Hmmmm. That's unfortunate. Is there a replacement? I am developing a solution right now that uses xmlpUncompress to retrieve both the UBE XML output and the BIP output from the tables.
 
There is a set of flate APIs that seem to work with the blob in f95630. I just tested jdeBufferUncompress on the F95630 xdrpdubblb.lpValue. It returned the uncompressed XML. So looks like we are in business and to use generic uncompress utilities rather than feature/solution specific. Nice.

Craig
 
Great!!! I assume it would also work with F95631. Thanks for figuring that out. One less thing to worry about if we upgrade.
 
Hi Craig,

I have a similar request to josigolive and I am failing using the xmlpUncompress API.
I don't know how to intiialize the different variables nor to convert the F95630 blob to BYTE*.

Do you have some examples I could follow ?

Regards

Nicolas


Oh, and to Nicolas. Example code below. Note that if you plan to use with the Xerces parser you will need to transcode to a null terminated unicode string.

Code:
	struct
	{
		BLOBVALUE		xml;
	} recXml = {0};

...

	jdeStrncpy(keyXml.xdrpduogud, pJobStatus->szRPDFUBEOutputGUID, DIM(keyXml.xdrpduogud)-1);

	if(JDB_OpenTable(	hUser, NID_F95630, (ID)0,
							colXml, (ushort)DIM(colXml),
							(JCHAR *)NULL, &hReqXml) != JDEDB_PASSED
		
		|| JDB_FetchKeyed(hReqXml, (ID)0, &keyXml, (short)1, &recXml, 0) != JDEDB_PASSED)
	{
		if(hReqXml)
		{
			JDB_CloseTable(hReqXml);
			return acmeErrorSetTableFetch(lpBhvrCom, lpVoid, (ID)0, NID_F95630);
		}

		return acmeErrorSetTableOpen(lpBhvrCom, lpVoid, (ID)0, NID_F95630);
	}
	JDB_CloseTable(hReqXml);


	/* get the report data which s/b an xml document.
		transcode to unicode and null terminate so it can be used as a JCHAR string in XRCES parser
		*/
	if(recXml.xml.lpValue && recXml.xml.lSize > 0)
	{
		ZCHAR		*pXmlData = (ZCHAR *)NULL;
		ulong		nXmlSize = 0;

		//jdeBufferUncompress  9.2 uses this api - see https://www.jdelist.com/vb4/showthread.php/46382-Read-F95630-Blob?p=189540#post189540
		xmlpUncompress((BYTE **)&pXmlData,
							&nXmlSize,
							(const BYTE *)recXml.xml.lpValue,
							recXml.xml.lSize);

		if(pXmlData)
		{
			ulong i;

			pJppInfo->pRepDefOutput->nRptDatSize = (nXmlSize + 1) * sizeof(JCHAR);
			pJppInfo->pRepDefOutput->pRptData = jdeAlloc(COMMON_POOL, pJppInfo->pRepDefOutput->nRptDatSize, MEM_ZEROINIT);

			if(!pJppInfo->pRepDefOutput->pRptData)
				return acmeErrorSetMalloc(lpBhvrCom, lpVoid, (ID)0);
			
			/* manually transcode to unicode intead of using jdeapi jdeToUnicode
				If we use jdeToUnicode we would need to realloc pXmlData to be null terminated.
				This s/b faster, work the exact same and doesn't require a memory realloc
			*/
			for(i = 0; i < nXmlSize; i++)
			{
				pJppInfo->pRepDefOutput->pRptData[i] = (JCHAR)pXmlData[i];
			}

			jdeFree(pXmlData);
		}
	}
 
Last edited:
Just confirming ... yes, the Uncompress works on the F95631 output table.

Craig
 
Working on an upgrade and after the upgrade we are wanting to pull directly out of F95631 from another application instead of using the archiving option in BI Pub. Am I correct in assuming that the blob field is the same as the archive option after being uncompressed? (pdf,xls,rtf etc)

Thanks
 
Back
Top