IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

XML Parse in COBOL - got Error code 2 Exception


IBM Mainframe Forums -> CICS
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Thamilselvi

New User


Joined: 22 Jun 2012
Posts: 57
Location: Chennai

PostPosted: Mon Jul 16, 2012 9:53 am
Reply with quote

Hi,

I am working on XMLParse in CICS COBOL program. When I try to parse the below XML, I am getting Exception error after the XML declaration statement. My program parses till Standalone Declaration. While parsing the comment statement, I am getting Exception error code "2".

When i ran the same XML in batch (COBOL), its working fine. Please help me to solve this.


XML Scritp:

<?xml version="1.0" encoding="IBM-1140" standalone="yes"?> <!--this document is just an example--><customer-Details> <customer-name>Company Name.</customer-name> <employee-Details> <employee> <emp-name>AAAAAA</emp-name> <emp-pan-no>A111111111</emp-pan-no> <emp-location>KARNATAKA</emp-location> <emp-designation>S/W ENGING</emp-designation> <emp-salary>100000</emp-salary> <emp-on-bench>NO</emp-on-bench> <project-name>Mainframe</project-name> </employee> <employee-Details><customer-Details>
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Jul 16, 2012 10:20 am
Reply with quote

Hello,

As it is rather late here and i suspect rather early there, i'll give this a shot.

I've not done much xml, but is the posted xml correct? There are no terminators for <employee-Details><customer-Details> that i can see . . .
Back to top
View user's profile Send private message
Thamilselvi

New User


Joined: 22 Jun 2012
Posts: 57
Location: Chennai

PostPosted: Mon Jul 16, 2012 10:32 am
Reply with quote

Sorry, I have missed the terminator while editing this XML script. Please find the correct one below.

<?xml version="1.0" encoding="IBM-1140" standalone="yes"?> <!--this document is just an example--><customer-Details> <customer-name>Company Name.</customer-name> <employee-Details> <employee> <emp-name>AAAAAA</emp-name> <emp-pan-no>A111111111</emp-pan-no> <emp-location>KARNATAKA</emp-location> <emp-designation>S/W ENGING</emp-designation> <emp-salary>100000</emp-salary> <emp-on-bench>NO</emp-on-bench> <project-name>Mainframe</project-name> </employee> </employee-Details></customer-Details>
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Jul 16, 2012 2:20 pm
Reply with quote

Since byte 80 occurs in the middle of the comment statement, I suspect what you show as the XML is not exactly how it is being presented to the CICS program.

Where is this XML coming from?
If it is coming from a file, what is the record length of the file?
If it is coming from a terminal, how do you combine the various lines to create a single variable to use the XML PARSE verb on?
If it is coming from somewhere else, how long are the records being passed to your CICS program?
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Mon Jul 16, 2012 2:35 pm
Reply with quote

Exception 2 :

The parser found an invalid start of a processing instruction, element, comment, or document type declaration outside element content.
Back to top
View user's profile Send private message
Thamilselvi

New User


Joined: 22 Jun 2012
Posts: 57
Location: Chennai

PostPosted: Mon Jul 16, 2012 3:32 pm
Reply with quote

The XML message is received from MQ Queue. The same opens,Read the XML message from MQ. And it prase the received XML message to applicaiton data.

I have ran the same program with the above XML (removed the comment line) message. Its working fine. Please help to find the issue in XML comment line.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Tue Jul 17, 2012 1:38 pm
Reply with quote

All XML comments i did see on the internets are starting/ending with a space, contrary to your XML comment. Don't know if that makes the difference.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CICS

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 2
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Error to read log with rexx CLIST & REXX 11
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts Error when install DB2 DB2 2
Search our Forums:

Back to Top