Module: Stupidedi::TransactionSets::FortyTen::Implementations

Defined in:
lib/stupidedi/transaction_sets/004010/implementations.rb,
lib/stupidedi/transaction_sets/004010/implementations/AR943.rb,
lib/stupidedi/transaction_sets/004010/implementations/FA997.rb,
lib/stupidedi/transaction_sets/004010/implementations/GF990.rb,
lib/stupidedi/transaction_sets/004010/implementations/IM210.rb,
lib/stupidedi/transaction_sets/004010/implementations/IN810.rb,
lib/stupidedi/transaction_sets/004010/implementations/OW940.rb,
lib/stupidedi/transaction_sets/004010/implementations/PO850.rb,
lib/stupidedi/transaction_sets/004010/implementations/PS830.rb,
lib/stupidedi/transaction_sets/004010/implementations/QM214.rb,
lib/stupidedi/transaction_sets/004010/implementations/RE944.rb,
lib/stupidedi/transaction_sets/004010/implementations/SH856.rb,
lib/stupidedi/transaction_sets/004010/implementations/SM204.rb,
lib/stupidedi/transaction_sets/004010/implementations/SQ866.rb,
lib/stupidedi/transaction_sets/004010/implementations/SS862.rb,
lib/stupidedi/transaction_sets/004010/implementations/SW945.rb,
lib/stupidedi/transaction_sets/004010/implementations/X091A1-HP835.rb

Defined Under Namespace

Modules: ElementReqs, SegmentReqs, X091A1

Constant Summary collapse

