RequirementsThis utility converts an X12 interchange containing one or more functional groups, each containing one or more transaction sets, into XML instance documents. An instance document is created for each transaction set. Here's a summary of the required functionality.
You may recall my earlier comment that I would focus primarily on the basic functionality required in most trading situations. Although Functional Acknowledgments are capable of reporting syntax errors, they are most often used only as return receipts and are required in most trading situations. Functional Acknowledgments are clearly beyond the scope of file format conversion, but for this utility to meet the minimum requirements for most trading situations we must be able to generate them. Note, however, that we will generate them only to indicate acceptance (that is, receipt) of a group and not to report errors. Running the UtilityThis section provides instructions for running the X12 to XML utility from the command line. For Java:
or
For C++ on Win32:
or
Options follow the parameters except for the help option, which may be specified by itself. Parameters:
Options:
Naming requirement for file description documents: File description documents used with this utility must conform to a specific naming convention for their local file names. Their names must be formed by concatenating the following values:
( Note : Some values of GS Version/Release, such as those sometimes used for TDCC or UCS versions, may not yield valid file names for the operating system.) As an example of the naming convention, suppose we receive an interchange from Big Box Discount Stores that contains 850 Purchase Orders in version 004010 of X12. Suppose they use BIGBOX for the sender ID in the GS segment. The X12ToXML utility will look in the passed directory for a file description document named: BIGBOX-PO-850-004010.xml A version 1.0 Babel Blaster requirement is to remove this naming restriction, but it's not a bad convention to follow anyway. Naming convention for Functional Acknowledgments: An XML representation of an X12 997 Functional Acknowledgment is created for each functional group the utility processes. The files for these XML documents are placed in an FA_Out subdirectory of the passed directory. Individual acknowledgments are named by concatenating the following values:
For example, the Functional Acknowledgment for Big Box Discount Stores purchase orders on a UNIX system would be named: FA_Out/BIGBOXBUYER-PO.xml Restrictions: Unless otherwise noted, all numeric limits may be modified by changing parameters in the program source and appropriate type definitions in the file description document schemas.
Sample Input and Output: 850 Purchase OrderBig Daddy's Gourmet Cocoa has hit the big time! The company is now selling to major retail grocery and discount chains, and they all want to send their orders as X12 850 Purchase Orders. Of course, they all have slightly different implementation guides, but Table 9.1 shows an abbreviated summary of a fairly representative guide. Note : The Segment Group column is empty if the segment is not part of a segment group. The BEG and a few other header level segments fall into this category. You'll note a few things about this sample implementation. Only the N1 segment is transmitted; there isn't a full N1 loop. It is becoming increasingly common to use identifiers such as DUNS or DUNS+4 numbers to reference a location or party already in the system rather than transmitting full address information. The PO1 segment has only a single product code, though sometimes more than one is sent (I assume as a convenience and crosscheck for the vendor). Overall, this is a fairly compact implementation of the 850 Purchase Order. The sample interchange below shows one functional group with two transaction sets. Sample Input Interchange (PurchaseOrders.X12)ISA*00* *00* *ZZ*BIGBOX *12* 9727839573 *030123*0600*U*00401*000000357*0*P*>~ GS*PO*BIGBOX*9727839573*20030123*0600*114*X*004010~ ST*850*0001~ BEG*00*SA*4497-0561**20030123~ DTM*001*20030206~ N1*ST*BIG BOX - STORE #97*92*001234567S097~ PO1*1*10*CA*30.36**UP*35790000122~ PID*F****Instant Hot Cocoa Mix - Mint flavor~ PO1*2*30*CA*31.08**UP*35790000724~ PID*F****Instant Hot Cocoa Mix - Vanilla flavor~ CTT*2~ SE*10*0001~ ST*850*0002~ BEG*00*SA*4445-0323**20030123~ DTM*001*20030206~ N1*ST*BIG BOX - STORE #45*92*001234567S045~ PO1*1*20*CA*30.36**UP*35790000122~ PID*F****Instant Hot Cocoa Mix - Mint flavor~ PO1*2*40*CA*31.08**UP*35790000641~ PID*F****Instant Hot Cocoa Mix - Dutch Chocolate flavor~ CTT*2~ SE*10*0002~ GE*2*114~ IEA*1*000000357~ Table 9.1. Sample X12 850 Purchase Order Implementation Guide
The line breaks (and indentation on the continuation of the ISA segment) exist here only for readability. They would not appear in a compliant data stream. Listed below are the two XML documents produced by the utility from this interchange. This and the XMLToX12 utility allow the user to specify the choice of names for the Elements that represent the various X12 components . I use a convention based on segment IDs and data element position. You could use more descriptive English names if you prefer. Sample Output (X12PurchaseOrder0001.xml)<?xml version="1.0" encoding="UTF-8"?> <X12PurchaseOrder xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="X12PurchaseOrder.xsd"> <BEG> <BEG01>00</BEG01> <BEG02>SA</BEG02> <BEG03>4497-0561</BEG03> <BEG05>2003-01-23</BEG05> </BEG> <DTM> <DTM01>001</DTM01> <DTM02>2003-02-06</DTM02> </DTM> <N1Header> <N1> <N101>ST</N101> <N102>BIG BOX - STORE #97</N102> <N103>92</N103> <N104>001234567S097</N104> </N1> </N1Header> <PO1Group> <PO1> <PO101>1</PO101> <PO102>10</PO102> <PO103>CA</PO103> <PO104>30.36</PO104> <PO106>UP</PO106> <PO107>35790000122</PO107> </PO1> <PID> <PID01>F</PID01> <PID05>Instant Hot Cocoa Mix - Mint flavor</PID05> </PID> </PO1Group> <PO1Group> <PO1> <PO101>2</PO101> <PO102>30</PO102> <PO103>CA</PO103> <PO104>31.08</PO104> <PO106>UP</PO106> <PO107>35790000724</PO107> </PO1> <PID> <PID01>F</PID01> <PID05>Instant Hot Cocoa Mix - Vanilla flavor</PID05> </PID> </PO1Group> <CTT> <CTT01>2</CTT01> </CTT> </X12PurchaseOrder> Sample Output (X12PurchaseOrder0002.xml)<?xml version="1.0" encoding="UTF-8"?> <X12PurchaseOrder xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="X12PurchaseOrder.xsd"> <BEG> <BEG01>00</BEG01> <BEG02>SA</BEG02> <BEG03>4445-0323</BEG03> <BEG05>2003-01-23</BEG05> </BEG> <DTM> <DTM01>001</DTM01> <DTM02>2003-02-06</DTM02> </DTM> <N1Header> <N1> <N101>ST</N101> <N102>BIG BOX - STORE #45</N102> <N103>92</N103> <N104>001234567S045</N104> </N1> </N1Header> <PO1Group> <PO1> <PO101>1</PO101> <PO102>20</PO102> <PO103>CA</PO103> <PO104>30.36</PO104> <PO106>UP</PO106> <PO107>35790000122</PO107> </PO1> <PID> <PID01>F</PID01> <PID05>Instant Hot Cocoa Mix - Mint flavor</PID05> </PID> </PO1Group> <PO1Group> <PO1> <PO101>2</PO101> <PO102>40</PO102> <PO103>CA</PO103> <PO104>31.08</PO104> <PO106>UP</PO106> <PO107>35790000641</PO107> </PO1> <PID> <PID01>F</PID01> <PID05> Instant Hot Cocoa Mix - Dutch Chocolate flavor </PID05> </PID> </PO1Group> <CTT> <CTT01>2</CTT01> </CTT> </X12PurchaseOrder> |