MIDRANGE dot COM Mailing List Archive



Home » MIDRANGE-L » August 2014

Re: AS400 DB to XML



fixed

I like the look of this code - and I think it is a toss of a coin, whether Henrik's or mine is easier - 5 function calls in mine, 6 in Henrik's.

I think one thing about Henrik's is this - you may be able to see the actual structure of the XML more easily, more directly - with the CGIDEV2 version, it depends to a degree on how you name things (a person could use the XML tag names as variable names, for example) - and with CGIDEV2, we use sections, which are not necessarily related directly to XML elements and attributes and all.

Now CGIDEV2 can do this kind of thing to any text output - Henrik, I believe powerEXT uses CGIDEV2, for some of its functions - I assume there are functions for writing to other formats, such as HTML and maybe RTF and whatever. A question - can you use powerEXT in a more generic fashion, so that I could write to a format you have not included? Just curious.

I've put a much-abridged version of my program here - the variables are declared above this, and there is a READ loop that updates the variables and writes the activity section. In addition, date and time and history are built from several fields in the file being read.

/free
IfsMultIndicators = getHtmlIfsMult('/XML/activities.tpl' :
'<!-- $' : '$ -->' : '<!-- %' : '% -->');

ClrHtmlBuffer();

wrtSection('FileHeader');

updHtmlVar('CustomerNumber' : custno);
updHtmlVar('ActivationDate' : %char(actdate));
updHtmlVar('ActivationTime' : %char(acttime));
updHtmlVar('HistoryEntry' : history);

wrtSection('Activity');

wrtSection('FileFooter');

rc = wrtHtmlToStmf('report.xml' : 1208);

*inlr = *on;
/end-free


On 8/13/2014 11:07 AM, Henrik Rützou wrote:
Debbie

It may be easier for you to make XML with inline code/subprocedures like
used in powerEXT Core,
to make Vernons example here is the complete code (Vernon is missing the
RPG part:

/free
clearSrvPgm();
setContent('*none');

echo('<?xml version="1.0" encoding="UTF-8"?>');
echo('<!DOCTYPE activity_import_file SYSTEM "activity.dtd">');

xmlNode('activity_import_file');

xmlNode('activity');
xmlNode('custno':'':%char(custno);
xmlNode('actvdate':'':%char(actdate);
xmlNode('actvtime':'':%char(acttime);
xmlNode('history':'':histdata);
xmlEndNode(); // ends activity

xmlEndNode(); // ends activity_import_file

echoToStmf('/testfile.xml':1208);
*inlr = *on;
/end-Free








Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2014 by MIDRANGE dot 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 here. If you have questions about this, please contact