AR943 =
b.build("AR", "943", "Purchase Order",
          d::TableDef.header("Header",
            b::Segment(10, s:: ST, "Transaction Set Header", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Transaction Set Identifier Code", b::Values("943")),
b::Element(e::Required,    "Transaction Set Control Number")),
            b::Segment(20, s::W06, "Warehouse Shipment Identification", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Reporting Code", b::Values("F", "U")),
b::Element(e::Situational, "Depositor Order Number"),
b::Element(e::Situational, "Date"),
b::Element(e::Situational, "Shipment Identification Number"),
b::Element(e::Situational, "Not Used"),
b::Element(e::Situational, "Purchase Order Number")),

            d::LoopDef.build("N1", d::RepeatCount.bounded(200),
b::Segment(140, s:: N1, "Name", r::Situational, d::RepeatCount.bounded(3),
  b::Element(e::Required,    "Entity Identifier Code", b::Values("WH")),
  b::Element(e::Required,    "Name"),
  b::Element(e::Situational, "Identification Code Qualifier", b::Values("91")),
  b::Element(e::Situational, "Identification Code"))),

            b::Segment(110, s::G62, "Date/Time Reference", r::Situational, d::RepeatCount.bounded(2),
b::Element(e::Situational,    "Date Qualifier"),
b::Element(e::Situational,    "Date"),
b::Element(e::Situational, "Time Qualifier"),
b::Element(e::Situational, "Time"),
b::Element(e::Situational, "Time Code")),
            b::Segment(130, s::W27, "Carrier Detail", r::Situational, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Transportation Method/Type Code", b::Values("M", "R")),
b::Element(e::Situational, "Standard Carrier Alpha Code"),
b::Element(e::Situational, "Routing"),
b::Element(e::Situational, "Shipment Method of Payment", b::Values("CC", "PP")),
b::Element(e::Situational, "Equipment Initial"),
b::Element(e::Situational, "Equipment Number"))),

          d::TableDef.header("Detail",
            d::LoopDef.build("W04", d::RepeatCount.bounded(100000),
b::Segment(10, s::W04, "Baseline Item Data", r::Required, d::RepeatCount.bounded(1),
  b::Element(e::Situational, "Item Detail Total"),
  b::Element(e::Situational, "Unit or Basis for Measurement Code", b::Values("CS", "EA", "IP", "PL")),
  b::Element(e::Situational, "U.P.C. Case Code"),
  b::Element(e::Situational, "Product/Service ID Qualifier", b::Values("VN")),
  b::Element(e::Situational, "Product/Service ID"))),

            d::LoopDef.build("N9", d::RepeatCount.bounded(1000),
b::Segment(50, s::N9, "Reference Identification", r::Situational, d::RepeatCount.bounded(1),
  b::Element(e::Required, "Reference Identification Qualifier", b::Values("LI")),
  b::Element(e::Required, "Reference Identification")))),

          d::TableDef.header("Summary",
            b::Segment(10, s::W03, "Total Shipment Information", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Number of Units Shipped"),
b::Element(e::Situational, "Weight"),
b::Element(e::Situational, "Unit or Basis for Measurement Code")),
            b::Segment(30, s::SE, "Transaction Set Trailer", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Number of Included Segments"),
b::Element(e::Required,    "Transaction Set Control Number"))))
FA997 =
b.build("FA", "997", "Response to a Load Tender",
          d::TableDef.header("Heading",
            b::Segment(10, s::ST, "Transaction Set Header", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Transaction Set Identifier Code"),
b::Element(e::Required,    "Transaction Set Control Number")),
            b::Segment(20, s::AK1, "Functional Group Response Header", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Situational, "Functional Identifier Code"),
b::Element(e::Required,    "Group Control Number")),

            d::LoopDef.build("AK2", d::RepeatCount.bounded(999999),
b::Segment(30, s::AK2, "Transaction Set Response Header", r::Situational, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Transaction Set Identifier Code"),
  b::Element(e::Required,    "Transaction Set Control Number")),

d::LoopDef.build("AK3", d::RepeatCount.bounded(999999),
  b::Segment( 40, s::AK3, "Data Segment Note", r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Segment ID Code"),
    b::Element(e::Required,    "Segment Position in Transaction Set"),
    b::Element(e::Situational, "Loop Identifier Code"),
    b::Element(e::Situational, "Segment Syntax Error Code")),
  b::Segment( 50, s::AK4, "Data Element Note", r::Situational, d::RepeatCount.bounded(99),
    b::Element(e::Required,    "Position in Segment",
        b::Element(e::Required,    "Element Position in Segment"),
        b::Element(e::Situational, "Component Data Element Position in Composite")),
    b::Element(e::Situational, "Data Element Reference Number"),
    b::Element(e::Required,    "Data Element Syntax Error Code"),
    b::Element(e::Situational, "Copy of Bad Data Element"))),

b::Segment( 60, s::AK5, "Transaction Set Response Trailer", r::Required, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Transaction Set Acknowledgment Code"),
  b::Element(e::Situational, "Transaction Set Syntax Error Code"),
  b::Element(e::Situational, "Transaction Set Syntax Error Code"),
  b::Element(e::Situational, "Transaction Set Syntax Error Code"),
  b::Element(e::Situational, "Transaction Set Syntax Error Code"),
  b::Element(e::Situational, "Transaction Set Syntax Error Code"))),

            b::Segment( 70, s::AK9, "Functional Group Response Trailer", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Functional Group Acknowledge Code"),
b::Element(e::Required,    "Number of Transaction Sets Included"),
b::Element(e::Required,    "Number of Received Transaction Sets"),
b::Element(e::Required,    "Number of Accepted Transaction Sets"),
b::Element(e::Situational, "Functional Group Syntax Error Code"),
b::Element(e::Situational, "Functional Group Syntax Error Code"),
b::Element(e::Situational, "Functional Group Syntax Error Code"),
b::Element(e::Situational, "Functional Group Syntax Error Code"),
b::Element(e::Situational, "Functional Group Syntax Error Code")),
            b::Segment( 80, s::SE, "Transaction Set Trailer", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Number of Included Segments"),
b::Element(e::Required,    "Transaction Set Control Number"))))
GF990 =
b.build("GF", "990", "Response to a Load Tender",
          d::TableDef.header("Heading",
            b::Segment(10, s::ST, "Transaction Set Header", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Transaction Set Identifier Code", b::Values("990")),
b::Element(e::Required,    "Transaction Set Control Number")),
            b::Segment(20, s::B1, "Beginning Segment for Booking or Pick-up/Delivery", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Situational, "Standard Carrier Alpha Code"),
b::Element(e::Required,    "Shipment Identification Number"),
b::Element(e::Situational, "Date"),
b::Element(e::Situational, "Reservation Action Code")),
            b::Segment(30, s::N9, "Reference Identification", r::Situational, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Reference Identification Qualifier"),
b::Element(e::Situational, "Reference Identification"),
b::Element(e::NotUsed, "Free-form Description"),
b::Element(e::NotUsed, "Date"),
b::Element(e::NotUsed, "Time"),
b::Element(e::NotUsed, "Time Code"),
b::Element(e::NotUsed, "Reference Identifier")),
            b::Segment(60, s::K1, "Remarks", r::Situational, d::RepeatCount.bounded(10),
b::Element(e::Required,    "Free-Form Message"),
b::Element(e::Situational, "Free-Form Message")),
            b::Segment(70, s::SE, "Transaction Set Trailer", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Number of Included Segments"),
b::Element(e::Required,    "Transaction Set Control Number"))))
IM210 =
b.build("IM", "210", "Motor Carrier Freight Details and Invoice",
          d::TableDef.header("Heading",
            b::Segment(10, s::ST, "Transaction Set Header", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Transaction Set Identifier Code", b::Values("210")),
b::Element(e::Required,    "Transaction Set Control Number")),
            b::Segment(20, s::B3, "Beginning Segment for Carrier's Invoice", r::Required, d::RepeatCount.bounded(1),
b::Element(e::NotUsed,     "Shipment Qualifier"),
b::Element(e::Required,    "Invoice Number"),
b::Element(e::Required,    "Shipment Identification Number"),
b::Element(e::Required,    "Shipment Method of Payment"),
b::Element(e::NotUsed,     "Weight Unit Code"),
b::Element(e::Required,    "Date"),
b::Element(e::Required,    "Net Amount Due"),
b::Element(e::Situational, "Correction Indicator"),
b::Element(e::Situational, "Delivery Date"),
b::Element(e::Situational, "Date/Time Qualifier"),
b::Element(e::Required,    "Standard Carrier Alpha Code"),
b::Element(e::Situational, "Date")),
            b::Segment(40, s::C3, "Currency", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Currency Code"),
b::Element(e::Situational, "Exchange Rate"),
b::Element(e::Situational, "Currency Code")),
            b::Segment(60, s::N9, "Reference Identification", r::Situational, d::RepeatCount.bounded(300),
b::Element(e::Required,    "Reference Identification Qualifier"),
b::Element(e::Required,    "Reference Identification"),
b::Element(e::NotUsed,     "Free-form Description"),
b::Element(e::NotUsed,     "Date"),
b::Element(e::NotUsed,     "Time"),
b::Element(e::NotUsed,     "Time Code"),
b::Element(e::NotUsed,     "Reference Identifier")),
            b::Segment(70, s::G62, "Date/Time", r::Situational, d::RepeatCount.bounded(1),
b::Element(e::Situational, "Date Qualifier"),
b::Element(e::Situational, "Date"),
b::Element(e::Situational, "Time Qualifier"),
b::Element(e::Situational, "Time"),
b::Element(e::NotUsed,     "Time Code")),
            b::Segment(80, s::R3, "Route Information - Motor", r::Required, d::RepeatCount.bounded(12),
b::Element(e::Required,    "Standard Carrier Alpha Code"),
b::Element(e::Required,    "Routing Sequence Code"),
b::Element(e::Situational, "City Name"),
b::Element(e::Situational, "Transport Method/Type Code"),
b::Element(e::Situational, "Standard Point Location Code"),
b::Element(e::Situational, "Invoice Number"),
b::Element(e::Situational, "Date"),
b::Element(e::Situational, "Amount"),
b::Element(e::Situational, "Free-form Description")),
            b::Segment(90, s::H3, "Line Item - Quantity and Weight", r::Situational, d::RepeatCount.bounded(6),
b::Element(e::Situational, "Special Handling Code"),
b::Element(e::Situational, "Special Handling Description"),
b::Element(e::Situational, "Protective Service Code"),
b::Element(e::Situational, "Vent Instruction Code Code"),
b::Element(e::Situational, "Tariff Application Code")),

            d::LoopDef.build("0100", d::RepeatCount.bounded(10),
b::Segment(110, s::N1, "Name", r::Situational, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Entity Identifier Code"),
  b::Element(e::Required,    "Name"),
  b::Element(e::Situational, "Identification Code Qualifier"),
  b::Element(e::Situational, "Identification Code"),
  b::Element(e::Situational, "Entity Relation Code"),
  b::Element(e::Situational, "Entity Identifier Code")),
b::Segment(130, s::N3, "Address Information", r::Situational, d::RepeatCount.bounded(2),
  b::Element(e::Situational, "Address Information"),
  b::Element(e::Situational, "Address Information")),
b::Segment(140, s::N4, "Geographic Information", r::Situational, d::RepeatCount.bounded(1),
  b::Element(e::Situational, "City Name"),
  b::Element(e::Situational, "State or Province Code"),
  b::Element(e::Situational, "Postal Code"),
  b::Element(e::Situational, "Country Code"),
  b::Element(e::Situational, "Location Qualifier"),
  b::Element(e::Situational, "Location Identifier")),
b::Segment(150, s::N9, "Reference Identification", r::Situational, d::RepeatCount.bounded(5),
  b::Element(e::Required,    "Reference Identification Qualifier"),
  b::Element(e::Situational, "Reference Identification"),
  b::Element(e::NotUsed,     "Free-form Description"),
  b::Element(e::NotUsed,     "Date"),
  b::Element(e::NotUsed,     "Time"),
  b::Element(e::NotUsed,     "Time Code"),
  b::Element(e::NotUsed,     "Reference Identifier"))),

            d::LoopDef.build("0200", d::RepeatCount.bounded(10),
b::Segment(160, s::N7, "Equipment Details", r::Situational, d::RepeatCount.bounded(1),
  b::Element(e::Situational, "Equipment Initial"),
  b::Element(e::Situational, "Equipment Number"),
  b::Element(e::NotUsed,     "Weight"),
  b::Element(e::NotUsed,     "Weight Qualifier"),
  b::Element(e::NotUsed,     "Tare Weight"),
  b::Element(e::NotUsed,     "Weight Allowance"),
  b::Element(e::NotUsed,     "Dunnage"),
  b::Element(e::NotUsed,     "Volume"),
  b::Element(e::NotUsed,     "Volume Qualifier"),
  b::Element(e::NotUsed,     "Ownership Code"),
  b::Element(e::Situational, "Equipment Description Code"),
  b::Element(e::NotUsed,     "Standard Carrier Alpha Code"),
  b::Element(e::NotUsed,     "Temperature Control"),
  b::Element(e::NotUsed,     "Position"),
  b::Element(e::Situational, "Equipment Length"),
  b::Element(e::NotUsed,     "Tare Qualifier Code"),
  b::Element(e::NotUsed,     "Weight Unit Code"),
  b::Element(e::NotUsed,     "Equipment Number Check Digit"),
  b::Element(e::NotUsed,     "Type of Service Code"),
  b::Element(e::NotUsed,     "Height"),
  b::Element(e::NotUsed,     "Width"),
  b::Element(e::NotUsed,     "Equipment Type"),
  b::Element(e::NotUsed,     "Standard Carrier Alpha Code"),
  b::Element(e::NotUsed,     "Car Type Code")))),

          d::TableDef.detail("Detail",
            d::LoopDef.build("0400", d::RepeatCount.bounded(9999),
b::Segment(120, s::LX, "Assigned Number", r::Required, d::RepeatCount.bounded(1),
  b::Element(e::Required,  "Assigned Number")),
b::Segment(130, s::N9, "Reference Identification", r::Situational, d::RepeatCount.bounded(5),
  b::Element(e::Required,    "Reference Identification Qualifier"),
  b::Element(e::Situational, "Reference Identification"),
  b::Element(e::NotUsed,     "Free-form Description"),
  b::Element(e::NotUsed,     "Date"),
  b::Element(e::NotUsed,     "Time"),
  b::Element(e::NotUsed,     "Time Code"),
  b::Element(e::NotUsed,     "Reference Identifier")),
b::Segment(140, s::L5, "Description, Marks and Numbers", r::Situational, d::RepeatCount.bounded(30),
  b::Element(e::Situational, "Lading Line Item Number"),
  b::Element(e::Situational, "Lading Description"),
  b::Element(e::Situational, "Commodity Code"),
  b::Element(e::Situational, "Commodity Code Qualifier"),
  b::Element(e::NotUsed,     "Packaging Code"),
  b::Element(e::NotUsed,     "Marks and Numbers"),
  b::Element(e::NotUsed,     "Marks and Numbers Qualifier"),
  b::Element(e::NotUsed,     "Commodity Code"),
  b::Element(e::NotUsed,     "Commodity Code Qualifier"),
  b::Element(e::NotUsed,     "Compartment ID Code")),
b::Segment(170, s::L0, "Line Item -- Quantity and Weight", r::Situational, d::RepeatCount.bounded(10),
  b::Element(e::Situational, "Lading Line Item Number"),
  b::Element(e::Situational, "Billed/Rated-as Quantity"),
  b::Element(e::Situational, "Billed/Rated-as Qualifier"),
  b::Element(e::Situational, "Weight"),
  b::Element(e::Situational, "Weight Qualifier"),
  b::Element(e::Situational, "Volume"),
  b::Element(e::Situational, "Volume Qualifier"),
  b::Element(e::Situational, "Lading Quantity"),
  b::Element(e::Situational, "Packaging Form Code")),
b::Segment(180, s::L1, "Rate and Charges", r::Situational, d::RepeatCount.bounded(10),
  b::Element(e::Situational, "Lading Line Item Number"),
  b::Element(e::Situational, "Freight Rate"),
  b::Element(e::Situational, "Rate/Value Qualifier"),
  b::Element(e::Situational, "Charge"),
  b::Element(e::Situational, "Advances"),
  b::Element(e::Situational, "Prepaid Amount"),
  b::Element(e::Situational, "Rate Combination Point Code"),
  b::Element(e::Situational, "Special Charge or Allowance Code"),
  b::Element(e::Situational, "Rate Class Code"),
  b::Element(e::Situational, "Entitlement Code"),
  b::Element(e::Situational, "Charge Method of Payment"),
  b::Element(e::Situational, "Special Charge Description"),
  b::Element(e::Situational, "Tariff Application Code"),
  b::Element(e::Situational, "Declared Value"),
  b::Element(e::Situational, "Rate/Value Qualifier"),
  b::Element(e::Situational, "Lading Liability Code"),
  b::Element(e::Situational, "Billed/Rated-as Quantity"),
  b::Element(e::Situational, "Billed/Rated-as Qualifier"),
  b::Element(e::Situational, "Percent")),
b::Segment(190, s::L4, "Measurement", r::Situational, d::RepeatCount.bounded(10),
  b::Element(e::Situational, "Length"),
  b::Element(e::Situational, "Width"),
  b::Element(e::Situational, "Height"),
  b::Element(e::Situational, "Measurement Qualifier"),
  b::Element(e::Situational, "Quantity")),
b::Segment(200, s::L7, "Measurement", r::Situational, d::RepeatCount.bounded(10),
  b::Element(e::Situational, "Lading Line Item Number"),
  b::Element(e::Situational, "Tariff Agency Code"),
  b::Element(e::Situational, "Tariff Number"),
  b::Element(e::Situational, "Tariff Section"),
  b::Element(e::Situational, "Tariff Item Number"),
  b::Element(e::Situational, "Tariff Item Part"),
  b::Element(e::Situational, "Freight Class Code"),
  b::Element(e::Situational, "Tariff Supplement Identifier"),
  b::Element(e::Situational, "Ex Parte"),
  b::Element(e::Situational, "Date"),
  b::Element(e::Situational, "Rate Base Number"),
  b::Element(e::Situational, "Tariff Column"),
  b::Element(e::Situational, "Tariff Distance"),
  b::Element(e::Situational, "Distance Qualifier"),
  b::Element(e::Situational, "City Name"),
  b::Element(e::Situational, "State or Province Code")))),

          d::TableDef.summary("Summary",
            b::Segment(10, s::L3, "Total Weight and Charges", r::Situational, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Weight"),
b::Element(e::Required,    "Weight Qualifier"),
b::Element(e::Situational, "Freight Rate"),
b::Element(e::Situational, "Rate/Value Qualifier"),
b::Element(e::Situational, "Charge"),
b::Element(e::Situational, "Advances"),
b::Element(e::NotUsed,     "Prepaid Amount"),
b::Element(e::NotUsed,     "Special Charge or Allowance Code"),
b::Element(e::Situational, "Volume"),
b::Element(e::Situational, "Volume Unit Qualifier"),
b::Element(e::Required,    "Lading Quantity"),
b::Element(e::NotUsed,     "Weight Unit Code"),
b::Element(e::NotUsed,     "Tariff Number"),
b::Element(e::Situational, "Declared Value"),
b::Element(e::Situational, "Rate/Value Qualifier")),
            b::Segment(20, s::SE, "Transaction Set Trailer", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Situational, "Number of Included Segments"),
b::Element(e::Situational, "Transaction Set Control Number"))))
IN810 =
b.build("IN", "810", "Invoice",
            d::TableDef.header("Heading",
                b::Segment(10, s:: ST, "Transaction Set Header", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required, "Transaction Set Identifier Code", b::Values("810")),
b::Element(e::Required, "Transaction Set Control Number")),
                b::Segment(20, s::BIG, "Beginning Segment for Invoice", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Date"),
b::Element(e::Required,    "Invoice Number"),
b::Element(e::Situational, "Date"),
b::Element(e::Situational, "Purchase Order Number"),
b::Element(e::Situational, "Release Number"),
b::Element(e::Situational, "Change Order Sequence Number"),
b::Element(e::Situational, "Transaction Type Code"),
b::Element(e::Situational, "Transaction Set Purpose Code"),
b::Element(e::Situational, "Action Code"),
b::Element(e::Situational, "Invoice Number")),
                d::LoopDef.build("N1", d::RepeatCount.bounded(200),
b::Segment(110, s:: N1, "Name", r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Entity Identifier Code"),
    b::Element(e::Situational, "Name"),
    b::Element(e::Situational, "Identification Code Qualifier"),
    b::Element(e::Situational, "Identification Code"),
    b::Element(e::Situational, "Code describing entity relationship"),
    b::Element(e::Situational, "Code identifying an organizational entity, a physical location, property or an individual")),
b::Segment(120, s:: N2, "Address Information", r::Situational, d::RepeatCount.bounded(2),
    b::Element(e::Situational,    "Name"),
    b::Element(e::Situational, "Name")),
b::Segment(130, s:: N3, "Address Information", r::Situational, d::RepeatCount.bounded(2),
    b::Element(e::Situational, "Address Information"),
    b::Element(e::Situational, "Address Information")),
b::Segment(140, s:: N4, "Geographic Location", r::Situational, d::RepeatCount.unbounded,
    b::Element(e::Situational, "City Name"),
    b::Element(e::Situational, "State or Province Code"),
    b::Element(e::Situational, "Postal Code"),
    b::Element(e::Situational, "Country Code"),
    b::Element(e::Situational, "Location Qualifier"),
    b::Element(e::Situational, "Location Identifier"))), #end LoopDef N1, Segment 140
                b::Segment(200, s:: ITD, "Terms of Sale or Deferred Terms of Sale", r::Situational, d::RepeatCount.unbounded,
b::Element(e::Situational, "Terms Type Code"),
b::Element(e::Situational, "Terms Basis Date Code"),
b::Element(e::Situational, "Terms Discount Percent"),
b::Element(e::Situational, "Terms Discount Due Date"),
b::Element(e::Situational, "Terms Discount Days Due"),
b::Element(e::Situational, "Terms Net Due Date"),
b::Element(e::Situational, "Terms Net Days"),
b::Element(e::Situational, "Terms Discount Amount"),
b::Element(e::Situational, "Terms Deferred Due Date"),
b::Element(e::Situational, "Deferred Amount Due"),
b::Element(e::Situational, "Percent of Invoice Payable"),
b::Element(e::Situational, "Description"),
b::Element(e::Situational, "Day of Month"),
b::Element(e::Situational, "Payment Method Code"),
b::Element(e::Situational, "Percent"))), #end TableDef HEADING, Segment 200
            d::TableDef.header("Detail",
                d::LoopDef.build("IT1", d::RepeatCount.bounded(100000),
b::Segment(10, s::IT1, "Baseline Item Data (Invoice)", r::Required, d::RepeatCount.bounded(1),
    b::Element(e::Situational, "Assigned Identification"),
    b::Element(e::Situational, "Quantity"),
    b::Element(e::Situational, "UOM"),
    b::Element(e::Situational, "Unit Price"),
    b::Element(e::Situational, "Basis of Unit Price Code"),
    b::Element(e::Situational, "Product/Service ID Qualifier"),
    b::Element(e::Situational, "Product/Service ID"),
    b::Element(e::Situational, "Product/Service ID Qualifier"),
    b::Element(e::Situational, "Product/Service ID"),
    b::Element(e::Situational, "Product/Service ID Qualifier"),
    b::Element(e::Situational, "Product/Service ID"),
    b::Element(e::Situational, "Product/Service ID Qualifier"),
    b::Element(e::Situational, "Product/Service ID"),
    b::Element(e::Situational, "Product/Service ID Qualifier"),
    b::Element(e::Situational, "Product/Service ID"),
    b::Element(e::Situational, "Product/Service ID Qualifier"),
    b::Element(e::Situational, "Product/Service ID"),
    b::Element(e::Situational, "Product/Service ID Qualifier"),
    b::Element(e::Situational, "Product/Service ID"),
    b::Element(e::Situational, "Product/Service ID Qualifier"),
    b::Element(e::Situational, "Product/Service ID"),
    b::Element(e::Situational, "Product/Service ID Qualifier"),
    b::Element(e::Situational, "Product/Service ID"),
    b::Element(e::Situational, "Product/Service ID Qualifier"),
    b::Element(e::Situational, "Product/Service ID")), #end Segment 10
b::Segment(20, s::TXI, "Tax Information", r::Situational, d::RepeatCount.bounded(10),
    b::Element(e::Situational, "Tax Type Code"),
    b::Element(e::Situational, "Monetary Amount"),
    b::Element(e::Situational, "Percent"),
    b::Element(e::Situational, "Tax Jurisdiction Code Qualifier"),
    b::Element(e::Situational, "Tax Jurisdiction Code"),
    b::Element(e::Situational, "Tax Exempt Code"),
    b::Element(e::Situational, "Relationship Code"),
    b::Element(e::Situational, "Dollar Basis For Percent"),
    b::Element(e::Situational, "Tax Identification Number"),
    b::Element(e::Situational, "Assigned Identification")), #end Segment 20
d::LoopDef.build("PID", d::RepeatCount.bounded(1000),
    b::Segment(30, s::PID, "Product/Item Description", r::Situational, d::RepeatCount.bounded(1),
        b::Element(e::Situational, "Item Description Type"),
        b::Element(e::Situational, "Process Characteristic Code"),
        b::Element(e::Situational, "Agency Qualifier Code"),
        b::Element(e::Situational, "Product Description Code"),
        b::Element(e::Situational, "Description"),
        b::Element(e::Situational, "Surface/Layer/Position Code"),
        b::Element(e::Situational, "Source Subqualifier"),
        b::Element(e::Situational, "Yes/No Condition or Response Code"),
        b::Element(e::Situational, "Language Code"))))), #end TableDef Detail, LoopDef IT1, LoopDef PID, Segment 30
            d::TableDef.header("Summary",
                b::Segment(10, s::TDS, "Total Monetary Value Summary", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Situational, "Amount"),
b::Element(e::Situational, "Amount"),
b::Element(e::Situational, "Amount"),
b::Element(e::Situational, "Amount")), #end Segment 10
                b::Segment(20, s::TXI, "Tax Information", r::Situational, d::RepeatCount.bounded(10),
b::Element(e::Situational, "Tax Type Code"),
b::Element(e::Situational, "Monetary Amount"),
b::Element(e::Situational, "Percent"),
b::Element(e::Situational, "Tax Jurisdiction Code Qualifier"),
b::Element(e::Situational, "Tax Jurisdiction Code"),
b::Element(e::Situational, "Tax Exempt Code"),
b::Element(e::Situational, "Relationship Code"),
b::Element(e::Situational, "Dollar Basis For Percent"),
b::Element(e::Situational, "Tax Identification Number"),
b::Element(e::Situational, "Assigned Identification")), #end Segment 20
                d::LoopDef.build("SAC", d::RepeatCount.bounded(25),
b::Segment(30, s::SAC, "Service, Promotion, Allowance, or Charge Information", r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Situational, "Allowance or Charge Indicator"),
    b::Element(e::Situational, "Service, Promotion, Allowance, or Charge Code"),
    b::Element(e::Situational, "Agency Qualifier Code"),
    b::Element(e::Situational, "Agency Service, Promotion, Allowance, or Charge Code"),
    b::Element(e::Situational, "Amount"),
    b::Element(e::Situational, "Allowance/Charge Percent Qualifier"),
    b::Element(e::Situational, "Percent"),
    b::Element(e::Situational, "Rate"),
    b::Element(e::Situational, "Unit or Basis for Measurement Code"),
    b::Element(e::Situational, "Quantity"),
    b::Element(e::Situational, "Quantity"),
    b::Element(e::Situational, "Allowance or Charge Method of Handling Code"),
    b::Element(e::Situational, "Reference Identification"),
    b::Element(e::Situational, "Option Number"),
    b::Element(e::Situational, "Description"),
    b::Element(e::Situational, "Language Code"))), #end LoopDef SAC, Segment 30
                b::Segment(40, s::CTT, "Transaction Totals", r::Situational, d::RepeatCount.bounded(10),
b::Element(e::Situational, "Number of Line Items"),
b::Element(e::Situational, "Hash Total"),
b::Element(e::Situational, "Weight"),
b::Element(e::Situational, "Unit or Basis for Measurement Code"),
b::Element(e::Situational, "Volume"),
b::Element(e::Situational, "Unit or Basis for Measurement Code"),
b::Element(e::Situational, "Description")), #end Segment 40
                b::Segment(50, s:: SE, "Transaction Set Trailer", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Number of Included Segments"),
b::Element(e::Required,    "Transaction Set Control Number"))))
OW940 =
b.build("OW", "940", "Warehouse Ship Order",
          d::TableDef("Header",
            b::Segment(10, s:: ST, "Transaction Set Header", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Transaction Set Identifier Code", b::Values("940")),
b::Element(e::Required,    "Transaction Set Control Number")),
            b::Segment(20, s:: W05, "Shipping Order Identification", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Order Status Code", b::Values("F", "N", "R")),
b::Element(e::Required,    "Depositor Order Number"),
b::Element(e::Situational, "Purchase Order Number"),
b::Element(e::Situational, "Link Sequence Number"),
b::Element(e::Situational, "Master Reference Number")),

            d::LoopDef.build("N1", d::RepeatCount.bounded(10),
b::Segment(40, s:: N1, "Name", r::Situational, d::RepeatCount.bounded(3),
  b::Element(e::Required,    "Entity Identifier Code", b::Values("ST", "DE", "VN", "WH", "SF")),
  b::Element(e::Required,    "Name"),
  b::Element(e::Required,    "Identification Code Qualifier", b::Values("91", "9", "ZZ")),
  b::Element(e::Required,    "Identification Code")),
b::Segment(50, s:: N2, "Additional Name Information", r::Situational, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Additional Name Information"),
  b::Element(e::Situational, "Additional Name Information")),
b::Segment(60, s:: N3, "Address Information", r::Situational, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Address Information"),
  b::Element(e::Situational, "Address Information")),
b::Segment(70, s:: N4, "Geographic Location", r::Situational, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "City Name"),
  b::Element(e::Required,    "State Code"),
  b::Element(e::Situational, "Postal Code"))),

            b::Segment(90, s:: N9, "Reference Number", r::Situational, d::RepeatCount.bounded(10),
b::Element(e::Required,    "Reference Identification Qualifier", b::Values("BR", "CO")),
b::Element(e::Required,    "Reference Identification")),
            b::Segment(110, s:: G62, "Date/Time", r::Required, d::RepeatCount.bounded(10),
b::Element(e::Required,    "Date Qualifier", b::Values("02", "10")),
b::Element(e::Required,    "Date")),
            b::Segment(120, s:: NTE, "Note/Special Instruction", r::Situational, d::RepeatCount.bounded(9999),
b::Element(e::Situational, "Note Reference Code", b::Values("WHI", "DEL")),
b::Element(e::Required,    "Description")),
            b::Segment(140, s:: W66, "Warehouse Carrier Information", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Ship Method of Payment", b::Values("CC", "PB", "PP")),
b::Element(e::Required,    "Transport Type Code", b::Values("A", "H", "M", "R")),
b::Element(e::Situational, "Pallet Exchange Code"),
b::Element(e::Situational, "Unused"),
b::Element(e::Situational, "Routing"),
b::Element(e::Situational, "Unused"),
b::Element(e::Situational, "Unused"),
b::Element(e::Situational, "Unused"),
b::Element(e::Situational, "Unused"),
b::Element(e::Situational, "SCAC"))),

          d::TableDef.header("Detail",
            d::LoopDef.build("LX", d::RepeatCount.bounded(9999),
b::Segment(5, s:: LX, "Assigned Number", r::Required, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Assigned Number"))),

            d::LoopDef.build("W01", d::RepeatCount.bounded(9999),
b::Segment(20, s:: W01, "Line Item Detail", r::Required, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Quantity Ordered"),
  b::Element(e::Required,    "Unit/Basis Measurement Code", b::Values("CA")),
  b::Element(e::Situational, "UPC Case Code"),
  b::Element(e::Situational, "Product/Service ID Qualifier", b::Values("VN", "VI")),
  b::Element(e::Situational, "Product/Service ID"),
  b::Element(e::Situational, "Product/Service ID Qualifier", b::Values("UC")),
  b::Element(e::Situational, "Product/Service ID"),
  b::Element(e::Situational, "Warehouse Lot Number")),
b::Segment(40, s:: N9 ,"Reference Number", r::Situational, d::RepeatCount.bounded(200),
  b::Element(e::Required,    "Reference Identifier Qualifier", b::Values("LI", "PC", "PJ", "PK")),
  b::Element(e::Required,    "Reference Identifier")),
b::Segment(50, s:: W20, "Pack Detail", r::Required, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Case Inner Pack"),
  b::Element(e::Required,    "Outer Pack")))),

          d::TableDef.header("Summary",
            b::Segment(10, s::W03, "Total Shipment Information", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Quantity Ordered"),
b::Element(e::Situational, "Weight"),
b::Element(e::Situational, "Unit or Basis for Measurement Code", b::Values("LB")),
b::Element(e::Situational, "Volume"),
b::Element(e::Situational, "Unit/Basis Measurement Code", b::Values("CF"))),
            b::Segment(30, s::SE, "Transaction Set Trailer", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Number of Included Segments"),
b::Element(e::Required,    "Transaction Set Control Number"))))
PO850 =
b.build("PO", "850", "Purchase Order",
          d::TableDef.header("Heading",
            b::Segment(10, s:: ST, "Transaction Set Header", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Transaction Set Identifier Code", b::Values("850")),
b::Element(e::Required,    "Transaction Set Control Number")),
            b::Segment(20, s::BEG, "Beginning Segment for Purchase Order", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Transaction Set Purpose Code", b::Values("00")),
b::Element(e::Required,    "Purchase Order Type Code", b::Values("NE")),
b::Element(e::Required,    "Purchase Order Number"),
b::Element(e::Situational, "Release Number"),
b::Element(e::Required,    "Date")),
            b::Segment(40, s::CUR, "Currency", r::Situational, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Entity Identifier Code", b::Values("BT","BY","CN","SH","SF","ST"),
b::Element(e::Required,    "Currency Code")),
            b::Segment(50, s::REF, "Reference Identification", r::Situational, d::RepeatCount.unbounded,
b::Element(e::Required,    "Reference Identification Qualifier", b::Values("ZZ", "OS")),
b::Element(e::Situational, "Reference Identification")),
            b::Segment(60, s::PER, "Administrative Communications Contact", r::Situational, d::RepeatCount.bounded(3),
b::Element(e::Required,    "Contact Function Code", b::Values("BD")),
b::Element(e::Situational, "Name"),
b::Element(e::Situational, "Communication Number Qualifier", b::Values("TE")),
b::Element(e::Situational, "Communication Number")),
            b::Segment(150, s::DTM, "Date/Time Reference", r::Situational, d::RepeatCount.bounded(10),
b::Element(e::Required,    "Date/Time Qualifier", b::Values("002")),
b::Element(e::Situational, "Date")),

            d::LoopDef.build("N1", d::RepeatCount.bounded(200),
b::Segment(310, s:: N1, "Name", r::Situational, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Entity Identifier Code", b::Values("SF", "ST")),
  b::Element(e::Required,    "Name"),
  b::Element(e::Situational, "Identification Code Qualifier", b::Values("91")),
  b::Element(e::Situational, "Identification Code")),
b::Segment(330, s:: N3, "Address Information", r::Situational, d::RepeatCount.bounded(2),
  b::Element(e::Required,    "Address Information"),
  b::Element(e::Situational, "Address Information")),
b::Segment(340, s:: N4, "Geographic Location", r::Situational, d::RepeatCount.unbounded,
  b::Element(e::Situational, "City Name"),
  b::Element(e::Situational, "State or Province Code"),
  b::Element(e::Situational, "Postal Code"),
  b::Element(e::Situational, "Country Code")),
b::Segment(350, s::REF, "Reference Identification", r::Situational, d::RepeatCount.bounded(12),
  b::Element(e::Required,    "Reference Identification Qualifier", b::Values("DP")),
  b::Element(e::Situational, "Reference Identification")))),

          d::TableDef.header("Detail",
            d::LoopDef.build("PO1", d::RepeatCount.bounded(100000),
b::Segment(10, s::PO1, "Baseline Item Data", r::Required, d::RepeatCount.bounded(1),
  b::Element(e::Situational, "Assigned Identification"),
  b::Element(e::Situational, "Quantity Ordered"),
  b::Element(e::Situational, "Unit or Basis for Measurement Code", b::Values("CA", "EA", "LB")),
  b::Element(e::Situational, "Unit Price"),
  b::Element(e::Situational, "Basis of Unit Price Code", b::values("PE","PP","UM")),
  b::Element(e::Situational, "Product/Service ID Qualifier", b::Values("VN", "VC")),
  b::Element(e::Situational, "Product/Service ID"))),
            d::LoopDef.build("PID", d::RepeatCount.bounded(1000),
b::Segment(50, s::PID, "Product/Item Description", r::Situational, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Item Description Type", b::Values("F")),
  b::Element(e::Situational, "Product/Process Characteristic Code"),
  b::Element(e::Situational, "Agency Qualifier Code"),
  b::Element(e::Situational, "Product Description Code"),
  b::Element(e::Situational, "Description"))),
            d::LoopDef.build("SCH", d::RepeatCount.bounded(200),
b::Segment(295, s::SCH, "Line Item Schedule", r::Situational, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Numeric value ofquantiy"),
  b::Element(e::Required,    "Unit or Basis for Measurement Code", b::Values("DZ", "EA", "FT", "RL")),
  b::Element(e::Situational, "Date/Time Qualifer"),
  b::Element(e::Situational, "Date"),
  b::Element(e::Situational, "Date/Time Qualifer"),
  b::Element(e::Situational, "Date"))),
            d::LoopDef.build("N1", d::RepeatCount.bounded(200),
b::Segment(350, s:: N1, "Name", r::Situational, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Entity Identifier Code", b::Values("SF", "ST")),
  b::Element(e::Required,    "Name"),
  b::Element(e::Situational, "Identification Code Qualifier", b::Values("91")),
  b::Element(e::Situational, "Identification Code")),
b::Segment(370, s:: N3, "Address Information", r::Situational, d::RepeatCount.bounded(2),
  b::Element(e::Required,    "Address Information"),
  b::Element(e::Situational, "Address Information")),
b::Segment(380, s:: N4, "Geographic Location", r::Situational, d::RepeatCount.bounded(1),
  b::Element(e::Situational, "City Name"),
  b::Element(e::Situational, "State or Province Code"),
  b::Element(e::Situational, "Postal Code"),
  b::Element(e::Situational, "Country Code")))),

          d::TableDef.header("Summary",
            d::LoopDef.build("CTT", d::RepeatCount.bounded(1),
b::Segment(10, s::CTT, "Transaction Totals", r::Situational, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Number of Line Items"),
  b::Element(e::Situational, "Hash Total"))),
            b::Segment(30, s:: SE, "Transaction Set Trailer", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Number of Included Segments"),
b::Element(e::Required,    "Transaction Set Control Number")))))
PS830 =
b.build("PS", "830", "",
          d::TableDef.header("Header",
            b::Segment(10, s:: ST, "Transaction Set Header #1", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Transaction Set Identifier Code", b::Values("830")),
b::Element(e::Required,    "Transaction Set Control Number")),
            b::Segment(20, s::BFR, "Beginning Segment for Planning Schedule #1", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Transaction Set Purpose Code", b::Values("00")),
b::Element(e::Situational, "Reference Identification"),
b::Element(e::Situational, "Release Number"),
b::Element(e::Required,    "Schedule Type Qualifier", b::Values("SH")),
b::Element(e::Required,    "Schedule Quantity Qualifier", b::Values("A")),
b::Element(e::Required,    "Date"),
b::Element(e::Situational, "Date"),
b::Element(e::Required,    "Date"),
b::Element(e::NotUsed,     ""),
b::Element(e::Situational, "Purchase Order Number")),
            b::Segment(50, s::REF, "Reference Identification #1", r::Situational, d::RepeatCount.bounded(12),
b::Element(e::Required,    "Reference Identification Qualifier", b::Values("ZZ")),
b::Element(e::Situational, "Reference Identification"),
b::Element(e::Situational, "Description")),

            d::LoopDef.build("N1 #1", d::RepeatCount.bounded(2),
b::Segment(230, s:: N1, "Name - Header", r::Situational, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Entity Identifier Code", b::Values("BT", "EV")),
  b::Element(e::Situational, "Name"),
  b::Element(e::Situational, "Identification Code Qualifier", b::Values("01","ZZ")),
  b::Element(e::Situational, "Identification Code"),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     "")))),

          d::TableDef.header("Detail",
            d::LoopDef.build("LIN - Detail 1", d::RepeatCount.unbounded,
b::Segment(10, s::LIN, "Warehouse Shipment Identification - Detail 1", r::Required, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Reporting Code", b::Values("F")),
  b::Element(e::Required,    "Depositor Order Number"),
  b::Element(e::Situational, "Date"),
  b::Element(e::Required,    "Shipment Identification Number"),
  b::Element(e::Situational, "Agent Shipment ID Number"),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     "")),
b::Segment(20, s::UIT, "Unit Detail - Detail 1", r::Situational, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Composite Unit of Measure",
  b::Element(e::Required,    "Unit or Basis for Measurement Code", b::Values("PC")),
  b::Element(e::NotUsed,     "Exponent"),
  b::Element(e::NotUsed,     "Multiplier"),
  b::Element(e::Situational, "Unit or Basis for Measurement Code", b::Values("LB")),
  b::Element(e::NotUsed,     "Exponent"),
  b::Element(e::Situational, "Multiplier")),
  b::Element(e::Situational, "Unit Price")),
