MIDRANGE dot COM Mailing List Archive



Home » MIDRANGE-L » August 2014

Re: AS400 DB to XML



fixed

Henrik

Thank you for this explanation - I'll definitely be looking at this more in the future. I do understand from the work I've done both with HTML and XML that the template approach has limitations or weaknesses - the node approach is, as I think I said, lets you see the structure better in your code than the templates do.


Debbie definitely should look at that IBM modernization guide Redbook!

Cheers
Vern

On 8/14/2014 4:54 PM, Henrik Rützou wrote:
Vernon,



You are completely correct, powerEXT Core is built on top of a special
version of CGIDEV2 and shares I/O buffers with CGIDEV2.



The reason for that is historical. I have used CGIDEV2 since 2002 and have
a lot of systems running based on CGIDEV2 that had to be rewritten if
powerEXT Core hasn’t been built on CGIDEV2.



So the goal was to be able to run in a mixed environment so powerEXT Core
could be used either as a standalone service program on top of CGIDEV2 or
side by side as an enhancement to the existing CGIDEV2 environment.



-snip- remainder can be found in archives
When all this is said, I find it strange that nobody points Debbie to the
newly released ‘IBM Modernization Guide’ where Jon has made a section on
how to make XML in various ways in RPG.


On Wed, Aug 13, 2014 at 8:29 PM, Vernon Hamberg <vhamberg@xxxxxxxxxxxxxxx>
wrote:

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



--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.









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