Kevin Caldwell
asked on
XML Translator Recommendation
My company has migrated from a inhouse software system to a webbased software for rental property management. The GL data they are creating from the transactions is in XML format. I need to get that XML data into GL entries which is still on the AS400. What is the best way to do that, with the least cost regarding software. My idea is to have standalone PC talking to this web program that will export data on a given time. A transfer would then happen, transferring the data from the PC to the AS400. An XML translator would then kick off translating the data into an AS400 Physical file. A call would then occur to create the GL.
Any better, more efficient ideas? Regarding the XML translator, any recommendations?
Kevin Caldwell
Any better, more efficient ideas? Regarding the XML translator, any recommendations?
Kevin Caldwell
Hey,
The AS400 fully supports Xalan and Xerces, which are the de-facto standard XML parsers in the Java world.
Read about it in my article http://search400.techtarget.com/tip/0,289483,sid3_gci858495,00.html
If you have any problems with this site I'll repost it here.
ShalomC
The AS400 fully supports Xalan and Xerces, which are the de-facto standard XML parsers in the Java world.
Read about it in my article http://search400.techtarget.com/tip/0,289483,sid3_gci858495,00.html
If you have any problems with this site I'll repost it here.
ShalomC
Please check this out:
http://www.datamission.co.uk/dwnlds.html
http://www.alltel.net/%7Ecraigru/jcrdown2.html#XMLGEN_tag
http://www.alltel.net/%7Ecraigru/jcrdown2.html#XMLPREVIEW_tag
The first link contains a lot of info and free tools (XML)
the other two contains free sources also, but I didn't investigate in detail.
http://www.datamission.co.uk/dwnlds.html
http://www.alltel.net/%7Ecraigru/jcrdown2.html#XMLGEN_tag
http://www.alltel.net/%7Ecraigru/jcrdown2.html#XMLPREVIEW_tag
The first link contains a lot of info and free tools (XML)
the other two contains free sources also, but I didn't investigate in detail.
we have done this with the xerces at a company I worked for in the past, there was wrapper code on the 400, we wrote that, and bridge code on the java side, not really sure there is a cheap way though, though cost is probably very dependent on the size of what you are doing and we were working with enourmous scope sounds like you are not. good luck.
/* CRTCMD CMD(XALAN) PGM(*LIBL/XALANCPP) ... */
CMD PROMPT('Translate XML using XSLT')
PARM KWD(XML) TYPE(*PNAME) LEN(256) MIN(1) +
CASE(*MIXED) PROMPT('Full XML file path')
PARM KWD(XSL) TYPE(*PNAME) LEN(256) MIN(1) +
CASE(*MIXED) PROMPT('Full XSL file path')
PARM KWD(out) TYPE(*PNAME) LEN(256) MIN(1) +
CASE(*MIXED) PROMPT('Full Result file path')
PARM KWD(CCSID) TYPE(*CHAR) LEN(7) PROMPT('CCSID +
of result file')
PARM KWD(VER) TYPE(*CHAR) LEN(7) RSTD(*YES) +
DFT(V5R1M0) VALUES(V5R1M0 V5R2M0 *PRV) +
PROMPT('OS400 release')
/* End of Command XALAN */
++++++++++++++++++++++++++
/* Command Processing Program XALANCPP */
PGM PARM(&XML &XSL &OUT &CCSID &VER)
DCL &JAVA *CHAR 1024
DCL &JAVAparm *CHAR 1024
DCL &err_flg *LGL
DCL VAR(&qshell) TYPE(*CHAR) LEN(1024)
DCL VAR(&XML) TYPE(*CHAR) LEN(256)
DCL VAR(&XSL) TYPE(*CHAR) LEN(256)
DCL VAR(&OUT) TYPE(*CHAR) LEN(256)
DCL VAR(&CCSID) TYPE(*CHAR) LEN(7)
DCL VAR(&VER) TYPE(*CHAR) LEN(6)
DCLF QTXTSRC
/* Prepare java call */
IF COND(&VER = '*PRV') THEN(DO)
CHGVAR VAR(&JAVAparm) VALUE( +
'-IN ' *BCAT &XML *BCAT ' -XSL ' *BCAT +
&XSL *BCAT ' -OUT ' *BCAT &OUT *BCAT ' +
-TEXT')
CHGVAR VAR(&JAVA) VALUE('java -classpath +
/xml/xalan_1_0_1/xalan.jar
/xerces.jar:. + org.apache.xalan.xslt.Proc
'-IN ' *BCAT &XML *BCAT ' -XSL ' *BCAT +
&XSL *BCAT ' -OUT ' *BCAT &OUT *BCAT ' +
-TEXT')
enddo
ELSE CMD(DO)
CHGVAR VAR(&JAVAparm) VALUE( +
'-IN ' *BCAT &XML *BCAT ' -XSL ' *BCAT +
&XSL *BCAT ' -OUT ' *BCAT &OUT *BCAT ' +
-TEXT')
CHGVAR VAR(&JAVA) VALUE('java -classpath +
/QIBM/ProdData/OS400/xml/l
QIBM/ProdData/OS400/xml/li
org.apache.xalan.xslt.Proc
'-IN ' *BCAT &xml *BCAT ' -XSL ' *BCAT +
&xsl *BCAT ' -OUT ' *BCAT &out *BCAT ' -TEXT' )
enddo
DLTF FILE(QTEMP/QSHRESP)
MONMSG MSGID(CPF9999) EXEC(DO)
ENDDO
CRTSRCPF FILE(QTEMP/QSHRESP) MBR(*FILE)
OVRDBF FILE(STDOUT) TOFILE(QTEMP/QSHRESP)
STRQSH CMD(&JAVA)
/* Change CCSID of OUT file */
CHGVAR VAR(&QSHELL) VALUE('setccsid' *bcat &ccsid *BCAT &out )
STRQSH CMD(&qshell)
OVRDBF FILE(QTXTSRC) TOFILE(QTEMP/QSHRESP)
LOOP:
RCVF
MONMSG CPF0864 EXEC(GOTO ENDLOOP)
IF COND(&SRCDTA = 'Xalan: was not successful.') +
THEN(DO)
chgvar &err_flg '1'
enddo
SNDPGMMSG MSG(&SRCDTA) TOPGMQ(*SAME)
GOTO LOOP
ENDLOOP:
IF COND(&ERR_FLG = '1') THEN(DO)
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('Error +
in Xalan: look at joblog') MSGTYPE(*DIAG)
enddo
DLTOVR STDOUT
DLTOVR QTXTSRC
EXIT:
RETURN
ENDPGM
/* End of Program XALANCPP */
Sample XML file:
<?xml version="1.0" encoding="iso-8859-8" standalone="yes"?>
<CURRENCIES>
<LAST_UPDATE>2004-11-04</L
<CURRENCY>
<NAME>dollar</NAME>
<UNIT>1</UNIT>
<CURRENCYCODE>USD</CURRENC
<COUNTRY>USA</COUNTRY>
<RATE>4.437</RATE>
<CHANGE>-0.292</CHANGE>
</CURRENCY>
<CURRENCY>
<NAME>pound</NAME>
<UNIT>1</UNIT>
<CURRENCYCODE>GBP</CURRENC
<COUNTRY>Great Britain</COUNTRY>
<RATE>8.1974</RATE>
<CHANGE>-0.059</CHANGE>
</CURRENCY>
</CURRENCIES>
Sample XSL file:
====================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="CURRENCIES">
<xsl:for-each select="CURRENCY">
<xsl:apply-templates select="." />
</xsl:for-each>
</xsl:template>
<xsl:template match="CURRENCY">
<xsl:variable name="dt" select="/CURRENCIES/LAST_U
<xsl:value-of select="concat(substring($
<xsl:text> , </xsl:text>
<xsl:value-of select="NAME"/>
<xsl:text> , </xsl:text>
<xsl:value-of select="UNIT"/>
<xsl:text> , </xsl:text>
<xsl:value-of select="COUNTRY"/>
<xsl:text> , </xsl:text>
<xsl:value-of select="RATE"/>
<xsl:text> , </xsl:text>
<xsl:value-of select="CHANGE"/>
<xsl:text>
</xsl:text>
</xsl:template>
</xsl:stylesheet>
<!-- End of sample XSL -->
The command:
XALAN XML('/gl/currency.xml')
XSL('/gl/conversion.xsl')
OUT('/gl/currency.csv')
CCSID(819)
VER(V5R1M0)
The result:
20041104 , dollar , 1 , USA , 4.437 , -0.292
20041104 , pound , 1 , Great Britain , 8.1974 , -0.059
You can use CPYFRMIMPF to place it in a database.
ShalomC
wow - good stuff - I don't understand it but good stuff
Why doesn't IBM make this easy to access - How many other features are on this box that can it easy for us?
Why doesn't IBM make this easy to access - How many other features are on this box that can it easy for us?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi shalomc you are simply Supperrrrrrrrrrr,
WOW ..........Brilliant , Sparkling man .............
midwestexp.
WOW ..........Brilliant , Sparkling man .............
midwestexp.
First I am not that up to date on this; but I am sure there will be JAVA stuff out there that can do it.
The AS/400 can run Java and have RPGLE programs interface to it.
You many want to look at that route.
Dave