Rod Pope
2008-10-24 19:34:12 UTC
I am attempting to add Electronic Data Interchange (EDI) capabilities to an existing purchase order, invoicing and shipping application. EDI specs provide detailed requirements for the interchange message (reminds me too much of the old teletype days). The messages are sent through Value Added Networks (VAN) similar to e-mail.
I have been successful in receiving EDI purchase orders (PO), parsing them with CASE statements and sending back a Functional Acknowledgment (FA) message in reply.
My problem is that the message "buffer" needs to be a continuous stream, with no intervening carriage returns, line feeds, etc. Using the following code snippet with multiple streaming operators leaves an extra carriage return (x0D) after each segment.
------------------------
* Following code builds a Functional Acknowledgment (FA) EDI file to be sent to True Value
clear
SET ALTERNATE TO "C:\FILE_FROM_MULTIPLE_LINES.TXT"
SET ALTERNATE ON
??"ISA*00* *00* *01*058006875 *14*006929681100 *"+SUBSTR(FADATE,3,6)+"*"+FATIME+"*U*00401*"+STR(memory->ISA_CN,9,0,"0")
??"*0*P*>~GS*FA*058006875*006929681100*"+FADATE+"*"+FATIME+"*"+STR(memory->GROUP_CN,9,0,"0")+"*X*004010~ST*997*"
??STR(memory->GROUP_CN,9,0,"0")+"~AK1*PO*"-GS06+"~AK9*A*1*1*1~SE*4*"+STR(memory->GROUP_CN,9,0,"0")
??"~GE*1*"+STR(memory->GROUP_CN,9,0,"0")+"~IEA*1*"+STR(memory->ISA_CN,9,0,"0")+"~"
SET ALTERNATE OFF
SET ALTERNATE TO
-----------------
I have gotten around this for the FA's by just making one big stream behind one operator. However, I now need to automate two new message streams, one for an Advanced Ship Notice (ASN) and one for the Invoice. These messages can have multiple line items based on the received PO and I need to loop in the code to generate them, causing multiple streaming operators and hence the unwanted carriage returns.
If the streaming operator (??) is designed to continue where the previous one left off (which works for a real printer), why the added character when I "print" to a file?
How do I get around this?
Thanks,
Rod
I have been successful in receiving EDI purchase orders (PO), parsing them with CASE statements and sending back a Functional Acknowledgment (FA) message in reply.
My problem is that the message "buffer" needs to be a continuous stream, with no intervening carriage returns, line feeds, etc. Using the following code snippet with multiple streaming operators leaves an extra carriage return (x0D) after each segment.
------------------------
* Following code builds a Functional Acknowledgment (FA) EDI file to be sent to True Value
clear
SET ALTERNATE TO "C:\FILE_FROM_MULTIPLE_LINES.TXT"
SET ALTERNATE ON
??"ISA*00* *00* *01*058006875 *14*006929681100 *"+SUBSTR(FADATE,3,6)+"*"+FATIME+"*U*00401*"+STR(memory->ISA_CN,9,0,"0")
??"*0*P*>~GS*FA*058006875*006929681100*"+FADATE+"*"+FATIME+"*"+STR(memory->GROUP_CN,9,0,"0")+"*X*004010~ST*997*"
??STR(memory->GROUP_CN,9,0,"0")+"~AK1*PO*"-GS06+"~AK9*A*1*1*1~SE*4*"+STR(memory->GROUP_CN,9,0,"0")
??"~GE*1*"+STR(memory->GROUP_CN,9,0,"0")+"~IEA*1*"+STR(memory->ISA_CN,9,0,"0")+"~"
SET ALTERNATE OFF
SET ALTERNATE TO
-----------------
I have gotten around this for the FA's by just making one big stream behind one operator. However, I now need to automate two new message streams, one for an Advanced Ship Notice (ASN) and one for the Invoice. These messages can have multiple line items based on the received PO and I need to loop in the code to generate them, causing multiple streaming operators and hence the unwanted carriage returns.
If the streaming operator (??) is designed to continue where the previous one left off (which works for a real printer), why the added character when I "print" to a file?
How do I get around this?
Thanks,
Rod