Transform DB2 to XML from AS/400

830 pts.
Tags:
AS/400 development
DB2/400
IBM DB2
iSeries development
XML
I have been requested to create XML files from AS/400 DB2 files to be used to update data on a client's web server. I have looked at IBM's XML Toolkit for iSeries, but the examples are all about parsing XML input and nothing about creating XML from native AS/400 database files. Is there something in the Toolkit that will do this? Does anyone have any experience with DB2 to XML? Thanks.

Answer Wiki

Thanks. We'll let you know when a new response is added.

I have written programs to do what you want to do, and would be happy to provide an example, for you and anyone else who is interested.

You can get me at john.blenkinsop@ne.nykline.com

Sloopy

————–

DB2 SQL has the capability of creating XML …

SELECT XML2CLOB(
XMLELEMENT(NAME “DEPARTMENT”,
XMLATTRIBUTES (DEPT AS “NAME” ),
XMLAGG(XMLELEMENT(NAME “EMP”,
XMLELEMENT(NAME “FIRSTNAME”, FNM),
XMLELEMENT(NAME “LASTNAME”, LNM) )
ORDER BY LNM )
) ) AS “DEPT_LIST”
FROM TTEST
GROUP BY DEPT;

results in

<DEPARTMENT NAME=”BADM “><EMP><FIRSTNAME>CHERYL </FIRSTNAME><LASTNAME>ST……

Happy DB2ing

————————————————————-
Er… I do not know who wrote the piece above, regarding SQL generating XML. It was not me. I do have the feeling that it is not available in OS version 5 or below. Probably 6.1.

Sloopy.

=======================================================================

I can highly recommend the program from Sloopy. Its very well written and works after you made your changes according to your needs.

YuVa

================================================================

The portion of the answer above that refers to the XML2CLOB() function is incorrect. The function is from DB2 UDB for LUW. It is not part of DB2 on i nor is it supplied with DB2 XML Extenders for i.

However, DB2 XML Extenders for i can supply a number of functions that can make DB2 and XML easy to work with together.

Tom

Discuss This Question: 5  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • BigKat
    Is the XML2CLOb from i6.1? I had never heard of this, and tried it on a V5R4 and it doesn't seem to work
    Token "VENDOR" was not valid. Valid tokens: ) ,.
    8,350 pointsBadges:
    report
  • tantart
    i have the same problme. Token was not valid
    40 pointsBadges:
    report
  • TomLiotta
    XML2CLOB is for DB2 UDB for Linux and Windows. You can't use it on iSeries since it doesn't exist on iSeries. You need to use the functions that are listed in the product documentation. You can't just take a function from one platform and assume it will work on different hardware under a different operating system. Try the XMLCLOBFromFile() function on iSeries. Tom
    125,585 pointsBadges:
    report
  • Meandyou
    XML2CLOB is also for DB2 for z/OS from Ver 7 or 8. I made a bad assumption that it exists also on other platforms. Sorry.
    5,220 pointsBadges:
    report
  • TomLiotta
    I wish there was a clear, public reason why function names couldn't be matched up. Stuff like this feels like an intentional move to make i stuff more confusing. You need to be experienced in both versions in order to think you know which function to use. I do a lot of guessing. Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following