× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I really ask myself if the example in Jon's article (even with embedded SQL) is soooo much easier than an a 6 row embedded SQL Program:
The following example should generate and write the same XML document (as in Jon's article) into the IFS.

DCL-S IFS_File SQLTYPE(XML_CLOBFILE);

Clear IFS_File;
IFS_File_Name = '/Home/Hauser/MyXMLFile';
IFS_File_NL = %Len(%Trim(IFS_FILE_Name));
IFS_File_FO = SQFOVR;

With x as (Select CUSNUM,
XMLElement(Name "Customer",
XMLATTRIBUTES(CusNum as "Id"),
XMLElement(Name "Name", LSTNAM,
XMLRow(Street as "Street",
City as "City",
State as "State",
ZipCod as "Zip"
Option Row "Address"))) Customer
from QIWS.QCUSTCDT
where STATE = 'TX')
Select XMLDocument(XMLElement(Name "Customers",
XMLElement(Name "RecordCount", Count(*)),
XMLAgg(Customer Order By CusNum)))
into :IFSFile
From x;
If SQLCODE < *Zeros;
//Handle Error
EndIf

Return;


Mit freundlichen Grüßen / Best regards

Birgitta Hauser
Modernization – Education – Consulting on IBM i
Database and Software Architect
IBM Champion since 2020

"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!"
"Train people well enough so they can leave, treat them well enough so they don't want to. " (Richard Branson)
"Learning is experience … everything else is only information!" (Albert Einstein)

-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Jon Paris
Sent: Wednesday, 5 June 2024 13:54
To: RPG programming on the IBM i (AS/400 and iSeries) <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: Writing XML

Yes I was very impressed by this package. If anyone is interested I wrote about it here: https://authory.com/JonParisAndSusanGantner/Generating-XML-the-XMLi-Way that article discusses the multiple options for XML generation that xmli provides.

I kept hoping that Larry would enhance it but it never happened. It still lives in my "I'll work on this one day" bucket!


Jon P


On Jun 5, 2024, at 9:56 AM, mihael <mihael@xxxxxxxxxxxxxx> wrote:




I find those SQL functions for XML and JSON too cumbersome and not so straightforward and most of the time will the statement be very hard to read if you come back some month later.



The open source project from Larry Ducie work very well for me:
xmli.sf.net



My 2 cents .












Am 04.06.2024 um 16:52, Dave <dfx1@xxxxxxxxxxxxxx> schrieb:


Hi,

Got given a bunch of PFs and told to generate an XML document from them.
Discovered the DB2 function XMLGROUP but it doesn't look easy to use
for a complicated document. Don't we have a "standard way" of doing this yet?

Tia
--
This is the RPG programming on IBM i (RPG400-L) mailing list To post
a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.



--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a
message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.


--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.