|
Was this program based on the sample program IBM provided to process XML into a file? If so, there are errors in it related to allocating memory that will cause it to crash intermittently. I think the two variables that were never deallocated are DomString@ and strgbuf@. I added DEALLOC's for these variables and it fixed the problem. Of course, the other way to fix this is not to allocate memory for the variables and just declare them in the D specs. Matt -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jaime Lopez Ortega Sent: Friday, July 07, 2006 5:14 AM To: rpg400-l@xxxxxxxxxxxx Subject: MCH3601 with XML and ILE RPG Hi people, I have a ILE RPG Program (B) that is reading XML files and putting the data into Database. This Program (B) is called from another program (A) that controls every 10 seconds a folder and if founds XML files, calls the program (B) with the file name as a parameter. The program (A) is running in a JOB under a SBS and just stops by IPL (the rest of the time is running). I use a couple of procedures to value of the tags from the XML. Would be something like this: C EVAL %str(p_XmlFile:90) = %TRIMR(strFileIn) * Initialize XML environement, provide pointer to DOM exception area C CALLP QxmlInit(p_DomExcDta) * Create a Parser object, set validation options and parse C EVAL p_DomParse = QxmlDOMParser_new(p_PrsDta) C CALLP QxmlDOMParser_setDoValidation(p_DomParse:0) C CALLP QxmlDOMParser_parse_SystemId(p_DomParse: C p_XmlFile:Qxml_CCSID37:0) * Create a Document from the Parse C EVAL p_DomDoc = QxmlDOMParser_getDocument C (p_DomParse) * Get MsgTyp C eval strMsgTyp = C %TRIM(SeNoVa('MsgTyp')) Where SeNoVa is a procedure that search the value of the TAG that you are passing as parameter and give it back. ************************************************************************** * * PROCEDURE: SeNoVa * FUNTION : Will search the value of a node, giving it back 999A * PARAMETERS: strNode String with the XML tag * ************************************************************************** P SeNoVa... P B EXPORT D SeNoVa... D PI 999A D strNode 90A VALUE * D strval s 999A INZ('') * D p_GetTagOpt S * D p_DomNodeList S * D p_NodeLst S * D p_Node S * D p_DomStr S * D lngElemCount S 10I 0 INZ(0) D intCount S 5u 0 inz(0) * C ALLOC 256 p_GetTagOpt C eval intCount = 1 C C if %len(%trim(strNode)) > 0 C C EVAL %str(p_GetTagOpt:256)=strNode C eval intCount = 2 C EVAL p_DomNodeList = C QxmlDOM_Document_getElementsByTagName C (p_DomDoc:p_GetTagOpt: C Qxml_CHARSTR:%len(%trim(strNode))) C eval intCount = 3 C EVAL lngElemCount = QxmlDOM_NodeList_getLength C (p_DomNodeList) C eval intCount = 4 c IF lngElemCount > 0 c eval intCount = 5 C EVAL p_NodeLst = QxmlDOM_NodeList_item C (p_DomNodeList:0) C eval intCount = 6 C if QxmlDOM_Node_hasChildNodes(p_NodeLst) = 1 C eval intCount = 7 C EVAL p_Node = QxmlDOM_Node_getFirstChild C (p_NodeLst) C eval intCount = 8 C EVAL p_DomStr = QxmlDOM_Node_getNodeValue C (p_Node) C eval intCount = 9 C EVAL strVal = %str( C QxmlDOMString_transcode(p_DomStr)) C else C eval intCount = 10 C eval strVal = cNot_Found C endif C else C eval intCount = 11 C eval strVal = cNot_Found C endif C C eval intCount = 12 C CALLP QxmlDOMString_delete(p_DomStr) C eval intCount = 13 C CALLP QxmlDOM_Node_delete(p_Node) C eval intCount = 14 C CALLP QxmlDOM_NodeList_delete(p_NodeLst) C eval intCount = 15 C CALLP QxmlDOM_NodeList_delete(p_DomNodeList) C eval intCount = 16 C C endif C C DEALLOC p_GetTagOpt C return strVal P SeNoVa... P E
From time to time (really unfrequent, like once every 2 or 3 month or something like this), I get in the above program point (trying to get the MsgTyp Tag) an error MCH3601. I did a Formatted dump and observed that the error comes from:
C EVAL p_DomNodeList = C QxmlDOM_Document_getElementsByTagName C (p_DomDoc:p_GetTagOpt: C Qxml_CHARSTR:%len(%trim(strNode))) But I have checked all parameters that I am passing to QxmlDom_Document_getElementsByTagName and are all set P_DOMDOC POINTER SPP:E7A4C2C2F20154A0 P_GETTAGOPT POINTER SPP:E7A4C2C2F202A5A0 INTCOUNT UNS(5) 2 '0002'X This last variable I have created so I know exactly where the program is having error. This would be the first place where I am trying to get some Tag´s value. But, the thing is that when I cancell the job where the program A is running and starting again this job with program A, the error does not come with everything the same (the same XML file) Any help or ideas are really apreciated. Jaime.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.