b::Segment(80, s::PID, "Product/Item Description - Detail 1", r::Situational, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Item Description Type", b::Values("F")),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::Required,    "Description"),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     "")),

d::LoopDef.build("N1 #1", d::RepeatCount.bounded(1),
  b::Segment(320, s:: N1, "Name - Detail 1", r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Entity Identifier Code", b::Values("ST", "SF")),
    b::Element(e::Situational, "Name"),
    b::Element(e::Situational, "Identification Code Qualifier", b::Values("91")),
    b::Element(e::Situational, "Identification Code"),
    b::Element(e::NotUsed,     ""),
    b::Element(e::NotUsed,     ""))),

d::LoopDef.build("SDP #1", d::RepeatCount.bounded(1),
  b::Segment(450, s::SDP, "Ship/Delivery Pattern - Detail 1", r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Ship/Delivery or Calendar Pattern Code", b::Values("Y")),
    b::Element(e::Required,    "Ship/Delivery Pattern Time Code", b::Values("Y"))),
  b::Segment(460, s::FST, "Forecast Schedule - Detail 1", r::Situational, d::RepeatCount.bounded(6),
    b::Element(e::Required,    "Quantity"),
    b::Element(e::Required,    "Forecast Qualifier", b::Values("C", "D")),
    b::Element(e::Required,    "Forecast Timing Qualifier", b::Values("F")),
    b::Element(e::Required,    "Date"),
    b::Element(e::Situational, "Date"),
    b::Element(e::NotUsed,     ""),
    b::Element(e::NotUsed,     ""),
    b::Element(e::Situational, "Reference Identification Qualifier"),
    b::Element(e::Situational, "Reference Identification"))),

d::LoopDef.build("SHP #1", d::RepeatCount.bounded(1),
  b::Segment(470, s::SHP, "Shipped/Received Information - Detail 1", r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Situational, "Quantity Qualifier", b::Values("02")),
    b::Element(e::Situational, "Quantity"),
    b::Element(e::Situational, "Date/Time Qualifier", b::Values("011")),
    b::Element(e::Situational, "Date"))))),

          d::TableDef.header("Summary",
            b::Segment(10, s::CTT, "Transaction Totals", r::Situational, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Number of Units Shipped"),
b::Element(e::NotUsed,     ""),
b::Element(e::NotUsed,     ""),
b::Element(e::NotUsed,     ""),
b::Element(e::NotUsed,     ""),
b::Element(e::NotUsed,     ""),
b::Element(e::NotUsed,     "")),
            b::Segment(30, s::SE, "Transaction Set Trailer", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Number of Included Segments"),
b::Element(e::Required,    "Transaction Set Control Number"))))
QM214 =
b.build("QM", "214", "Transportation Carrier Shipment Status Message",
          d::TableDef.header("Heading",
            b::Segment(10, s::ST, "Transaction Set Header", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Transaction Set Identifier Code", b::Values("214")),
b::Element(e::Required,    "Transaction Set Control Number")),
            b::Segment(20, s::B10, "Beginning Segment for Transportation Carrier Shipment Status Message", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Reference Identification"),
b::Element(e::Required,    "Shipment Identification Number"),
b::Element(e::Required,    "Standard Carrier Alpha Code"),
b::Element(e::NotUsed,     "Inquiry Request Number"),
b::Element(e::NotUsed,     "Reference Identification Qualifier"),
b::Element(e::NotUsed,     "Reference Identification"),
b::Element(e::NotUsed,     "Yes/No Condition or Response Code")),
            b::Segment(30, s::L11, "Business Instruction and Reference Number", r::Situational, d::RepeatCount.bounded(300),
b::Element(e::Situational, "Reference Identification"),
b::Element(e::Situational, "Reference Identification Qualifier"),
b::Element(e::Situational, "Description")),

            d::LoopDef.build("0100", d::RepeatCount.bounded(10),
b::Segment(50, s::N1, "Name", r::Situational, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Entity Identifier Code"),
  b::Element(e::Required,    "Name"),
  b::Element(e::Situational, "Identification Code Qualifier"),
  b::Element(e::Situational, "Identification Code"),
  b::Element(e::Situational, "Entity Relation Code"),
  b::Element(e::Situational, "Entity Identifier Code")),
b::Segment(70, s::N3, "Address Information", r::Situational, d::RepeatCount.bounded(2),
  b::Element(e::Situational, "Address Information"),
  b::Element(e::Situational, "Address Information")),
b::Segment(80, s::N4, "Geographic Information", r::Situational, d::RepeatCount.bounded(1),
  b::Element(e::Situational, "City Name"),
  b::Element(e::Situational, "State or Province Code"),
  b::Element(e::Situational, "Postal Code"),
  b::Element(e::Situational, "Country Code"),
  b::Element(e::Situational, "Location Qualifier"),
  b::Element(e::Situational, "Location Identifier"))),


            d::LoopDef.build("0150", d::RepeatCount.bounded(12),
b::Segment(120, s::MS3, "Interline Information", r::Situational, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Standard Carrier Alpha Code"),
  b::Element(e::Situational, "Routing Sequence Code"),
  b::Element(e::NotUsed,     "City Name"),
  b::Element(e::Required,    "Transportation Method/Type Code"),
  b::Element(e::NotUsed,     "State or Province Code"))),

            d::LoopDef.build("0200", d::RepeatCount.bounded(999999),
b::Segment(130, s::LX, "Assigned Number", r::Required, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Assigned Number")),

d::LoopDef.build("0205", d::RepeatCount.bounded(10),
  b::Segment(140, s::AT7, "Shipment Status Details", r::Required, d::RepeatCount.bounded(1),
    b::Element(e::Situational, "Shipment Status Code"),
    b::Element(e::Situational, "Shipment Status or Appointment Reason Code"),
    b::Element(e::Situational, "Shipment Appointment Status Code"),
    b::Element(e::Situational, "Shipment Status or Appointment Reason Code"),
    b::Element(e::Situational, "Date"),
    b::Element(e::Situational, "Time"),
    b::Element(e::Situational, "Time Code")),
  b::Segment(143, s::MS1, "Equipment, Shipment or Real Property Location", r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Situational, "City Name"),
    b::Element(e::Situational, "State or Province Code"),
    b::Element(e::Situational, "Country Code"),
    b::Element(e::Situational, "Longitude Code"),
    b::Element(e::Situational, "Latitude Code"),
    b::Element(e::Situational, "Direction Identifier Code"),
    b::Element(e::Situational, "Direction Identifier Code"),
    b::Element(e::Situational, "Postal Code")),
  b::Segment(146, s::MS2, "Equipment or Container Owner and Type", r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Situational, "Standard Carrier Alpha Code"),
    b::Element(e::Situational, "Equipment Number"),
    b::Element(e::Situational, "Equipment Description Code"),
    b::Element(e::Situational, "Equipment Number Check Digit"))),

b::Segment(150, s::L11, "Business Instructions and Reference Number", r::Situational, d::RepeatCount.bounded(10),
  b::Element(e::Situational, "Reference Identification"),
  b::Element(e::Required,    "Reference Identification Qualifier"),
  b::Element(e::Situational, "Description")),
b::Segment(200, s::AT8, "Shipment Weight, Packaging and Quantity Data", r::Situational, d::RepeatCount.bounded(10),
  b::Element(e::Required,    "Weight Qualifier"),
  b::Element(e::Required,    "Weight Unit Code"),
  b::Element(e::Required,    "Weight"),
  b::Element(e::Required,    "Lading Quantity"),
  b::Element(e::Situational, "Lading Quantity"),
  b::Element(e::Situational, "Volume Unit Qualifier"),
  b::Element(e::Situational, "Volume"))),

            b::Segment(610, s::SE, "Transaction Set Trailer", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Situational, "Number of Included Segments"),
b::Element(e::Situational, "Transaction Set Control Number"))))
RE944 =
b.build("RE", "944", "",
          d::TableDef.header("Header",
            b::Segment(10, s:: ST, "Transaction Set Header", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Transaction Set Identifier Code", b::Values("944")),
b::Element(e::Required,    "Transaction Set Control Number")),
            b::Segment(20, s::W17, "Warehouse Receipt Identification", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Reporting Code", b::Values("F")),
b::Element(e::Required,    "Date"),
b::Element(e::Required,    "Warehouse Receipt Number"),
b::Element(e::Required,    "Depositor Order Number"),
b::Element(e::Situational, "Shipment Identification Number")),

            d::LoopDef.build("N1", d::RepeatCount.bounded(10),
b::Segment(40, s:: N1, "Name", r::Situational, d::RepeatCount.bounded(2),
  b::Element(e::Required,    "Entity Identifier Code", b::Values("WH", "DE")),
  b::Element(e::Situational, "Name"),
  b::Element(e::Situational, "Identification Code Qualifier", b::Values("9")),
  b::Element(e::Situational, "Identification Code"))),

            b::Segment(140, s::G62, "Date/Time Reference", r::Situational, d::RepeatCount.bounded(2),
b::Element(e::Situational, "Date Qualifier"),
b::Element(e::Situational, "Date"),
b::Element(e::Situational, "Time Qualifier"),
b::Element(e::Situational, "Time"),
b::Element(e::Situational, "Time Code"))),

          d::TableDef.header("Detail",
            d::LoopDef.build("W07", d::RepeatCount.bounded(9999),
b::Segment(20, s::W07, "Item Detail For Stock Receipt", r::Required, d::RepeatCount.bounded(1),
  b::Element(e::Mandatory,   "Quantity Received"),
  b::Element(e::Mandatory,   "Unit or Basis for Measurement Code", b::Values("EA", "CA", "LB")),
  b::Element(e::Situational, "U.P.C. Case Code"),
  b::Element(e::Situational, "Product/Service ID Qualifier", b::Values("UK")),
  b::Element(e::Situational, "Product/Service ID"),
  b::Element(e::Situational, "Warehouse Lot Number")),
b::Segment(30, s::G69, "Line Item Detail - Description", r::Situational, d::RepeatCount.bounded(1),
  b::Element(e::Mandatory,   "Free-form descriptive text")),
b::Segment(40, s::N9, "Reference Identification", r::Situational, d::RepeatCount.bounded(200),
  b::Element(e::Mandatory,   "Reference Identification Qualifier"),
  b::Element(e::Situational, "Reference Identification")))),

          d::TableDef.header("Summary",
            b::Segment(10, s::W14, "Total Receipt Information", r::Situational, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Quantity Received")),
            b::Segment(20, s::SE, "Transaction Set Trailer", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Number of Included Segments"),
b::Element(e::Required,    "Transaction Set Control Number"))))
SH856 =
b.build("SH", "856", "Ship Notice/Manifest",
          d::TableDef.header("Heading",
            b::Segment(100, s:: ST, "Transaction Set Header", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Transaction Set Identifier Code", b::Values("856")),
b::Element(e::Required,    "Transaction Set Control Number")),
            b::Segment(200, s::BSN, "Beginning Segment for Ship Notice", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Transaction Set Purpose Code", b::Values("00")),
b::Element(e::Required,    "Shipment Identification"),
b::Element(e::Required,    "Date - BSN03"),
b::Element(e::Required,    "Time - BSN04"),
b::Element(e::Situational, "Hierarchical Structure Code",b::Values("0004"))),
            b::Segment(300, s::DTM, "Date/Time Reference", r::Required, d::RepeatCount.bounded(10),
b::Element(e::Required,    "Date/Time Qualifier", b::Values("011","017")),
b::Element(e::Required,    "Date - DTM02"),
b::Element(e::Situational, "Time - DTM03"),
b::Element(e::NotUsed,     "Time Code"),
b::Element(e::NotUsed,     "Century"),
b::Element(e::NotUsed,     "DTM06"))),

          d::TableDef.detail("Detail",
            d::LoopDef.build("HL", d::RepeatCount.bounded(200000),
b::Segment(200, s:: HL, "Hierarchical Level", r::Required, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Hierarchical ID Number"),
  b::Element(e::Situational, "Hierarchical Parent ID Number"),
  b::Element(e::Required,    "Hierarchical Level Code", b::Values("S")),
  b::Element(e::Situational, "Hierarchical Child Code")),
b::Segment(1000, s::TD1, "Carrier Details (Quantity and Weight)", r::Required, d::RepeatCount.bounded(20),
  b::Element(e::Required,    "Packaging Code"),
 #b::Element(e::Required,    "Packaging Form", b::Values("CNT","CRT","CTN","PCS","PLT")),
 #b::Element(e::NotUsed,     "Packaging Material", b::Values("25","71","90","94"))),
  b::Element(e::Required,    "Lading Quantity")),
b::Segment(1100, s::TD5, "Carrier Details (Routing Sequence/Transit Time)", r::Required, d::RepeatCount.bounded(12),
  b::Element(e::Situational, "Routing Sequence Code", b::Values("B")),
  b::Element(e::Required,    "Identification Code Qualifier", b::Values("2")),
  b::Element(e::Required,    "Identification Code"),
  b::Element(e::Situational, "Transportation Method/Type Code")),
b::Segment(1200, s::TD3, "Carrier Details (Equipment)", r::Situational, d::RepeatCount.bounded(12),
  b::Element(e::NotUsed,     "TD301"),
  b::Element(e::NotUsed,     "TD302"),
  b::Element(e::NotUsed,     "TD303"),
  b::Element(e::Situational,  "Weight Qualifier", b::Values("G")),
  b::Element(e::Situational, "Weight"),
  b::Element(e::Situational, "Unit or Basis for Measurement Code", b::Values("LB"))),
             b::Segment(1500, s::REF, "Reference Identification", r::Required, d::RepeatCount.unbounded,
  b::Element(e::Required,    "Reference Identification Qualifier", b::Values("BM","OI","PK","SI")),
  b::Element(e::Situational, "Reference Identification")),

d::LoopDef.build("N1", d::RepeatCount.bounded(200),
  b::Segment(3700, s:: N1, "Name SEGMENT #1", r::Required, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Entity Identifier Code", b::Values("SF")),
    b::Element(e::Situational, "Name"),
    b::Element(e::Required,    "Identification Code Qualifier", b::Values("92")),
    b::Element(e::Required,    "Identification Code"),
    b::Element(e::NotUsed,     "N105"),
    b::Element(e::NotUsed,     "N106")),
  b::Segment(3800, s:: N1, "Name SEGMENT #2", r::Required, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Entity Identifier Code", b::Values("ST")),
    b::Element(e::Situational, "Name"),
    b::Element(e::Required,    "Identification Code Qualifier", b::Values("92")),
    b::Element(e::Required,    "Identification Code"),
    b::Element(e::NotUsed,     "N105"),
    b::Element(e::NotUsed,     "N106")),
  b::Segment(3900, s:: N1, "Name SEGMENT #3", r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Situational, "Entity Identifier Code", b::Values("RC")),
    b::Element(e::Situational, "Name"),
    b::Element(e::Situational, "Identification Code Qualifier", b::Values("92")),
    b::Element(e::Situational, "Identification Code"),
    b::Element(e::NotUsed,     "N105"),
    b::Element(e::NotUsed,     "N106")))),

            d::LoopDef.build("HL", d::RepeatCount.bounded(200000),
b::Segment(6200, s:: HL, "Hierarchical Level", r::Required, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Hierarchical ID Number"),
  b::Element(e::Situational, "Hierarchical Parent ID Number"),
  b::Element(e::Required,    "Hierarchical Level Code", b::Values("T")),
  b::Element(e::Situational, "Hierarchical Child Code")),
b::Segment(6300, s::REF, "Reference Identification", r::Required, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Reference Identification Qualifier", b::Values("LS")),
  b::Element(e::Required,    "Reference Identification")),

            d::LoopDef.build("HL", d::RepeatCount.bounded(200000),
b::Segment(6500, s:: HL, "Hierarchical Level", r::Required, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Hierarchical ID Number"),
  b::Element(e::Situational, "Hierarchical Parent ID Number"),
  b::Element(e::Required,    "Hierarchical Level Code", b::Values("I")),
  b::Element(e::Situational, "Hierarchical Child Code")),
b::Segment(6600, s::LIN, "Item Identification", r::Required, d::RepeatCount.bounded(1),
  b::Element(e::Situational, "Assigned Identification"),
  b::Element(e::Required,    "Product/Service ID Qualifier", b::Values("BP")),
  b::Element(e::Required,    "Product/Service ID"),
  b::Element(e::Required,    "Product/Service ID Qualifier", b::Values("ON")),
  b::Element(e::Required,    "Product/Service ID"),
  b::Element(e::NotUsed,     "Product/Service ID - Coil Number"),
  b::Element(e::NotUsed,     "Product/Service ID Qualifier"),
  b::Element(e::NotUsed,     "Product/Service ID"),
  b::Element(e::NotUsed,     "Product/Service ID Qualifier"),
  b::Element(e::NotUsed,     "Product/Service ID"),
  b::Element(e::NotUsed,     "Product/Service ID Qualifier"),
  b::Element(e::NotUsed,     "Product/Service ID"),
  b::Element(e::NotUsed,     "Product/Service ID Qualifier"),
  b::Element(e::NotUsed,     "Product/Service ID"),
  b::Element(e::NotUsed,     "Product/Service ID Qualifier"),
  b::Element(e::NotUsed,     "Product/Service ID"),
  b::Element(e::NotUsed,     "Product/Service ID Qualifier"),
  b::Element(e::NotUsed,     "Product/Service ID"),
  b::Element(e::NotUsed,     "Product/Service ID Qualifier"),
  b::Element(e::NotUsed,     "Product/Service ID"),
  b::Element(e::NotUsed,     "Product/Service ID Qualifier"),
  b::Element(e::NotUsed,     "Product/Service ID"),
  b::Element(e::NotUsed,     "Product/Service ID Qualifier"),
  b::Element(e::NotUsed,     "Product/Service ID"),
  b::Element(e::NotUsed,     "Product/Service ID Qualifier"),
  b::Element(e::NotUsed,     "Product/Service ID"),
  b::Element(e::NotUsed,     "Product/Service ID Qualifier"),
  b::Element(e::NotUsed,     "Product/Service ID"),
  b::Element(e::NotUsed,     "Product/Service ID Qualifier"),
  b::Element(e::NotUsed,     "Product/Service ID"),
  b::Element(e::NotUsed,     "Product/Service ID Qualifier")),
b::Segment(6700, s::SN1, "Item Detail (Shipment)", r::Required, d::RepeatCount.bounded(1),
  b::Element(e::NotUsed,     "Assigned Identification"),
  b::Element(e::Required,    "Number of Units Shipped"),
  b::Element(e::Required,    "Unit or Basis for Measurement Code", b::Values("EA","PC")),
  b::Element(e::NotUsed,     "Quantity Shipped to Date"),
  b::Element(e::NotUsed,     "Quantity Ordered"),
  b::Element(e::NotUsed,     "Unit or Basis for Measurement Code"),
  b::Element(e::NotUsed,     "Returnable Container Load Make-Up Code"),
  b::Element(e::NotUsed,     "Line Item Status Code"))))),

          d::TableDef.header("Summary",
            b::Segment(100, s::CTT, "Transaction Totals", r::Situational, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Number of Line Items"),
b::Element(e::NotUsed,     "Hash Total"),
b::Element(e::NotUsed,     "Weight"),
b::Element(e::NotUsed,     "Unit or Basis for Measurement Code"),
b::Element(e::NotUsed,     "Volume"),
b::Element(e::NotUsed,     "Unit or Basis for Measurement Code"),
b::Element(e::NotUsed,     "Description")),
            b::Segment(200, s:: SE, "Transaction Set Trailer", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Number of Included Segments"),
b::Element(e::Required,    "Transaction Set Control Number"))))
SM204 =
b.build("SM", "204", "Motor Carrier Load Tender",
          d::TableDef.header("Heading",
            b::Segment(10, s::ST, "Transaction Set Header", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Transaction Set Identifier Code", b::Values("204")),
b::Element(e::Required,    "Transaction Set Control Number")),
            b::Segment(20, s::B2, "Beginning Segment for Shipment Information Transaction", r::Required, d::RepeatCount.bounded(1),
b::Element(e::NotUsed,     "Tariff Service Code"),
b::Element(e::Required,    "Standard Carrier Alpha Code"),
b::Element(e::NotUsed,     "Standard Point Location Code"),
b::Element(e::Required,    "Shipment Identification Number"),
b::Element(e::NotUsed,     "Weight Unit Qualifier"),
b::Element(e::Required,    "Shipment Method of Payment"),
b::Element(e::NotUsed,     "Shipment Qualifier"),
b::Element(e::NotUsed,     "Total Equipment"),
b::Element(e::NotUsed,     "Shipment Weight Code"),
b::Element(e::NotUsed,     "Customs Document Handling Code"),
b::Element(e::NotUsed,     "Transportation Terms Code"),
b::Element(e::NotUsed,     "Payment Method Code")),
            b::Segment(30, s::B2A, "Set Purpose", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Transaction Set Purpose Code"),
b::Element(e::Situational, "Application Type")),
            b::Segment(80, s::L11, "Business Instructions and Reference Number", r::Situational, d::RepeatCount.bounded(200),
b::Element(e::Situational, "Reference Identification"),
b::Element(e::Situational, "Reference Identification Qualifier"),
b::Element(e::Situational, "Description")),
            b::Segment(90, s::G62, "Date/Time", r::Situational, d::RepeatCount.bounded(1),
b::Element(e::Situational, "Date Qualifier"),
b::Element(e::Situational, "Date"),
b::Element(e::Situational, "Time Qualifier"),
b::Element(e::Situational, "Time"),
b::Element(e::NotUsed,     "Time Code")),
            b::Segment(100, s::MS3, "Interline Information", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Standard Carrier Alpha Code"),
b::Element(e::Situational, "Routing Sequence Code"),
b::Element(e::Situational, "City Name"),
b::Element(e::Required,    "Transportation Method/Type Code"),
b::Element(e::Situational, "State or Province Code")),
            b::Segment(120, s::PLD, "Pallet Information", r::Situational, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Quantity of Pallets Shipped"),
b::Element(e::NotUsed,     "Pallet Exchange Code"),
b::Element(e::NotUsed,     "Weight Unit Code"),
b::Element(e::NotUsed,     "Weight")),
            b::Segment(130, s::NTE, "Note/Special Instruction", r::Situational, d::RepeatCount.bounded(10),
b::Element(e::Situational, "Note Reference Code"),
b::Element(e::Situational, "Description")),

            d::LoopDef.build("LOOP 0100", d::RepeatCount.bounded(5),
b::Segment(140, s::N1, "Name", r::Situational, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Entity Identifier Code"),
  b::Element(e::Required,    "Name"),
  b::Element(e::Situational, "Identification Code Qualifier"),
  b::Element(e::Situational, "Identification Code"),
  b::Element(e::NotUsed,     "Entity Relationship Code"),
  b::Element(e::NotUsed,     "Entity Identifier Code")),
b::Segment(160, s::N3, "Address Information", r::Situational, d::RepeatCount.bounded(2),
  b::Element(e::Situational, "Address Information"),
  b::Element(e::Situational, "Address Information")),
b::Segment(170, s::N4, "Geographic Information", r::Situational, d::RepeatCount.bounded(1),
  b::Element(e::Situational, "City Name"),
  b::Element(e::Situational, "State or Province Code"),
  b::Element(e::Situational, "Postal Code"),
  b::Element(e::Situational, "Country Code"),
  b::Element(e::NotUsed,     "Location Qualifier"),
  b::Element(e::NotUsed,     "Location Identifier")),
b::Segment(190, s::G61, "Contact", r::Situational, d::RepeatCount.bounded(3),
  b::Element(e::Situational, "Contact Function Code"),
  b::Element(e::Situational, "Name"),
  b::Element(e::Situational, "Communication Number Qualifier"),
  b::Element(e::Situational, "Communication Number"),
  b::Element(e::NotUsed,     "Contact Inquiry Reference"))),

            d::LoopDef.build("LOOP 0200", d::RepeatCount.bounded(10),
b::Segment(200, s::N7, "Equipment Details", r::Required, d::RepeatCount.bounded(1),
  b::Element(e::NotUsed,     "Equipment Initial"),
  b::Element(e::Situational, "Equipment Number"),
  b::Element(e::NotUsed,     "Weight"),
  b::Element(e::NotUsed,     "Weight Qualifier"),
  b::Element(e::NotUsed,     "Tare Weight"),
  b::Element(e::NotUsed,     "Weight Allowance"),
  b::Element(e::NotUsed,     "Dunnage"),
  b::Element(e::NotUsed,     "Volume"),
  b::Element(e::NotUsed,     "Volume Unit Qualifier"),
  b::Element(e::NotUsed,     "Ownership Code"),
  b::Element(e::Situational, "Equipment Description Code"),
  b::Element(e::NotUsed,     "Standard Carrier Alpha Code"),
  b::Element(e::NotUsed,     "Temperature Control"),
  b::Element(e::NotUsed,     "Position"),
  b::Element(e::Situational, "Equipment Length"),
  b::Element(e::NotUsed,     "Tare Qualifier Code"),
  b::Element(e::NotUsed,     "Weight Unit Code"),
  b::Element(e::NotUsed,     "Equipment Number Check Digit"),
  b::Element(e::NotUsed,     "Type of Service Code"),
  b::Element(e::NotUsed,     "Height"),
  b::Element(e::NotUsed,     "Width"),
  b::Element(e::NotUsed,     "Equipment Type"),
  b::Element(e::NotUsed,     "Standard Carrier Alpha Code"),
  b::Element(e::NotUsed,     "Car Type Code")),
b::Segment(208, s::MEA, "Measurements", r::Situational, d::RepeatCount.bounded(1),
  b::Element(e::Situational, "Measurement Reference ID Code"),
  b::Element(e::Situational, "Measurement Qualifier"),
  b::Element(e::Situational, "Measurement Value"),
  b::Element(e::Situational, "Composite Unit of Measure"),
  b::Element(e::Situational, "Range Minimum"),
  b::Element(e::Situational, "Range Maximum"),
  b::Element(e::NotUsed,     "Measurement Significance Code"),
  b::Element(e::NotUsed,     "Measurement Attribute Code"),
  b::Element(e::NotUsed,     "Surface/Layer/Position Code"),
  b::Element(e::NotUsed,     "Measurement Method or Device Code"),
  b::Element(e::NotUsed,     "Code List Qualifier Code"),
  b::Element(e::NotUsed,     "Industry Code")),
b::Segment(210, s::M7, "Seal Numbers", r::Situational, d::RepeatCount.bounded(2),
  b::Element(e::Situational, "Seal Number"),
  b::Element(e::NotUsed,     "Seal Number"),
  b::Element(e::NotUsed,     "Seal Number"),
  b::Element(e::NotUsed,     "Seal Number"),
  b::Element(e::NotUsed,     "Entity Identifier Code")))),

          d::TableDef.detail("Detail",
            d::LoopDef.build("LOOP 0300", d::RepeatCount.bounded(999),
b::Segment(10, s::S5, "Stop Off Details", r::Required, d::RepeatCount.bounded(1),
  b::Element(e::Situational, "Stop Sequence Number"),
  b::Element(e::Situational, "Stop Reason Code"),
  b::Element(e::Situational, "Weight"),
  b::Element(e::Situational, "Weight Unit Code"),
  b::Element(e::Situational, "Number of Units Shipped"),
  b::Element(e::Situational, "Unit of Measure Code"),
  b::Element(e::Situational, "Volume"),
  b::Element(e::Situational, "Volume Unit Qualifier"),
  b::Element(e::NotUsed,     "Description"),
  b::Element(e::NotUsed,     "Standard Point Location Code"),
  b::Element(e::NotUsed,     "Accomplish Code")),
b::Segment(20, s::L11, "Business Instructions and Reference Number", r::Situational, d::RepeatCount.bounded(200),
  b::Element(e::Situational, "Reference Identification"),
  b::Element(e::Situational, "Reference Identification Qualifier"),
  b::Element(e::Situational, "Description")),
b::Segment(30, s::G62, "Date/Time", r::Situational, d::RepeatCount.bounded(2),
  b::Element(e::Situational, "Date Qualifier"),
  b::Element(e::Situational, "Date"),
  b::Element(e::Situational, "Time Qualifier"),
  b::Element(e::Situational, "Time"),
  b::Element(e::Situational, "Time Code")),
b::Segment(40, s::AT8, "Shipment Weight, Packaging and Quantity Data", r::Situational, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Weight Qualifier"),
  b::Element(e::Required,    "Weight Unit Code"),
  b::Element(e::Required,    "Weight"),
  b::Element(e::Required,    "Lading Quantity"),
  b::Element(e::Situational, "Lading Quantity"),
  b::Element(e::Situational, "Volume Unit Qualifier"),
  b::Element(e::Situational, "Volume")),
b::Segment(50, s::LAD, "Lading Detail", r::Situational, d::RepeatCount.bounded(999),
  b::Element(e::Situational, "Packaging Form Code"),
  b::Element(e::Situational, "Lading Quantity"),
  b::Element(e::Situational, "Weight Unit Code"),
  b::Element(e::Situational, "Unit Weight"),
  b::Element(e::Situational, "Weight Unit Code"),
  b::Element(e::Situational, "Weight"),
  b::Element(e::Situational, "Product/Service ID Qualifier"),
  b::Element(e::Situational, "Product/Service ID"),
  b::Element(e::Situational, "Product/Service ID Qualifier"),
  b::Element(e::Situational, "Product/Service ID"),
  b::Element(e::Situational, "Product/Service ID Qualifier"),
  b::Element(e::Situational, "Product/Service ID"),
  b::Element(e::Situational, "Lading Description")),
b::Segment(65, s::NTE, "Note/Special Instruction", r::Situational, d::RepeatCount.bounded(20),
  b::Element(e::Situational, "Note Reference Code"),
  b::Element(e::Situational, "Description")),

d::LoopDef.build("LOOP 0310", d::RepeatCount.bounded(1),
  b::Segment(70, s::N1, "Name", r::Required, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Entity Identifier Code"),
    b::Element(e::Required,    "Name"),
    b::Element(e::Situational, "Identification Code Qualifier"),
    b::Element(e::Situational, "Identification Code"),
    b::Element(e::NotUsed,     "Entity Relationship Code"),
    b::Element(e::NotUsed,     "Entity Identifier Code")),
  b::Segment(90, s::N3, "Address Information", r::Situational, d::RepeatCount.bounded(2),
    b::Element(e::Situational, "Address Information"),
    b::Element(e::Situational, "Address Information")),
  b::Segment(100, s::N4, "Geographic Location", r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Situational, "City Name"),
    b::Element(e::Situational, "State or Province Code"),
    b::Element(e::Situational, "Postal Code"),
    b::Element(e::Situational, "Country Code"),
    b::Element(e::NotUsed,     "Location Qualifier"),
    b::Element(e::NotUsed,     "Location Identifier")),
  b::Segment(120, s::G61, "Contact", r::Situational, d::RepeatCount.bounded(3),
    b::Element(e::Situational, "Contact Function Code"),
    b::Element(e::Situational, "Name"),
    b::Element(e::Situational, "Communication Number Qualifier"),
    b::Element(e::Situational, "Communication Number"),
    b::Element(e::NotUsed,     "Contact Inquiry Reference"))),

d::LoopDef.build("LOOP 0320", d::RepeatCount.bounded(99),
  b::Segment(130, s::L5, "Description, Marks and Numbers", r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Situational, "Lading Line Item Number"),
    b::Element(e::Required,    "Lading Description"),
    b::Element(e::Situational, "Commodity Code"),
    b::Element(e::Situational, "Commodity Code Qualifier"),
    b::Element(e::Situational, "Packaging Code"),
    b::Element(e::Situational, "Marks and Numbers"),
    b::Element(e::Situational, "Marks and Numbers Qualifier"),
    b::Element(e::Situational, "SKU"),
    b::Element(e::Situational, "SKU Qualifier Code"),
    b::Element(e::NotUsed,     "Compartment ID Code")),
  b::Segment(135, s::AT8, "Shipment Weight, Packaging and Quantity Data", r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Weight Qualifier"),
    b::Element(e::Required,    "Weight Unit Code"),
    b::Element(e::Required,    "Weight"),
    b::Element(e::Required,    "Lading Quantity"),
    b::Element(e::Situational, "Lading Quantity"),
    b::Element(e::Situational, "Volume Unit Qualifier"),
    b::Element(e::Situational, "Volume")),

  d::LoopDef.build("LOOP 0325", d::RepeatCount.bounded(99),
    b::Segment(140, s::G61, "Contact", r::Situational, d::RepeatCount.bounded(1),
      b::Element(e::Situational, "Contact Function Code", b::Values("HM")),
      b::Element(e::Situational, "Name"),
      b::Element(e::Situational, "Communication Number Qualifier", b::Values("TE")),
      b::Element(e::Situational, "Communication Number"),
      b::Element(e::NotUsed,     "Contact Inquiry Reference")),
    b::Segment(141, s::L11, "Business Instructions and Reference Number", r::Situational, d::RepeatCount.bounded(30),
      b::Element(e::Situational, "Reference Identification"),
      b::Element(e::Situational, "Reference Identification Qualifier"),
      b::Element(e::Situational, "Description")),

    d::LoopDef.build("LOOP 0330", d::RepeatCount.bounded(25),
      b::Segment(143, s::LH1, "Hazardous Identification Information", r::Situational, d::RepeatCount.bounded(1),
        b::Element(e::Required,    "Unit or Basis for Measurement Code"),
        b::Element(e::Required,    "Lading Quantity"),
        b::Element(e::Situational, "UN/NA Identification Code"),
        b::Element(e::Situational, "Hazardous Materials Page"),
        b::Element(e::Situational, "Commodity Code"),
        b::Element(e::Situational, "Unit or Basis for Measurement Code"),
        b::Element(e::Situational, "Quantity"),
        b::Element(e::NotUsed,     "Compartment ID Code"),
        b::Element(e::NotUsed,     "Residue Indicator Code"),
        b::Element(e::Situational, "Packing Group Code"),
        b::Element(e::NotUsed,     "Interim Hazardous Material Regulatory Number"),
        b::Element(e::NotUsed,     "Industry Code")),
      b::Segment(144, s::LH2, "Hazardous Classification Information", r::Situational, d::RepeatCount.bounded(4),
        b::Element(e::Required,    "Hazardous Classification"),
        b::Element(e::Required,    "Hazardous Class Qualifier"),
        b::Element(e::NotUsed,     "Hazardous Placard Notation"),
        b::Element(e::NotUsed,     "Hazardous Endorsement"),
        b::Element(e::NotUsed,     "Reportable Quantity Code"),
        b::Element(e::NotUsed,     "Unit or Basis for Measurement Code"),
        b::Element(e::NotUsed,     "Temperature"),
        b::Element(e::NotUsed,     "Unit or Basis for Measurement Code"),
        b::Element(e::NotUsed,     "Temperature"),
        b::Element(e::NotUsed,     "Unit or Basis for Measurement Code"),
        b::Element(e::NotUsed,     "Temperature"),
        b::Element(e::NotUsed,     "Weight Unit Code"),
        b::Element(e::NotUsed,     "Net Explosive Quantity")),
      b::Segment(145, s::LH3, "Hazardous Material Shipping Name", r::Situational, d::RepeatCount.bounded(10),
        b::Element(e::Required,    "Hazardous Material Shipping Name"),
        b::Element(e::Required,    "Hazardous Material Shipping Name Qualifier"),
        b::Element(e::NotUsed,     "N.O.S. Indicator Code"),
        b::Element(e::NotUsed,     "Yes/No Condition or Response Code")),
      b::Segment(146, s::LFH, "Freeform Hazardous Material Information", r::Situational, d::RepeatCount.bounded(20),
        b::Element(e::Required,    "Hazardous Material Shipment Information Qualifier"),
        b::Element(e::Required,    "Hazardous Material Shipment Information"),
        b::Element(e::NotUsed,     "Hazardous Material Shipment Information"),
        b::Element(e::NotUsed,     "Hazard Zone Code"),
        b::Element(e::NotUsed,     "Unit or Basis for Measurement Code"),
        b::Element(e::NotUsed,     "Quantity"),
        b::Element(e::NotUsed,     "Quantity"),
        b::Element(e::NotUsed,     "Date"))))),

    d::LoopDef.build("LOOP 0350", d::RepeatCount.bounded(999),
      b::Segment(150, s::OID, "Order Identification Detail", r::Situational, d::RepeatCount.bounded(1),
        b::Element(e::Optional,    "Reference Identification"),
        b::Element(e::Required,    "Purchase Order Number"),
        b::Element(e::Required,    "Unit or Basis for Measurement Code"),
        b::Element(e::Required,    "Quantity"),
        b::Element(e::Situational, "Weight Unit Code"),
        b::Element(e::Situational, "Weight"),
        b::Element(e::Situational, "Volume Unit Qualifier"),
        b::Element(e::Situational, "Volume")),

      d::LoopDef.build("LOOP 0360", d::RepeatCount.bounded(99),
        b::Segment(190, s::L5, "Description, Marks and Numbers", r::Situational, d::RepeatCount.bounded(1),
          b::Element(e::Situational, "Lading Line Item Number"),
          b::Element(e::Situational, "Lading Description"),
          b::Element(e::Situational, "Commodity Code"),
          b::Element(e::Situational, "Commodity Code Qualifier"),
          b::Element(e::NotUsed,     "Packaging Code"),
          b::Element(e::NotUsed,     "Marks and Numbers"),
          b::Element(e::NotUsed,     "Marks and Numbers Qualifier"),
          b::Element(e::NotUsed,     "Commodity Code"),
          b::Element(e::NotUsed,     "Commodity Code Qualifier"),
          b::Element(e::NotUsed,     "Compartment ID Code")),
        b::Segment(195, s::AT8, "Shipment Weight, Packaging and Quantity Data", r::Situational, d::RepeatCount.bounded(1),
          b::Element(e::Required,    "Weight Qualifier"),
          b::Element(e::Required,    "Weight Unit Code"),
          b::Element(e::Required,    "Weight"),
          b::Element(e::Required,    "Lading Quantity"),
          b::Element(e::Situational, "Lading Quantity"),
          b::Element(e::Situational, "Volume Unit Qualifier"),
          b::Element(e::Situational, "Volume")),

        d::LoopDef.build("LOOP 0365", d::RepeatCount.bounded(99),
          b::Segment(200, s::G61, "Contact", r::Situational, d::RepeatCount.bounded(1),
            b::Element(e::Situational, "Contact Function Code"),
            b::Element(e::Situational, "Name"),
            b::Element(e::Situational, "Communication Number Qualifier"),
            b::Element(e::Situational, "Communication Number"),
            b::Element(e::NotUsed,     "Contact Inquiry Reference")),
          b::Segment(201, s::L11, "Business Instructions and Reference Number", r::Situational, d::RepeatCount.bounded(5),
            b::Element(e::Situational, "Reference Identification"),
            b::Element(e::Situational, "Reference Identification Qualifier"),
            b::Element(e::Situational, "Description")),

          d::LoopDef.build("LOOP 0370", d::RepeatCount.bounded(25),
            b::Segment(203, s::LH1, "Hazardous Identification Information", r::Situational, d::RepeatCount.bounded(1),
              b::Element(e::Required,    "Unit or Basis for Measurement Code"),
              b::Element(e::Required,    "Lading Quantity"),
              b::Element(e::Situational, "UN/NA Identification Code"),
              b::Element(e::Situational, "Hazardous Materials Page"),
              b::Element(e::Situational, "Commodity Code"),
              b::Element(e::Situational, "Unit or Basis for Measurement Code"),
              b::Element(e::Situational, "Quantity"),
              b::Element(e::NotUsed,     "Compartment ID Code"),
              b::Element(e::NotUsed,     "Residue Indicator Code"),
              b::Element(e::Situational, "Packing Group Code"),
              b::Element(e::NotUsed,     "Interim Hazardous Material Regulatory Number"),
              b::Element(e::NotUsed,     "Industry Code")),
            b::Segment(204, s::LH2, "Hazardous Classification Information ", r::Situational, d::RepeatCount.bounded(4),
              b::Element(e::Required,    "Hazardous Classification"),
              b::Element(e::Required,    "Hazardous Class Qualifier"),
              b::Element(e::NotUsed,     "Hazardous Placard Notation"),
              b::Element(e::NotUsed,     "Hazardous Endorsement"),
              b::Element(e::NotUsed,     "Reportable Quantity Code"),
              b::Element(e::NotUsed,     "Unit or Basis for Measurement Code"),
              b::Element(e::NotUsed,     "Temperature"),
              b::Element(e::NotUsed,     "Unit or Basis for Measurement Code"),
              b::Element(e::NotUsed,     "Temperature"),
              b::Element(e::NotUsed,     "Unit or Basis for Measurement Code"),
              b::Element(e::NotUsed,     "Temperature"),
              b::Element(e::NotUsed,     "Weight Unit Code"),
              b::Element(e::NotUsed,     "Net Explosive Quantity")),
            b::Segment(205, s::LH3, "Hazardous Material Shipping Name", r::Situational, d::RepeatCount.bounded(10),
              b::Element(e::Required,    "Hazardous Material Shipping Name"),
              b::Element(e::Required,    "Hazardous Material Shipping Name Qualifier"),
              b::Element(e::NotUsed,     "N.O.S. Indicator Code"),
              b::Element(e::NotUsed,     "Yes/No Condition or Response Code")),
            b::Segment(206, s::LFH, "Freeform Hazardous Material Information", r::Situational, d::RepeatCount.bounded(20),
              b::Element(e::Required,    "Hazardous Material Shipment Information Qualifier"),
              b::Element(e::Required,    "Hazardous Material Shipment Information"),
              b::Element(e::NotUsed,     "Hazardous Material Shipment Information"),
              b::Element(e::NotUsed,     "Hazard Zone Code"),
              b::Element(e::NotUsed,     "Unit or Basis for Measurement Code"),
              b::Element(e::NotUsed,     "Quantity"),
              b::Element(e::NotUsed,     "Quantity"),
              b::Element(e::NotUsed,     "Date")))))))),

          d::TableDef.summary("Summary",
            b::Segment(10, s::L3, "Total Weight and Charges", r::Situational, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Weight"),
b::Element(e::Required,    "Weight Qualifier"),
b::Element(e::Situational, "Freight Rate"),
b::Element(e::Situational, "Rate/Value Qualifier"),
b::Element(e::Situational, "Charge"),
b::Element(e::NotUsed,     "Advances"),
b::Element(e::NotUsed,     "Prepaid Amount"),
b::Element(e::NotUsed,     "Special Charge or Allowance Code"),
b::Element(e::Situational, "Volume"),
b::Element(e::Situational, "Volume Unit Qualifier"),
b::Element(e::Situational, "Lading Quantity"),
b::Element(e::Situational, "Weight Unit Code"),
b::Element(e::NotUsed,     "Tariff Number"),
b::Element(e::Situational, "Declared Value"),
b::Element(e::Situational, "Rate/Value Qualifier")),
            b::Segment(20, s::SE, "Transaction Set Trailer", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Situational, "Number of Included Segments"),
b::Element(e::Situational, "Transaction Set Control Number"))))
SQ866 =
b.build("SQ", "866", "",
          d::TableDef.header("Header",
            b::Segment(10, s:: ST, "Transaction Set Header", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Transaction Set Identifier Code", b::Values("866")),
b::Element(e::Required,    "Transaction Set Control Number")),
            b::Segment(20, s::BSS, "Beginning Segment for Shipping Schedule/Production Sequence", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Transaction Set Purpose Code", b::Values("05")),
b::Element(e::Required,    "Reference Identification - Nissan Transaction Number", b::Values("SP","CP")),
b::Element(e::Required,    "Date"),
b::Element(e::Required,    "Schedule Type Qualifier", b::Values("JS")),
b::Element(e::Required,    "Date - Today's Date (CCYYMMDD)"),
b::Element(e::Required,    "Date - Today's Date (CCYYMMDD)"),
b::Element(e::Situational, "Release Number"),
b::Element(e::Situational, "Reference Identification"),
b::Element(e::NotUsed,     ""),
b::Element(e::NotUsed,     ""),
b::Element(e::NotUsed,     ""))),

          d::TableDef.header("Detail",
            d::LoopDef.build("DTM", d::RepeatCount.bounded(100),
b::Segment(110, s::DTM, "Date/Time Reference", r::Required, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Date/Time Qualifier", b::Values("097")),
  b::Element(e::Situational, "Date - Create Date (CCYYMMDD)"),
  b::Element(e::Situational, "Time - Create Time (HHMMSS)"),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     "")),

d::LoopDef.build("LIN", d::RepeatCount.unbounded,
  b::Segment(150, s::LIN, "Item Identification", r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::NotUsed,     ""),
    b::Element(e::Required,    "Product/Service ID Qualifier", b::Values("BP")),
    b::Element(e::Required,    "Product/Service ID - Nissan Part Number"),
    b::Element(e::Situational, "Product/Service ID Qualifier", b::Values("JS")),
    b::Element(e::Situational, "Product/Service ID - Parts Delivery Sequence Number (PDSN)"),
    b::Element(e::Situational, "Product/Service ID Qualifier - Vehicle ID", b::Values("VV")),
    b::Element(e::Situational, "Product/Service ID - Vehicle Identification Number (VIN)"),
    b::Element(e::NotUsed,     ""),
    b::Element(e::NotUsed,     ""),
    b::Element(e::NotUsed,     ""),
    b::Element(e::NotUsed,     ""),
    b::Element(e::NotUsed,     ""),
    b::Element(e::NotUsed,     ""),
    b::Element(e::NotUsed,     ""),
    b::Element(e::NotUsed,     ""),
    b::Element(e::NotUsed,     ""),
    b::Element(e::NotUsed,     ""),
    b::Element(e::NotUsed,     ""),
    b::Element(e::NotUsed,     ""),
    b::Element(e::NotUsed,     ""),
    b::Element(e::NotUsed,     ""),
    b::Element(e::NotUsed,     ""),
    b::Element(e::NotUsed,     ""),
    b::Element(e::NotUsed,     ""),
    b::Element(e::NotUsed,     ""),
    b::Element(e::NotUsed,     ""),
    b::Element(e::NotUsed,     ""),
    b::Element(e::NotUsed,     ""),
    b::Element(e::NotUsed,     ""),
    b::Element(e::NotUsed,     ""),
    b::Element(e::NotUsed,     "")),
  b::Segment(160, s::REF, "Reference Identification - Dock Number", r::Situational, d::RepeatCount.unbounded,
    b::Element(e::Required,    "Reference Identification Qualifier", b::Values("DK")),
    b::Element(e::Situational, "Reference Identification - Dock Number"),
    b::Element(e::NotUsed,     ""),
    b::Element(e::NotUsed,     "")),
  b::Segment(160, s::REF, "Reference Identification - Line Feed Location", r::Situational, d::RepeatCount.unbounded,
    b::Element(e::Required,    "Reference Identification Qualifier", b::Values("LF")),
    b::Element(e::Required,    "Reference Identification"),
    b::Element(e::NotUsed,     ""),
    b::Element(e::NotUsed,     "")),
  b::Segment(170, s::QTY, "Quantity", r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Quantity Qualifier", b::Values("01")),
    b::Element(e::Situational, "Quantity"))))),

          d::TableDef.header("Summary",
            b::Segment(195, s::CTT, "Transaction Totals", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Number of Line Items"),
b::Element(e::NotUsed,     ""),
b::Element(e::NotUsed,     ""),
b::Element(e::NotUsed,     ""),
b::Element(e::NotUsed,     ""),
b::Element(e::NotUsed,     ""),
b::Element(e::NotUsed,     "")),
            b::Segment(200, s::SE, "Transaction Set Trailer", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Number of Included Segments"),
b::Element(e::Required,    "Transaction Set Control Number"))))
SS862 =
b.build("SS", "862", "",
          d::TableDef.header("Header",
            b::Segment(10, s:: ST, "Transaction Set Header", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Transaction Set Identifier Code", b::Values("862")),
b::Element(e::Required,    "Transaction Set Control Number")),
            b::Segment(20, s::BSS, "Beginning Segment for Shipping Schedule/Production Sequence", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Transaction Set Purpose Code", b::Values("00","01","05")),
b::Element(e::Required,    "Reference Identification - Ship Schedule Number"),
b::Element(e::Required,    "Date - Create date for this transaction"),
b::Element(e::Required,    "Schedule Type Qualifier", b::Values("SH")),
b::Element(e::Required,    "Date - Horizon Start"),
b::Element(e::Required,    "Date - Horizon End"),
b::Element(e::NotUsed,     ""),
b::Element(e::Situational, "Reference Identification"),
b::Element(e::NotUsed,     ""),
b::Element(e::NotUsed,     ""),
b::Element(e::Situational, "Schedule Quantity Qualifier", b::Values("A"))),
            b::Segment(30, s::DTM, "Date/Time Reference", r::Situational, d::RepeatCount.bounded(10),
b::Element(e::Required,    "Date/Time Qualifier", b::Values("193","194")),
b::Element(e::Situational, "Date"),
b::Element(e::Situational, "Time - Window Start/ Stop"),
b::Element(e::NotUsed,     ""),
b::Element(e::NotUsed,     ""),
b::Element(e::NotUsed,     "")),

            d::LoopDef.build("N1", d::RepeatCount.bounded(200),
b::Segment(50, s:: N1, "Name", r::Situational, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Entity Identifier Code", b::Values("MI", "SI", "SU")),
  b::Element(e::Situational, "Name"),
  b::Element(e::Situational, "Identification Code Qualifier", b::Values("2","92")),
  b::Element(e::Situational, "Identification Code"),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     "")),
b::Segment(90, s::REF,  "Reference Identification", r::Situational, d::RepeatCount.bounded(12),
  b::Element(e::Required,    "Reference Identification Qualifier", b::Values("P8", "PE", "RG","RU","SI")),
  b::Element(e::Situational, "Reference Identification"),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     "")),
b::Segment(100, s::PER, "Administrative Communications Contact", r::Situational, d::RepeatCount.bounded(3),
  b::Element(e::Required,    "Contact Function Code", b::Values("CN")),
  b::Element(e::Situational, "Name - NNA Logistics Contact"),
  b::Element(e::Situational, "Communication Number Qualifier", b::Values("TE")),
  b::Element(e::Situational, "Communication Number - Phone Number"),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     "")))),

          d::TableDef.header("Detail",
            d::LoopDef.build("LIN", d::RepeatCount.bounded(10000),
b::Segment( 10, s::LIN, "Item Identification", r::Required, d::RepeatCount.bounded(1),
  b::Element(e::Situational, "Assigned Identification LINE Number"),
  b::Element(e::Required,    "Product/Service ID Qualifier", b::Values("BP")),
  b::Element(e::Required,    "Product/Service ID - NNA Part Number"),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     "")),
b::Segment( 20, s::UIT, "Unit Detail - Detail 1", r::Required, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Composite Unit of Measure",
  b::Element(e::Required,    "Unit or Basis for Measurement Code", b::Values("PC")),
  b::Element(e::NotUsed,     "Exponent"),
  b::Element(e::NotUsed,     "Multiplier"),
  b::Element(e::Situational, "Unit or Basis for Measurement Code", b::Values("LB")),
  b::Element(e::NotUsed,     "Exponent"),
  b::Element(e::Situational, "Multiplier")),
  b::Element(e::Required,    "Unit or Basis for Measurement Code", b::Values("EA"))),
