Solved

XML Translator Recommendation

Posted on 2004-10-27
552 Views
Last Modified: 2008-01-09
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
0
Question by:kevinecaldwell
    8 Comments
     
    LVL 14

    Expert Comment

    by:daveslater
    Hi
    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
    0
     
    LVL 32

    Expert Comment

    by:shalomc
    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
    0
     
    LVL 16

    Expert Comment

    by:theo kouwenhoven
    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.




    0
     
    LVL 4

    Expert Comment

    by:reginab
    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.
    0
     
    LVL 32

    Expert Comment

    by:shalomc

    /* 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:/xml/xalan_1_0_1+
    /xerces.jar:. + org.apache.xalan.xslt.Process ' *BCAT +
    '-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/lib/xalan101.jar:/+
    QIBM/ProdData/OS400/xml/lib/xerces103.jar:. +
    org.apache.xalan.xslt.Process ' *BCAT +
    '-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</LAST_UPDATE>
    <CURRENCY>
    <NAME>dollar</NAME>
    <UNIT>1</UNIT>
    <CURRENCYCODE>USD</CURRENCYCODE>
    <COUNTRY>USA</COUNTRY>
    <RATE>4.437</RATE>
    <CHANGE>-0.292</CHANGE>
    </CURRENCY>
    <CURRENCY>
    <NAME>pound</NAME>
    <UNIT>1</UNIT>
    <CURRENCYCODE>GBP</CURRENCYCODE>
    <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_UPDATE"/>  
    <xsl:value-of select="concat(substring($dt,1,4), substring($dt,6,2), substring($dt,9,2))"/>  
     <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
    0
     
    LVL 14

    Expert Comment

    by:daveslater
    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?
    0
     
    LVL 32

    Accepted Solution

    by:
    For a small fee of a couple of hundred points I'll let you in on it [:={)]
    0
     

    Expert Comment

    by:midwestexp
    Hi shalomc  you are simply Supperrrrrrrrrrr,
    WOW ..........Brilliant , Sparkling man .............

    midwestexp.
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    The Complete Ruby on Rails Developer Course

    Ruby on Rails is one of the most popular web development frameworks, and a useful tool used by both startups and more established companies to build strong graphic user interfaces, and responsive websites and apps.

    Ransomware continues to be a growing problem for both personal and business users alike and Antivirus companies are still struggling to find a reliable way to protect you from this dangerous threat.
    SSL stands for “Secure Sockets Layer” and an SSL certificate is a critical component to keeping your website safe, secured, and compliant. Any ecommerce website must have an SSL certificate to ensure the safe handling of sensitive information like…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    This video discusses moving either the default database or any database to a new volume.

    934 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now