* CREATES OEDIDOC OBJECT oEdiDoc = createobject("fredi.ediDocument") * THIS MAKES CERTAIN THAT FREDI ONLY USES THE SEF FILE PROVIDED, AND THAT IT DOES * NOT USE ITS BUILT-IN STANDARD REFERENCE TABLE TO GENERATE THE EDI FILE. oSchemas = oEdiDoc.GetSchemas oSchemas.EnableStandardReference = .F. * ENABLES FORWARD WRITE, AND INCREASES BUFFER I/O TO IMPROVE PERFORMANCE oEdiDoc.CursorType = 2 oEdiDoc.Property(1002) = 200 * LOADS THE SEF FILE oSchema = oEdiDoc.LoadSchema("ORDERS_D96A.SEF", 0) * GETS TERMINATORS oEdiDoc.SegmentTerminator = "'" oEdiDoc.ElementTerminator = "+" oEdiDoc.CompositeTerminator = ":" oEdiDoc.ReleaseIndicator = "?" * CREATES THE UNB SEGMENT oInterchange = oEdiDoc.CreateInterchange("UN","D96A") oSegment = oInterchange.GetDataSegmentHeader oSegment.DataElementValue(1,1) = "UNOA" && Syntax identifier oSegment.DataElementValue(1,2) = "1" && Syntax version number oSegment.DataElementValue(2,1) = "EDIASD" && Interchange sender identification oSegment.DataElementValue(2,2) = "ZZZ" && Partner identification code qualifier oSegment.DataElementValue(3,1) = "EDITRCK" && Recipient identification oSegment.DataElementValue(3,2) = "ZZZ" && Partner identification code qualifier oSegment.DataElementValue(4,1) = "030407" && Date oSegment.DataElementValue(4,2) = "1204" && Time oSegment.DataElementValue(5) = "2451840" && Interchange control reference * CREATES THE UNH SEGMENT oTransactionset = oInterchange.CreateTransactionSet("ORDERS") oSegment = oTransactionset.GetDataSegmentHeader oSegment.DataElementValue(1) = "00001" && Message reference number oSegment.DataElementValue(2,1) = "ORDERS" && Message type identifier oSegment.DataElementValue(2,2) = "D" && Message version number oSegment.DataElementValue(2,3) = "96A" && Message release number oSegment.DataElementValue(2,4) = "UN" && Controlling agency * BGM - BEGINNING OF MESSAGE oSegment = oTransactionset.CreateDataSegment("BGM") oSegment.DataElementValue(1,1) = "1" && Document/message name, coded oSegment.DataElementValue(1,3) = "9" && Code list responsible agency, coded oSegment.DataElementValue(2) = "03134" && Document/message number oSegment.DataElementValue(3) = "9" && Message function, coded * DTM - DATE/TIME/PERIOD oSegment = oTransactionset.CreateDataSegment("DTM") oSegment.DataElementValue(1,1) = "2" && Date/time/period qualifier oSegment.DataElementValue(1,2) = "0" && Date/time/period oSegment.DataElementValue(1,3) = "805" && Date/time/period format qualifier * DTM - DATE/TIME/PERIOD oSegment = oTransactionset.CreateDataSegment("DTM(2)") oSegment.DataElementValue(1,1) = "137" && Date/time/period qualifier oSegment.DataElementValue(1,2) = "200304071204" && Date/time/period oSegment.DataElementValue(1,3) = "203" && Date/time/period format qualifier * DTM - DATE/TIME/PERIOD oSegment = oTransactionset.CreateDataSegment("DTM(3)") oSegment.DataElementValue(1,1) = "1" && Date/time/period qualifier oSegment.DataElementValue(1,2) = "200304080400200304090400" && Date/time/period oSegment.DataElementValue(1,3) = "719" && Date/time/period format qualifier * RFF - REFERENCE oSegment = oTransactionset.CreateDataSegment("RFF\RFF") oSegment.DataElementValue(1,1) = "AHI" && Reference qualifier oSegment.DataElementValue(1,2) = "RWE001" && Reference number * NAD - NAME AND ADDRESS oSegment = oTransactionset.CreateDataSegment("NAD\NAD") oSegment.DataElementValue(1) = "ZSH" && Party qualifier oSegment.DataElementValue(2,1) = "TRCKRWE" && Party identification oSegment.DataElementValue(2,3) = "9" && Code list responsible agency, coded * NAD - NAME AND ADDRESS oSegment = oTransactionset.CreateDataSegment("NAD(2)\NAD") oSegment.DataElementValue(1) = "ZZZ" && Party qualifier oSegment.DataElementValue(2,1) = "TRCK" && Party identification oSegment.DataElementValue(2,3) = "9" && Code list responsible agency, coded * TDT - DETAILS OF TRANSPORT oSegment = oTransactionset.CreateDataSegment("TDT\TDT") oSegment.DataElementValue(1) = "41G" && Transport stage qualifier oSegment.DataElementValue(3,1) = "70" && Mode of transport, coded * LOC - PLACE/LOCATION IDENTIFICATION oSegment = oTransactionset.CreateDataSegment("TDT\LOC\LOC") oSegment.DataElementValue(1) = "7" && Place/location qualifier oSegment.DataElementValue(2,4) = "TTFH" && Place/location * LIN - LINE ITEM oSegment = oTransactionset.CreateDataSegment("LIN\LIN") oSegment.DataElementValue(1) = "1" && Line item number * LOC - PLACE/LOCATION IDENTIFICATION oSegment = oTransactionset.CreateDataSegment("LIN\LOC\LOC") oSegment.DataElementValue(1) = "11" && Place/location qualifier * QTY - QUANTITY oSegment = oTransactionset.CreateDataSegment("LIN\LOC\QTY") oSegment.DataElementValue(1,1) = "2" && Quantity qualifier oSegment.DataElementValue(1,2) = "123456" && Quantity oSegment.DataElementValue(1,3) = "JM1" && Measure unit qualifier * DTM - DATE/TIME/PERIOD oSegment = oTransactionset.CreateDataSegment("LIN\LOC\DTM") oSegment.DataElementValue(1,1) = "2" && Date/time/period qualifier oSegment.DataElementValue(1,2) = "200304080400200304080600" && Date/time/period oSegment.DataElementValue(1,3) = "719" && Date/time/period format qualifier * LOC - PLACE/LOCATION IDENTIFICATION oSegment = oTransactionset.CreateDataSegment("LIN\LOC(2)\LOC") oSegment.DataElementValue(1) = "11" && Place/location qualifier * QTY - QUANTITY oSegment = oTransactionset.CreateDataSegment("LIN\LOC(2)\QTY") oSegment.DataElementValue(1,1) = "2" && Quantity qualifier oSegment.DataElementValue(1,2) = "-123456" && Quantity oSegment.DataElementValue(1,3) = "JM1" && Measure unit qualifier * DTM - DATE/TIME/PERIOD oSegment = oTransactionset.CreateDataSegment("LIN\LOC(2)\DTM") oSegment.DataElementValue(1,1) = "2" && Date/time/period qualifier oSegment.DataElementValue(1,2) = "200304080600200304080800" && Date/time/period oSegment.DataElementValue(1,3) = "719" && Date/time/period format qualifier * LOC - PLACE/LOCATION IDENTIFICATION oSegment = oTransactionset.CreateDataSegment("LIN\LOC(3)\LOC") oSegment.DataElementValue(1) = "11" && Place/location qualifier * QTY - QUANTITY oSegment = oTransactionset.CreateDataSegment("LIN\LOC(3)\QTY") oSegment.DataElementValue(1,1) = "2" && Quantity qualifier oSegment.DataElementValue(1,2) = "0" && Quantity oSegment.DataElementValue(1,3) = "JM1" && Measure unit qualifier * DTM - DATE/TIME/PERIOD oSegment = oTransactionset.CreateDataSegment("LIN\LOC(3)\DTM") oSegment.DataElementValue(1,1) = "2" && Date/time/period qualifier oSegment.DataElementValue(1,2) = "200304080800200304081000" && Date/time/period oSegment.DataElementValue(1,3) = "719" && Date/time/period format qualifier * LOC - PLACE/LOCATION IDENTIFICATION oSegment = oTransactionset.CreateDataSegment("LIN\LOC(4)\LOC") oSegment.DataElementValue(1) = "11" && Place/location qualifier * QTY - QUANTITY oSegment = oTransactionset.CreateDataSegment("LIN\LOC(4)\QTY") oSegment.DataElementValue(1,1) = "2" && Quantity qualifier oSegment.DataElementValue(1,2) = "52301" && Quantity oSegment.DataElementValue(1,3) = "JM1" && Measure unit qualifier * DTM - DATE/TIME/PERIOD oSegment = oTransactionset.CreateDataSegment("LIN\LOC(4)\DTM") oSegment.DataElementValue(1,1) = "2" && Date/time/period qualifier oSegment.DataElementValue(1,2) = "200304081000200304081100" && Date/time/period oSegment.DataElementValue(1,3) = "719" && Date/time/period format qualifier * LOC - PLACE/LOCATION IDENTIFICATION oSegment = oTransactionset.CreateDataSegment("LIN\LOC(5)\LOC") oSegment.DataElementValue(1) = "11" && Place/location qualifier * QTY - QUANTITY oSegment = oTransactionset.CreateDataSegment("LIN\LOC(5)\QTY") oSegment.DataElementValue(1,1) = "2" && Quantity qualifier oSegment.DataElementValue(1,2) = "55324" && Quantity oSegment.DataElementValue(1,3) = "JM1" && Measure unit qualifier * DTM - DATE/TIME/PERIOD oSegment = oTransactionset.CreateDataSegment("LIN\LOC(5)\DTM") oSegment.DataElementValue(1,1) = "2" && Date/time/period qualifier oSegment.DataElementValue(1,2) = "200304081100200304081600" && Date/time/period oSegment.DataElementValue(1,3) = "719" && Date/time/period format qualifier * LOC - PLACE/LOCATION IDENTIFICATION oSegment = oTransactionset.CreateDataSegment("LIN\LOC(6)\LOC") oSegment.DataElementValue(1) = "11" && Place/location qualifier * QTY - QUANTITY oSegment = oTransactionset.CreateDataSegment("LIN\LOC(6)\QTY") oSegment.DataElementValue(1,1) = "2" && Quantity qualifier oSegment.DataElementValue(1,2) = "-12056" && Quantity oSegment.DataElementValue(1,3) = "JM1" && Measure unit qualifier * DTM - DATE/TIME/PERIOD oSegment = oTransactionset.CreateDataSegment("LIN\LOC(6)\DTM") oSegment.DataElementValue(1,1) = "2" && Date/time/period qualifier oSegment.DataElementValue(1,2) = "200304081600200304081900" && Date/time/period oSegment.DataElementValue(1,3) = "719" && Date/time/period format qualifier * LOC - PLACE/LOCATION IDENTIFICATION oSegment = oTransactionset.CreateDataSegment("LIN\LOC(7)\LOC") oSegment.DataElementValue(1) = "11" && Place/location qualifier * QTY - QUANTITY oSegment = oTransactionset.CreateDataSegment("LIN\LOC(7)\QTY") oSegment.DataElementValue(1,1) = "2" && Quantity qualifier oSegment.DataElementValue(1,2) = "0" && Quantity oSegment.DataElementValue(1,3) = "JM1" && Measure unit qualifier * DTM - DATE/TIME/PERIOD oSegment = oTransactionset.CreateDataSegment("LIN\LOC(7)\DTM") oSegment.DataElementValue(1,1) = "2" && Date/time/period qualifier oSegment.DataElementValue(1,2) = "200304081900200304082300" && Date/time/period oSegment.DataElementValue(1,3) = "719" && Date/time/period format qualifier * LOC - PLACE/LOCATION IDENTIFICATION oSegment = oTransactionset.CreateDataSegment("LIN\LOC(8)\LOC") oSegment.DataElementValue(1) = "11" && Place/location qualifier * QTY - QUANTITY oSegment = oTransactionset.CreateDataSegment("LIN\LOC(8)\QTY") oSegment.DataElementValue(1,1) = "2" && Quantity qualifier oSegment.DataElementValue(1,2) = "5587" && Quantity oSegment.DataElementValue(1,3) = "JM1" && Measure unit qualifier * DTM - DATE/TIME/PERIOD oSegment = oTransactionset.CreateDataSegment("LIN\LOC(8)\DTM") oSegment.DataElementValue(1,1) = "2" && Date/time/period qualifier oSegment.DataElementValue(1,2) = "200304082300200304090400" && Date/time/period oSegment.DataElementValue(1,3) = "719" && Date/time/period format qualifier * NAD - NAME AND ADDRESS oSegment = oTransactionset.CreateDataSegment("LIN\NAD\NAD") oSegment.DataElementValue(1) = "AA" && Party qualifier oSegment.DataElementValue(2,1) = "TRCK" && Party identification oSegment.DataElementValue(2,3) = "9" && Code list responsible agency, coded * UNS - SECTION CONTROL oSegment = oTransactionset.CreateDataSegment("UNS") oSegment.DataElementValue(1) = "S" && Section identification * TRAILING SEGMENTS ARE AUTOMATICALLY CREATED WHEN FREDI COMMITS (SAVES) THE EDIDOC OBJECT INTO A FILE. oEdiDoc.Save("ORDERS_D96A.EDI",0)