× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi,

would it be an idear if I wrote a subprocedure under powerEXT Core that is
able to convert EDI (ANSI X.12 and EDIfact) to XML?

It would be based on a XML document that describes the EDI document and then
the EDI file itself. The subprocedure would then do a basic syntax check and
a conversion to XML and the XML file could then be processed by any XML
reader.

ediDesc =

<envelope>
<interchange>
<segment id="ISA" type="M" max="1" />
</interchange>
<group>
<segment id="GS" type="O" max="1" />
</group>
<message name="invoice">
<segment id="ST" type="M" max="1" />
<segment id="B3" type="O" max="1" />
<segment id="K1" type="O" max="12" />
<Loop0100 max="200" />
<segment id="N1" type="O" max="1" name="NameSegment" />
<segment id="L11" type="O" max="12" />
</Loop0100>
</message>
</envelope>


ediData =

ST*210*340001\
N1*CN*CONSIGNEE NAME*25*177835\


rc = ediToXML(ediDataAddr:ediDataSize:'X12':ediDescAddr:ediDescSize);

Result with Description =

<invoice>
<ST>
<ST01>210</ST01>
<ST02>340001</ST02>
</ST>
<Loop0100>
<NameSegment id="N1">
<N101>CN</N101>
<N102>CONSIGNEE NAME</N102>
<N103>25</N103>
<N104>177835</N104>
</NameSegment>
</Loop0100>
</invoice>

Result without Description =

<edi>
<ST>
<ST01>210</ST01>
<ST02>340001</ST02>
</ST>
<N1>
<N101>CN</N101>
<N102>CONSIGNEE NAME</N102>
<N103>25</N103>
<N104>177835</N104>
</N1>
</edi>

Writing raw EDI as nodes and with node/encode support:

ediNode('':'ST');
ediNode('*':'210');
ediNode('*':'3400001');
ediEndNode('\');

Result:

ST*210*340001\

Coding example - Generate a XML-file:

setContent('*none');
ediDesc = storeNew();
storeFromStmf(ediDesc:'/myEdiDesciption.xml');
ediData = StoreNew();
storeFromStmf(ediData:'/myEdi.x12');
rc = ediToXML(storeAddr(ediData)
:storeSize(ediData)
:'X12'
:storeAddr(ediDesc)
:storeSize(ediDesc));
if rc <> 0;
dsply 'EDI conversion error';
endif;
echoToStmf('/myEdi.xml':1208);
storeFree(ediDesc);
storeFree(ediData);


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.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 on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.