Page 1 of 2
XML-INTO XML parser detected error code 2.
Posted: Thu Dec 01, 2022 3:43 pm
by onie
The <limits> tag can have 0 to many entries. I set up an array data structure with 10 elements.
Code: Select all
Dcl-ds limits Dim(10) qualified;
hours char(3);
limit char(4);
limitid char(5);
minHours char(3);
End-Ds;
XML-INTO limits %XML(xmlData : 'doc=string case=any +
allowmissing=yes allowextra=yes trim=all +
path=result//limits');
I have tried trim=none, trim=all and also excluded trim completely from the xml-into. I have used varchar and char for the data structure fields. These made no change to the error I get on this line of code. The 2 elements load to the array just fine, but then I get this error:
Code: Select all
Message Type . . . . . . . . . . . . . : RNX
Additional Message Info . . . . . . . : 0351
Message Data . . . . . . . . . . . . . :
The XML parser detected error code 2.
XML limits data:
Code: Select all
<limits>
<hours>0</hours>
<limit>250</limit>
<limitId>DSL</limitId>
<minHours>0</minHours>
</limits>
<limits>
<hours>0</hours>
<limit>250</limit>
<limitId>USLD</limitId>
<minHours>99</minHours>
</limits>
Or the complete XML data:
Code: Select all
<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns5
:getCardResponse xmlns:ns5="http://xxxxxxxxxxxxxxx"><result><cardNumber>7083052034842200011</cardNumber><header><companyXRef><
/companyXRef><handEnter>POLICY</handEnter><infoSource>BOTH</infoSource><limitSource>POLICY</limitSource><locationOverride>0</locatio
nOverride><locationSource>POLICY</locationSource><overrideAllLocations>false</overrideAllLocations><originalStatus xmlns:xsi="http:/
/www.w3.org/2001/XMLSchema-instance" xsi:nil="1" /><payrollStatus>FOLLOWS</payrollStatus><override>0</override><policyNumber>1</poli
cyNumber><status>ACTIVE</status><timeSource>BOTH</timeSource><lastUsedDate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi
:nil="1" /><lastTransaction>0</lastTransaction><payrollUse>N</payrollUse><payrollAtm>DISALLOW</payrollAtm><payrollChk>DISALLOW</payr
ollChk><payrollAch>DISALLOW</payrollAch><payrollWire>DISALLOW</payrollWire><payrollDebit>DISALLOW</payrollDebit></header><infos><inf
oId>DRID</infoId><lengthCheck>false</lengthCheck><matchValue>999999</matchValue><maximum>0</maximum><minimum>0</minimum><reportValue
></reportValue><validationType>EXACT_MATCH</validationType><value>0</value></infos><limits><hours>0</hours><limit>250</limit><limitI
d>DSL</limitId><minHours>0</minHours></limits><limits><hours>0</hours><limit>250</limit><limitId>USLD</limitId><minHours>99</minHour
s></limits><locationGroups>1</locationGroups></result></ns5:getCardResponse></soapenv:Body></soapenv:Envelope>
Just the limits:
Code: Select all
<limits><hours>0</hours><limit>250</limit><limitI
d>DSL</limitId><minHours>0</minHours></limits><limits><hours>0</hours><limit>250</limit><limitId>USLD</limitId><minHours>99</minHour
s></limits>
Re: XML-INTO XML parser detected error code 2.
Posted: Thu Dec 01, 2022 5:50 pm
by jonboy49
Well there are errors in the XML you posted so it is difficult to tell where the problem may lie.
Are you sure anything gets loaded - with the path you show I wouldn't expect it to find anything, The error message you received also included information on where the error was detected. You haven't shown us that.
Things like trim and changes in the data type will have zero impact on this kind of error. I suspect the path is the real problem.
Re: XML-INTO XML parser detected error code 2.
Posted: Thu Dec 01, 2022 6:41 pm
by Scott Klement
The XML looks okay to me, aside from some extra linefeeds (that were probably an artifact of the way it was copy/pasted)
Here it is reformatted:
Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns5:getCardResponse
xmlns:ns5="http://xxxxxxxxxxxxxxx">
<result>
<cardNumber>7083052034842200011</cardNumber>
<header>
<companyXRef></companyXRef>
<handEnter>POLICY</handEnter>
<infoSource>BOTH</infoSource>
<limitSource>POLICY</limitSource>
<locationOverride>0</locationOverride>
<locationSource>POLICY</locationSource>
<overrideAllLocations>false</overrideAllLocations>
<originalStatus
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="1" />
<payrollStatus>FOLLOWS</payrollStatus>
<override>0</override>
<policyNumber>1</policyNumber>
<status>ACTIVE</status>
<timeSource>BOTH</timeSource>
<lastUsedDate
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="1" />
<lastTransaction>0</lastTransaction>
<payrollUse>N</payrollUse>
<payrollAtm>DISALLOW</payrollAtm>
<payrollChk>DISALLOW</payrollChk>
<payrollAch>DISALLOW</payrollAch>
<payrollWire>DISALLOW</payrollWire>
<payrollDebit>DISALLOW</payrollDebit>
</header>
<infos>
<infoId>DRID</infoId>
<lengthCheck>false</lengthCheck>
<matchValue>999999</matchValue>
<maximum>0</maximum>
<minimum>0</minimum>
<reportValue></reportValue>
<validationType>EXACT_MATCH</validationType>
<value>0</value>
</infos>
<limits>
<hours>0</hours>
<limit>250</limit>
<limitId>DSL</limitId>
<minHours>0</minHours>
</limits>
<limits>
<hours>0</hours>
<limit>250</limit>
<limitId>USLD</limitId>
<minHours>99</minHours>
</limits>
<locationGroups>1</locationGroups>
</result>
</ns5:getCardResponse>
</soapenv:Body>
</soapenv:Envelope>
Re: XML-INTO XML parser detected error code 2.
Posted: Thu Dec 01, 2022 7:12 pm
by Scott Klement
The problem (maybe this was what Jon was saying?) is the path. Your path doesn't include all of the XML elements it needs to get to the "limits" tag. Notice the outermost element of your document is soapenv:Envelope, but for some reason your path starts at "result".
To try it out, I copy/pasted your XML document into a file in my IFS, and changed your code to read from a file. Then modified the path and added some code to display some results -- this worked for me:
Code: Select all
**free
dcl-ds PSDS qualified PSDS;
count int(20) pos(372);
end-ds;
Dcl-ds limits Dim(10) qualified;
hours char(3);
limit char(4);
limitid char(5);
minHours char(3);
End-Ds;
dcl-s xmlData varchar(100) inz('onie.xml');
dcl-s msg varchar(52);
dcl-s x int(10);
XML-INTO limits %XML(xmlData : 'doc=file case=any +
allowextra=yes allowmissing=yes trim=all +
path=soapenv:Envelope/soapenv:Body/ns5:getCardResponse+
/result/limits');
for x = 1 to PSDS.count;
msg = 'hours=' + %trim(limits(x).hours)
+ ' limit=' + %trim(limits(x).limit)
+ ' limitid=' + %trim(limits(x).limitid)
+ ' minHours=' + %trim(limits(x).minHours);
dsply msg;
endfor;
*inlr = *on;
Having said that, here are some things I'd do differently:
- I never use case=any, I would change it to case=convert -- even though that's not strictly needed here, it's a good habit to get into.
- The allowmissing=yes and allowextra=yes don't seem to serve any purpose in your case, and are making this program harder to debug. I would remove them.
- When working with documents that have namespaces (including SOAP documents like this one) I would recommend stripping off the namespaces, because they aren't guaranteed to always be the same. For example, this time they used "soapenv" as the namespace for SOAP elements, but in the future they could change it to "soap" or "env" or "bobsYourUncle" -- and they'd expect your program to still work provided that the namespace they use points to the same URL. IBM provides the option ns=remove for this purpose.
- trim=all is the default, so no need to supply it.
So with those changes, this is what my test program would look like:
Code: Select all
**free
dcl-ds PSDS qualified PSDS;
count int(20) pos(372);
end-ds;
Dcl-ds limits Dim(10) qualified;
hours char(3);
limit char(4);
limitid char(5);
minHours char(3);
End-Ds;
dcl-s xmlData varchar(100) inz('onie.xml');
dcl-s msg varchar(52);
dcl-s x int(10);
XML-INTO limits %XML(xmlData : 'doc=file case=convert ns=remove +
path=Envelope/Body/getCardResponse/result/limits');
for x = 1 to PSDS.count;
msg = 'hours=' + %trim(limits(x).hours)
+ ' limit=' + %trim(limits(x).limit)
+ ' limitid=' + %trim(limits(x).limitid)
+ ' minHours=' + %trim(limits(x).minHours);
dsply msg;
endfor;
*inlr = *on;
Obviously, you'll need to change it back to doc=string if your XML is in the string vs. in a file. But, hopefully this gets you pointed in the right direction.
Re: XML-INTO XML parser detected error code 2.
Posted: Thu Dec 01, 2022 8:49 pm
by jonboy49
Scott Klement wrote: ↑Thu Dec 01, 2022 7:12 pm
The problem (maybe this was what Jon was saying?) is the path. Your path doesn't include all of the XML elements it needs to get to the "limits" tag. Notice the outermost element of your document is soapenv:Envelope, but for some reason your path starts at "result".
Yup that was what I was saying. I don't know if the OP edited the post or if there was a "burp" in the software when it displayed the original message to me because there were no code tags in place when I saw the post and there were bits missing/added to the XML. I copied/pasted it and tried to format it as you did but the formatter just barfed.
Re: XML-INTO XML parser detected error code 2.
Posted: Thu Dec 01, 2022 11:09 pm
by Scott Klement
I added the code tags because it was hard to read... Maybe that fixed the XML formatting problem, too.
Re: XML-INTO XML parser detected error code 2.
Posted: Fri Dec 02, 2022 12:06 pm
by onie
Code: Select all
CTL-OPT DFTACTGRP(*NO) ACTGRP('TMTILE')
BNDDIR('AVRTBNDDIR' :'HTTPAPI');
CTL-OPT OPTION(*DEBUGIO:*SRCSTMT) DEBUG FIXNBR(*ZONED) EXTBININT(*YES)
INDENT('|') USRPRF(*OWNER) MAIN(Main);
//****************************************************************//
DCL-F EFSTSERVER DISK(*EXT) USAGE(*INPUT:*UPDATE) KEYED;
//****************************************************************//
// Program Interface and Prototypes //
//****************************************************************//
// Have lib LIBHTTP in lib list.
/include HTTPAPI_H
/Copy LIBHTTP/QRPGLESRC,IFSIO_H
//--Move *DIAG and Re-Send *ESCAPE Messages-----------------------//
Dcl-Pr ForwardMessage ExtProc('ERR03');
End-Pr;
DCL-PR OpenFile pointer extproc('_C_IFS_fopen');
*n pointer value; //File name
*n pointer value; //File mode
END-PR;
// This API's will pull data by CRLF characters
DCL-PR ReadFile pointer extproc('_C_IFS_fgets');
*n pointer value; //Retrieved data
*n int(10) value; //Data size
*n pointer value; //Misc pointer
END-PR;
DCL-PR CloseFile extproc('_C_IFS_fclose');
*n pointer value; //Misc pointer
END-PR;
//****************************************************************//
// Global Constants, Data Structures, and Variables //
//****************************************************************//
//****************************************************************//
Dcl-C FAULT Const('path=soapenv:Envelope/soapenv:Body/soapenv:+
Fault/faultstring doc=file');
//--EFS Web Services log Directory path -------------------------//
Dcl-C IFSPATH Const('/efs/webservices/log');
// 2022-11-11T06:59:17.000-06:00 serverTime return value
Dcl-C TIMEOUT Const(10);
Dcl-S URL VarChar(100) Inz(*blanks);
Dcl-S DebugFlag Ind Inz(*On);
Dcl-S ErrorMessage Char(80) Inz(*Blanks);
Dcl-S ErrorMessage2 Char(80) Inz(*Blanks);
Dcl-S #msg Char(300) Inz(*Blanks);
Dcl-s $I_ClientId Char(32) Inz(*Blanks); // Client ID
Dcl-s $I_Card# Char(25) Inz('7083052034842200011'); // EFS Card Number
Dcl-S SOAP VarChar(1000) Inz(*Blanks);
Dcl-S SOAPAddr Pointer Inz(*Null);
Dcl-S SOAPLen Int(10) Inz(*Zeros);
Dcl-S Filepath VarChar(100) Inz(*Blanks);
Dcl-S Debugpath VarChar(100) Inz(*Blanks);
Dcl-S RC Int(10) Inz(*Zeros);
Dcl-S FaultString VarChar(300) Inz(*Blanks);
Dcl-s cardNumber char(25) Inz(*Blanks);
Dcl-s POS int(5);
Dcl-s locationGroups char(10);
Data structures all load with no problem, util it gets to limits DS.
Dcl-DS header qualified;
companyXRef char(15); //The Company Xref populated for the card
handEnter char(6); //ALLOW, DISALLOW OR POLICY
infoSource char(6); //INFOS AT LEVEL: POLICY, CARD OR BOTH
limitSource char(6); //POLICY, CARD OR BOTH
locationOverride char(1); //Boolean 0=no override 1=override
locationSource char(6); //POLICY, CARD OR BOTH
overrideAllLocations char(6); //POLICY, CARD OR BOTH
originalStatus char(8); // ?
payrollStatus char(8); //ACTIVE, INACTIVE OR FOLLOWS
override char(1); //BOOLEAN 0=FALSE 1=TRUE
policyNumber char(3); //POLICY# CARD BELONGS TO, 1-99
status char(8); //ACTIVE,INACTIVE,HOLD OR DELETE
timeSource char(6); //POLICY, CARD OR BOTH
lastUsedDate char(29); //THE LAST USED DATE/TIME ON CARD
lastTransaction char(29); //AUTHORIZATIO# OF LAST TRANSACTION ON CARD
payrollUse char(1); //P-PAYROLL,B-PAYROLL/NORMAL,N-NORMAL,Y-DEBIT,L-DEBIT LIMIT
payrollAtm char(8); //DISALLOW OR ALLOW SMART FUNDS FROM ATM
payrollChk char(8); //DISALLOW OR ALLOW REGISTERED CHECK SMART FUNDS
payrollAch char(8); //DISALLOW OR ALLOW ACH SMART FUNDS
payrollWire char(8); //DISALLOW OR ALLOW WIRES SMART FUNDS
payrollDebit char(8); //DISALLOW OR ALLOW SMART FUNDS DEBIT NETWORK
End-ds;
Dcl-ds infos qualified;
infold char(4); //INFO ID
lengthCheck char(5); //IF LENGTH CHECK IS ON. TRUE/FALSE
matchValue char(24); //MATCH OF DRIVER ID#, UNIT# ect.
maximum char(10); //MAXIMUM VALUE IF LENGTH CHECK IS TRUE
minimum char(10); //MINIMUM VALUE IF LENGTH CHECK IS TRUE
reportValue char(24); //IF REPORT ONLY, THIS IS THE VALUE
validationType char(13); //VALIDATION TYPE FOR THE PROMPT
value char(1); //ODOMETER, HUBOMETER OR 0
End-ds;
Dcl-ds limits Dim(10) qualified;
hours char(3);
limit char(4);
limitid char(5);
minHours char(3);
End-Ds;
//--Program Status Data Structure---------------------------------//
Dcl-Ds *N psds;
PgmNme Char(10) Pos(1); // PGM name
ErrMsg Char(80) Pos(91); // Error text
JobNme Char(10) Pos(244); // Job name
UsrNme Char(10) Pos(254); // User name
JobNum Zoned(6:0) Pos(264); // Job number
Parser Zoned(5:0) Pos(368); // Parser error
XMLCount int (20) POS(372); // Element count
End-Ds;
//****************************************************************//
// Main Procedure //
//****************************************************************//
Dcl-Proc Main;
//**Procedure Body**********************************************//
Monitor;
//--Set Request Variables to Default Values-------------------//
Reset URL;
Reset SOAP;
Reset SOAPAddr;
Reset SOAPLen;
Reset DebugFlag;
Reset FaultString;
Reset ErrorMessage;
Reset #MSG;
chain(n) (1) efstserver; // 1=Active Server
if %found(efstserver);
$I_ClientID = ClientID;
URL = %trim(DOMAIN);
endif;
//--Set Filepaths for IFS Files-------------------------------//
Reset Filepath;
Filepath = IFSPATH + '/' +
%EditC(%Dec(%TimeStamp):'X') + '_' +
%EditC(JobNum:'X') + '_' +
%Trim(UsrNme) + '_' +
'getCard.XML';
Reset DebugPath;
If DebugFlag;
DebugPath = IFSPATH + '/' +
%EditC(%Dec(%TimeStamp):'X') + '_' +
%EditC(JobNum:'X') + '_' +
%Trim(UsrNme) + '_' +
'getCard.TXT';
http_debug(*On:DebugPath);
EndIf;
SOAP =
'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap' +
'.org/soap/envelope/" xmlns:com="http://com.xxx.xxxx.xxxxxx">' +
'<soapenv:Header/>' +
'<soapenv:Body>' +
'<com:getCard>' +
'<clientId>' + %Trim($I_ClientID) + '</clientId>' +
'<cardNumber>' + %Trim($I_Card#) + '</cardNumber>' +
'</com:getCard>' +
'</soapenv:Body>' +
'</soapenv:Envelope>';
SOAPAddr = %Addr(SOAP) + 2;
SOAPLen = %Len(%Trim(SOAP));
//--Run EFS Web Service---------------------------------------//
RC = HTTP_POST(URL:SOAPAddr:SOAPLen:FILEPATH:TIMEOUT);
IF Rc = 1; // Successful
processData();
else;
XML-Into FaultString %XML(Filepath:FAULT);
ErrorMessage = %Trim(FaultString);
ErrorMessage2 = %trim(http_error());
#MSG = (Errormessage + ' ' + Errormessage2);
sendMsg(#MSG);
Dump(A);
Return;
endif;
On-Error;
forwardMessage();
Dump(A);
EndMon;
Return;
End-Proc;
Dcl-Proc ProcessData; ----------------------------------- Here I read the IFS file and strip the front of the file off, so it starts at <result>.
DCL-S FilePtr pointer inz;
DCL-S PathFile char(100);
DCL-S OpenMode char(5);
Dcl-s RtvData char(10000);
Dcl-s xmlData char(10000);
Monitor;
// Null terminate lines with x'00' for API's
PathFile = %Trim(Filepath) + x'00';
OpenMode = 'r' + x'00';
FilePtr = OpenFile(%addr(PathFile):%addr(OpenMode));
if (FilePtr = *null);
Dump(A);
Return;
endif;
// RtvDta should contain each row up to the CR/LF mark.
dow (ReadFile(%addr(RtvData):32767:FilePtr) <> *null);
RtvData = %xlate(x'00':' ':RtvData); // *NULL
RtvData = %xlate(x'25':' ':RtvData); // LF
RtvData = %xlate(x'0D':' ':RtvData); // CR
Monitor;
POS = %SCAN('<result>' : RtvData);
xmlData = %subst(RtvData:POS);
// Card Number ------------------------------------------------------------------- carNumber loads just fine.
XML-INTO cardNumber %XML(xmlData : 'doc=string case=any +
allowextra=yes allowmissing=yes trim=none +
path=result/cardNumber');
dsply cardNumber;
//Load header data structure ----------------------------------------------------- Header DS loads just fine.
XML-INTO header %XML(xmlData : 'doc=string case=any +
allowextra=yes allowmissing=yes trim=none +
path=result/header');
//Load infos data structure --------------------------------------------------------Infos DS loads just fine.
XML-INTO infos %XML(xmlData : 'doc=string case=any +
allowextra=yes allowmissing=yes trim=none +
path=result/infos');
//Load limits data structure
XML-INTO limits %XML(xmlData : 'doc=string case=convert + -------------<- RNX0351 Parsing error code 2 when it hits this line.
path=result/limits'); ---------------------------------------------------------------- But it does load the 2 elements sent. If I change
--------------------------------------------------------------------------------------------Dim(2) I get NO error instead of Dim(10) that gets an error.
//Load Location Groups
XML-INTO locationGroups %XML(xmlData : 'doc=string case=any + ---------This loaded when I changed the above array to Dim(2).
path=result/locationGroups');
dsply locationGroups;
On-Error;
Dump(A);
CloseFile(%addr(PathFile));
sendMsg(ErrMsg);
Return;
EndMon;
enddo;
CloseFile(%addr(PathFile));
On-Error;
CloseFile(%addr(PathFile));
ForwardMessage();
EndMon;
Return;
End-Proc;
I strip off the xml so that the string I am working with starts at the <result> tag.
Code: Select all
<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns5
:getCardResponse xmlns:ns5="http://xx.xx.xxx.com">
<result>
<cardNumber>7083052034842200011</cardNumber>
<header>
<companyXRef></companyXRef>
<handEnter>POLICY</handEnter>
<infoSource>BOTH</infoSource>
<limitSource>POLICY</limitSource>
<locationOverride>0</locationOverride>
<locationSource>POLICY</locationSource>
<overrideAllLocations>false</overrideAllLocations>
<originalStatus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="1" />
<payrollStatus>FOLLOWS</payrollStatus>
<override>0</override>
<policyNumber>1</policyNumber>
<status>ACTIVE</status>
<timeSource>BOTH</timeSource>
<lastUsedDate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="1" />
<lastTransaction>0</lastTransaction>
<payrollUse>N</payrollUse>
<payrollAtm>DISALLOW</payrollAtm>
<payrollChk>DISALLOW</payrollChk>
<payrollAch>DISALLOW</payrollAch>
<payrollWire>DISALLOW</payrollWire>
<payrollDebit>DISALLOW</payrollDebit>
</header><infos>
<infoId>DRID</infoId>
<lengthCheck>false</lengthCheck>
<matchValue>999999</matchValue>
<maximum>0</maximum>
<minimum>0</minimum>
<reportValue></reportValue>
<validationType>EXACT_MATCH</validationType>
<value>0</value>
</infos>
<limits> ----------------------------------------------------- This is defined as a DIM(10), but it only has 2 elements in this data received. In debug
<hours>0</hours> ------------------------------------------these load to the array and then it blows up with, The XML parser detected error code 2.
<limit>250</limit>
<limitId>
DSL</limitId>
<minHours>0</minHours>
</limits>
<limits>
<hours>0</hours>
<limit>250</limit>
<limitId>USLD</limitId>
<minHours>99</minHours>
</limits>
<locationGroups>1</locationGroups>
</result></ns5:getCardResponse></soapenv:Body></soapenv:Envelope>
Code: Select all
EVAL limits ---------------------------- When I changed the array to DIM(2) NO parsing error code 2.
LIMITS.HOURS(1) = '0 ' ------------------- If there are blank array elements then it has an error.
LIMITS.LIMIT(1) = '250 '
LIMITS.LIMITID(1) = 'DSL '
LIMITS.MINHOURS(1) = '0 '
LIMITS.COUNT_HOURS(1) = 1
LIMITS.HOURS(2) = '0 '
LIMITS.LIMIT(2) = '250 '
LIMITS.LIMITID(2) = 'USLD '
LIMITS.MINHOURS(2) = '99 '
LIMITS.COUNT_HOURS(2) = 1
Re: XML-INTO XML parser detected error code 2.
Posted: Fri Dec 02, 2022 12:11 pm
by onie
I see your code worked with the loading of the array. I will try again and see if I can get it to work.
I was about to try to learn how to do a %handler procedure.
Thank you very much for you example code.
Onie
Re: XML-INTO XML parser detected error code 2.
Posted: Fri Dec 02, 2022 2:11 pm
by onie
I am wondering if the way the read is bringing the data?
// Null terminate lines with x'00' for API's
PathFile = %Trim(Filepath) + x'00';
OpenMode = 'r' + x'00';
FilePtr = OpenFile(%addr(PathFile):%addr(OpenMode));
if (FilePtr = *null);
Dump(A);
Return;
endif;
// RtvDta should contain each row up to the CR/LF mark.
dow (ReadFile(%addr(RtvData)

FilePtr) <> *null);
RtvData = %xlate(x'00':' ':RtvData); // *NULL
RtvData = %xlate(x'25':' ':RtvData); // LF
RtvData = %xlate(x'0D':' ':RtvData); // CR
This is how I was told to bring the file into the program.
Could this cause a problem for the xml-into?
Onie
Re: XML-INTO XML parser detected error code 2.
Posted: Fri Dec 02, 2022 3:14 pm
by onie
Code: Select all
EVAL limits
LIMITS.HOURS(1) = '0 '
LIMITS.LIMIT(1) = '250 '
LIMITS.LIMITID(1) = 'DSL
LIMITS.MINHOURS(1) = '0 '
LIMITS.HOURS(2) = '0 '
LIMITS.LIMIT(2) = '250 '
LIMITS.LIMITID(2) = 'USLD
LIMITS.MINHOURS(2) = '99 '
LIMITS.HOURS(3) = ' '
LIMITS.LIMIT(3) = ' '
LIMITS.LIMITID(3) = '
LIMITS.MINHOURS(3) = ' '
LIMITS.HOURS(4) = ' '
Code: Select all
PathFile = %Trim(Filepath) + x'00';
OpenMode = 'r' + x'00';
FilePtr = OpenFile(%addr(PathFile):%addr(OpenMode));
if (FilePtr = *null);
Dump(A);
Return;
endif;
// RtvDta should contain each row up to the CR/LF mark.
// dow (ReadFile(%addr(RtvData):32767:FilePtr) <> *null);
// RtvData = %xlate(x'00':' ':RtvData); // *NULL
// RtvData = %xlate(x'25':' ':RtvData); // LF
// RtvData = %xlate(x'0D':' ':RtvData); // CR
ReadFile(%addr(RtvData):10000:FilePtr); I changed to not do the %xlate on the read, but still get the same error.