Sample program to covert XML data to cobol and vice versa.
-
- Registered Member
- Posts: 24
- Joined: Fri Aug 16, 2013 1:30 pm
Sample program to covert XML data to cobol and vice versa.
Hi
Is there a step by step example of some example program in which it is shown to change/convert the cobol data into XML format and covert XML data back to cobol. It'd be nice if you can direct me to some sample program? Thanks,
Is there a step by step example of some example program in which it is shown to change/convert the cobol data into XML format and covert XML data back to cobol. It'd be nice if you can direct me to some sample program? Thanks,
- enrico-sorichetti
- Global Moderator
- Posts: 843
- Joined: Wed Sep 11, 2013 3:57 pm
Re: Sample program to covert XML data to cobol and vice versa.
google with
xml cobol ibm redbooks
and You will find lots of links to the IBM literaure discussing the subject
xml cobol ibm redbooks
and You will find lots of links to the IBM literaure discussing the subject
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort

Re: Sample program to covert XML data to cobol and vice versa.
What, exactly, do you mean by 'cobol'? Have you coded your COBOL program code as XMLfor some reason and want to convert it back again?covert XML data back to cobol.
Regards
Nic
Nic
- Anuj Dhawan
- Founder
- Posts: 2824
- Joined: Sun Apr 21, 2013 7:40 pm
- Location: Mumbai, India
- Contact:
Re: Sample program to covert XML data to cobol and vice versa.
Start from these, may be:
Result:
http://www.ibm.com/support/knowledgecen ... xml21e.htm
http://www.canamsoftware.com/Portals/3/ ... 0COBOL.pdf
http://www-01.ibm.com/support/docview.w ... 4198&aid=1
http://publibz.boulder.ibm.com/cgi-bin/ ... 3836&CASE=
http://publibz.boulder.ibm.com/cgi-bin/ ... 0923143836
Code: Select all
Identification division.
Program-id. PARSESEG.
Environment division.
Input-output section.
File-control.
Select Input-XML
Assign to infile
File status is Input-XML-status.
Data division.
File section.
FD Input-XML
Record is varying from 1 to 255 depending on Rec-length
Recording mode V.
1 fdrec.
2 pic X occurs 1 to 255 depending on Rec-length .
Working-storage section.
1 Event-number comp pic 99.
1 Rec-length comp-5 pic 9(4).
1 Input-XML-status pic 99.
Procedure division.
Open input Input-XML
If Input-XML-status not = 0
Display 'Open failed, file status: ' Input-XML-status
Goback
End-if
Read Input-XML
If Input-XML-status not = 0
Display 'Read failed, file status: ' Input-XML-status
Goback
End-if
Move 0 to Event-number
Display 'Starting with: ' fdrec
Display 'Event number and name Content of XML-text'
XML parse fdrec processing procedure Handle-parse-events
Close Input-XML
Goback
.
Handle-parse-events.
Add 1 to Event-number
Display ' ' Event-number ': ' XML-event '{' XML-text '}'
Evaluate XML-event
When 'END-OF-INPUT'
Read Input-XML
Evaluate Input-XML-status
When 0
Move 1 to XML-code
Display 'Continuing with: ' fdrec
When 10
Display 'At EOF; no more input.'
When other
Display 'Read failed, file status:' Input-XML-status
Goback
End-evaluate
When other
Continue
End-evaluate
.
End program PARSESEG.
Code: Select all
Starting with: <?xml version='1.0'?>
Event number and name Content of {XML-TEXT}
01: START-OF-DOCUMENT {}
02: VERSION-INFORMATION {1.0}
03: END-OF-INPUT {}
Continuing with: <Tagline>
04: START-OF-ELEMENT {Tagline}
05: END-OF-INPUT {}
Continuing with: COBOL is the language of the future!
06: CONTENT-CHARACTERS {COBOL is the language of the future!}
07: END-OF-INPUT {}
Continuing with: </Tagline>
08: CONTENT-CHARACTERS {}
09: END-OF-ELEMENT {Tagline}
10: END-OF-DOCUMENT {}
http://www.canamsoftware.com/Portals/3/ ... 0COBOL.pdf
http://www-01.ibm.com/support/docview.w ... 4198&aid=1
http://publibz.boulder.ibm.com/cgi-bin/ ... 3836&CASE=
http://publibz.boulder.ibm.com/cgi-bin/ ... 0923143836
Thanks,
Anuj
Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Anuj
Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
-
- Registered Member
- Posts: 24
- Joined: Fri Aug 16, 2013 1:30 pm
- Anuj Dhawan
- Founder
- Posts: 2824
- Joined: Sun Apr 21, 2013 7:40 pm
- Location: Mumbai, India
- Contact:
Re: Sample program to covert XML data to cobol and vice versa.
Good Luck!
Thanks,
Anuj
Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Anuj
Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Create an account or sign in to join the discussion
You need to be a member in order to post a reply
Create an account
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute