× 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.



Here is a simple EDI/X12 reader without the need for EDI software:


/copy qsrc,pxapihdr General H-Spec's

* powerEXT Service Program Connector
/copy qsrc,pxapicgicn Basic HTTP connecter & Productivity Services

* Declare Internal Variables
d data s 65535a varying

d segment s 3a varying
d dsp s 52a varying

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

data = 'ISA*00* *00* *ZZ*SENDER *ZZ*RECEIVER'
+ '*140102*1141*U*00400*000047073*0*P**~'
+ 'GS*FA*RECEIVERID*SENDERID*20100325*1113*24712*X*004030~'
+ 'ST*997*1136~'
+ 'AK1*PO*142~'
+ 'AK2*850*0142~'
+ 'AK5*A~'
+ 'AK9*A*1*1*1~'
+ 'SE*6*1136~'
+ 'GE*1*24712~'
+ 'IEA*1*000011436~';

data = %xlate('~':x'25':data);

csvToXml(%addr(data)+2:%len(data):'*');

// SAVING THE XML (IF NEEDED)
echoToStmf('/x12xml.txt':1208);

// READING THE XML X12
xmlReaderInz(bufAddr:bufSize);

dow xmlReader = 0;
select;

// get the Segment you are in
when xmlGetNode = 'column1' and xmlGetAttr = '';
segment = xmlGetData;

// get sender out of ISA
when segment = 'ISA'
and xmlGetNode = 'column7' and xmlGetAttr = '';
dsp = xmlGetData;
dsply dsp;

// get 0142 out of AK2
when segment = 'AK2'
and xmlGetNode = 'column3' and xmlGetAttr = '';
dsp = xmlGetData;
dsply dsp;

// Process data at end of segment
when segment = 'AK2'
and xmlGetNode = '/row';
dsply 'you are now at end of AK2';

endsl;
enddo;

*inlr = *on;
/end-free
<row rrn="1">
<column1>ISA</column1>
<column2>00</column2>
<column3></column3>
<column4>00</column4>
<column5></column5>
<column6>ZZ</column6>
<column7>SENDER</column7>
<column8>ZZ</column8>
<column9>RECEIVER</column9>
<column10>140102</column10>
<column11>1141</column11>
<column12>U</column12>
<column13>00400</column13>
<column14>000047073</column14>
<column15>0</column15>
<column16>P</column16>
<column17 />
</row>
<row rrn="2">
<column1>GS</column1>
<column2>FA</column2>
<column3>RECEIVERID</column3>
<column4>SENDERID</column4>
<column5>20100325</column5>
<column6>1113</column6>
<column7>24712</column7>
<column8>X</column8>
<column9>004030</column9>
</row>
<row rrn="3">
<column1>ST</column1>
<column2>997</column2>
<column3>1136</column3>
</row>
<row rrn="4">
<column1>AK1</column1>
<column2>PO</column2>
<column3>142</column3>
</row>
<row rrn="5">
<column1>AK2</column1>
<column2>850</column2>
<column3>0142</column3>
</row>
<row rrn="6">
<column1>AK5</column1>
<column2>A</column2>
</row>
<row rrn="7">
<column1>AK9</column1>
<column2>A</column2>
<column3>1</column3>
<column4>1</column4>
<column5>1</column5>
</row>
<row rrn="8">
<column1>SE</column1>
<column2>6</column2>
<column3>1136</column3>
</row>
<row rrn="9">
<column1>GE</column1>
<column2>1</column2>
<column3>24712</column3>
</row>
<row rrn="10">
<column1>IEA</column1>
<column2>1</column2>
<column3>000011436</column3>
</row>

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.