|
Hi Brian,
You may check the following article:
Using RPG to exploit IBM DB2 XML support
http://www.ibm.com/developerworks/ibmi/library/i-using-rpg/index.html
Using embedded SQL or better Reference Files is an even easier way for
writing the result to the IFS. (The most complex part is building the
SQL statement for generating the XML document.
The following souce code is a complete program for generating an XML
document and writing this document directly to the IFS:
D MyXMLDoc S SQLTYPE(XML_CLOB_File)
D
//********************************************************************
***
/Free
Exec SQL Set Option Commit=*None, DatFmt=*ISO, CloSQLCsr=*EndActGrp;
Clear MyXMLDoc;
MyXMLDoc_Name = '/home/Hauser/WrtSQLXML.xml';
MyXMLDoc_NL = %Len(%Trim(MyXMLDoc_Name));
MyXMLDoc_FO = SQFOVR; //Replace if exists
Exec SQL
Select XmlDocument
(xmlgroup(EmployeeNo as "PersNo",
Trim(Trim (FirstName) concat ' ' concat
Trim(Name)) as "PersName",
Address as "Street",
ZipCode as "ZipCode",
City as "City"
Order By City Desc, Name
Option Row "Employee"
Root "Staff"))
into :MyXMLDoc
From LobStaff;
If SQLCODE < *Zeros;
Dsply 'Error occured';
else;
Dsply 'XML Document generated';
EndIf;
*InLR = *On;
/End-Free
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars."
(Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training
them and keeping them!"
-----Ursprüngliche Nachricht-----
Von: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im Auftrag von
Brian Stapleton
Gesendet: Tuesday, 19.8 2014 21:56
An: rpg400-l@xxxxxxxxxxxx
Betreff: Writing XML with RPGLE V7R1M0
Good Afternoon
I need to learn how to write XML documents with RPGLE V7R1M0 onto our IFS.
How can I educate myself on doing this?
I would prefer to stay as native RPGLE as possible, and am not looking
to purchase a 3rd party solution.
Brian Stapleton
Information Services
Carhartt, Inc
5750 Mercury Drive
Dearborn, MI 48126
Desk - 313-749-6586
Fax - 313-271-3455
BStapleton@xxxxxxxxxxxx<mailto:BStapleton@xxxxxxxxxxxx>
[Description: Description: Carhartt_emaillogo]
Confidential: This electronic message and all contents contain
information from Carhartt, Inc. and its affiliates which may be
confidential or otherwise protected from disclosure. The information
is intended to be for the addressee only. If you are not the
addressee, any disclosure, copy, distribution or use of the contents
of this message is prohibited. If you have received this electronic
message in error, please notify us immediately at (313) 271-8460 and
destroy the original message and all copies.
--
This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/rpg400-l.
--
This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/rpg400-l.
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.