b::Segment(50, s::REF, "Reference Identification", r::Situational, d::RepeatCount.bounded(12),
  b::Element(e::Required,    "Reference Identification Qualifier", b::Values("DK","LU","P5")),
  b::Element(e::Situational, "Reference Identification"),
  b::Element(e::NotUsed,     ""),
  b::Element(e::NotUsed,     "")),

d::LoopDef.build("FST", d::RepeatCount.bounded(100),
  b::Segment( 80, s::FST, "Forecast Schedule", r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Quantity - RAN Quantity"),
    b::Element(e::Required,    "Forecast Qualifier", b::Values("C")),
    b::Element(e::Required,    "Forecast Timing Qualifier", b::Values("D")),
    b::Element(e::Required,    "Date - Ship Date"),
    b::Element(e::NotUsed,     ""),
    b::Element(e::Situational, "Date/Time Qualifier"),
    b::Element(e::Situational, "Time - of Shipment"),
    b::Element(e::Situational, "Reference Number Qualifier", b::Values("DO")),
    b::Element(e::Situational, "Reference Number - RAN Number")),

  d::LoopDef.build("JIT", d::RepeatCount.bounded(96),
    b::Segment( 110, s::JIT, "Just-In-Time Schedule", r::Situational, d::RepeatCount.bounded(1),
      b::Element(e::Required,    "Quantity - QTY to be picked up"),
      b::Element(e::Required,    "Time - Pick up Time")),
    b::Segment( 120, s::REF,  "Reference Identification", r::Situational, d::RepeatCount.bounded(500),
      b::Element(e::Required,    "Reference Identification Qualifier", b::Values("P5")),
      b::Element(e::Situational, "Reference Identification - Position in Truck"),
      b::Element(e::NotUsed,     ""),
      b::Element(e::Situational, "Reference Identifier",
      b::Element(e::Required,    "Reference Identification Qualifier", b::Values("DO")),
      b::Element(e::Required,    "Reference Identification RAN Number"),
      b::Element(e::Situational, "Reference Identification Qualifier", b::Values("LU")),
      b::Element(e::Situational, "Reference Identification - Receiving Location"),
      b::Element(e::Situational, "Reference Identification Qualifier", b::Values("DK")),
      b::Element(e::Situational, "Reference Identification - Dock Number"))))))),

          d::TableDef.header("Summary",
            b::Segment(10, s::CTT, "Transaction Totals", r::Situational, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Number of Units Shipped"),
b::Element(e::NotUsed,     ""),
b::Element(e::NotUsed,     ""),
b::Element(e::NotUsed,     ""),
b::Element(e::NotUsed,     ""),
b::Element(e::NotUsed,     ""),
b::Element(e::NotUsed,     "")),
            b::Segment(30, s::SE, "Transaction Set Trailer", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Number of Included Segments"),
b::Element(e::Required,    "Transaction Set Control Number"))))
SW945 =
b.build("SW", "945", "",
          d::TableDef.header("Header",
            b::Segment(10, s:: ST, "Transaction Set Header", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Transaction Set Identifier Code", b::Values("944")),
b::Element(e::Required,    "Transaction Set Control Number")),
            b::Segment(20, s::W06, "Warehouse Shipment Identification", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Reporting Code", b::Values("F")),
b::Element(e::Required,    "Depositor Order Number"),
b::Element(e::Situational, "Date"),
b::Element(e::Required,    "Shipment Identification Number"),
b::Element(e::Situational, "Agent Shipment ID Number")),

            d::LoopDef.build("N1", d::RepeatCount.bounded(10),
b::Segment(40, s:: N1, "Name", r::Situational, d::RepeatCount.bounded(2),
  b::Element(e::Required,    "Entity Identifier Code", b::Values("ST", "SF")),
  b::Element(e::Situational, "Name"),
  b::Element(e::Situational, "Identification Code Qualifier", b::Values("91")),
  b::Element(e::Situational, "Identification Code")),
b::Segment(60, s:: N3, "Address Information", r::Situational, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Address Information"),
  b::Element(e::Situational, "Address Information")),
b::Segment(70, s:: N4, "Geographic Location", r::Situational, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "City Name"),
  b::Element(e::Required,    "State Code"),
  b::Element(e::Situational, "Postal Code"))),

            b::Segment(90, s:: N9, "Reference Number", r::Situational, d::RepeatCount.bounded(10),
b::Element(e::Required,    "Reference Identification Qualifier", b::Values("BR", "CO")),
b::Element(e::Required,    "Reference Identification")),
            b::Segment(110, s::G62, "Date/Time Reference", r::Situational, d::RepeatCount.bounded(2),
b::Element(e::Situational, "Date Qualifier"),
b::Element(e::Situational, "Date"),
b::Element(e::Situational, "Time Qualifier"),
b::Element(e::Situational, "Time"),
b::Element(e::Situational, "Time Code")),
            b::Segment(130, s::W27, "Carrier Detail", r::Situational, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Transportation Method/Type Code", b::Values("M", "R", "H", "LT")),
b::Element(e::Situational, "Standard Carrier Alpha Code"),
b::Element(e::Situational, "Routing"),
b::Element(e::Situational, "Shipment Method of Payment", b::Values("CC", "PC", "PP", "PU", "TP")),
b::Element(e::Situational, "Equipment Initial"),
b::Element(e::Situational, "Equipment Number"))),

          d::TableDef.header("Detail",
            d::LoopDef.build("LX", d::RepeatCount.bounded(9999),
b::Segment(5, s::LX, "Assigned Number", r::Required, d::RepeatCount.bounded(1))),

            d::LoopDef.build("W12", d::RepeatCount.bounded(9999),
b::Segment(20, s::W12, "Item Detail For Stock Receipt", r::Required, d::RepeatCount.bounded(1),
  b::Element(e::Mandatory,   "Shipment/Order Status Code"),
  b::Element(e::Situational, "Quantity Ordered"),
  b::Element(e::Situational, "Number of Units Shipped"),
  b::Element(e::Situational, "Quantity Difference"),
  b::Element(e::Situational, "Unit or Basis for Measurement Code", b::Values("CA", "LB", "EA")),
  b::Element(e::Situational, "UPC Case Code"),
  b::Element(e::Situational, "Product/Service ID Qualifier", b::Values("CB", "BP")),
  b::Element(e::Situational, "Product/Service ID"),
  b::Element(e::Situational, "Warehouse Lot Number"),
  b::Element(e::Situational, "Weight"),
  b::Element(e::Situational, "Weight Qualifier", b::Values("G")),
  b::Element(e::Situational, "Weight Unit Code", b::Values("K", "L")),
  b::Element(e::Situational, "Weight"),
  b::Element(e::Situational, "Weight Qualifier", b::Values("G")),
  b::Element(e::Situational, "Weight Unit Code", b::Values("K", "L")),
  b::Element(e::Situational, "Unused"),
  b::Element(e::Situational, "Product/Service ID Qualifier", b::Values("VN", "JP")),
  b::Element(e::Situational, "Product/Service ID"),
  b::Element(e::Situational, "Line Item Change Reason Code", b::Values("01", "02")),
  b::Element(e::Situational, "Unused"),
  b::Element(e::Situational, "Product/Service ID Qualifier", b::Values("ZZ", "UP")),
  b::Element(e::Situational, "Product/Service ID")),
b::Segment(30, s::G69, "Line Item Detail - Description", r::Situational, d::RepeatCount.bounded(1),
  b::Element(e::Mandatory,   "Free-form descriptive text")),
b::Segment(40, s::N9, "Reference Identification", r::Situational, d::RepeatCount.bounded(200),
  b::Element(e::Mandatory,   "Reference Identification Qualifier"),
  b::Element(e::Situational, "Reference Identification")))),

          d::TableDef.header("Summary",
            b::Segment(10, s::W03, "Total Shipment Information", r::Situational, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Number of Units Shipped")),
            b::Segment(30, s::SE, "Transaction Set Trailer", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Number of Included Segments"),
b::Element(e::Required,    "Transaction Set Control Number"))))