Module: Stupidedi::Contrib::FortyTen::Guides

Defined in:
lib/stupidedi/contrib/004010/guides.rb,
lib/stupidedi/contrib/004010/guides/AR943.rb,
lib/stupidedi/contrib/004010/guides/FA997.rb,
lib/stupidedi/contrib/004010/guides/GF990.rb,
lib/stupidedi/contrib/004010/guides/OW940.rb,
lib/stupidedi/contrib/004010/guides/PO850.rb,
lib/stupidedi/contrib/004010/guides/PS830.rb,
lib/stupidedi/contrib/004010/guides/QM214.rb,
lib/stupidedi/contrib/004010/guides/RE944.rb,
lib/stupidedi/contrib/004010/guides/SH856.rb,
lib/stupidedi/contrib/004010/guides/SM204.rb,
lib/stupidedi/contrib/004010/guides/SQ866.rb,
lib/stupidedi/contrib/004010/guides/SS862.rb,
lib/stupidedi/contrib/004010/guides/SW945.rb

Constant Summary collapse

GuideBuilder =
Stupidedi::Guides::FortyTen::GuideBuilder
SegmentReqs =
Stupidedi::Guides::FortyTen::SegmentReqs
ElementReqs =
Stupidedi::Guides::FortyTen::ElementReqs
AR943 =

Purchase Order

b.build(t::AR943,
          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 =

Response to a Load Tender

b.build(t::FA997,
          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 =

Response to a Load Tender

b.build(t::GF990,
          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::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"))))
OW940 =

Warehouse Ship Order

b.build(t::OW940,
          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 =

Purchase Order

b.build(t::PO850,
          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::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(t::PS830,
          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 =

Transportation Carrier Shipment Status Message

b.build(t::QM214,
          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::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"))),

            # BUG: Getting "undefined method 'position' for
            # #<Stupidedi::Schema::LoopDef when a segment is sandwiched
            # between 2 loops.  Defininig artificial loop to get around the
            # problem.
            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::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::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::Required,    "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(t::RE944,
          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 =

t = Contrib::FortyTen::TransactionSetDefs

Ship Notice/Manifest

b.build(t::SH856,
          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(0100, 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(0200, 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 =

Motor Carrier Load Tender

b.build(t::SM204,
          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::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::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::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::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"))),

            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,     "Not Available"),
  b::Element(e::Situational, "Equipment Number"),
  b::Element(e::NotUsed,     "Not Available"),
  b::Element(e::NotUsed,     "Not Available"),
  b::Element(e::NotUsed,     "Not Available"),
  b::Element(e::NotUsed,     "Not Available"),
  b::Element(e::NotUsed,     "Not Available"),
  b::Element(e::NotUsed,     "Not Available"),
  b::Element(e::NotUsed,     "Not Available"),
  b::Element(e::NotUsed,     "Not Available"),
  b::Element(e::Situational, "Equipment Description Code"),
  b::Element(e::NotUsed,     "Not Available"),
  b::Element(e::NotUsed,     "Not Available"),
  b::Element(e::NotUsed,     "Not Available"),
  b::Element(e::Situational, "Equipment Length")),

b::Segment(208, s::MEA, "Measurements",
  r::Situational, d::RepeatCount.bounded(1),
  b::Element(e::NotUsed,     "Not Available"),
  b::Element(e::NotUsed,     "Not Available"),
  b::Element(e::NotUsed,     "Not Available"),
  b::Element(e::NotUsed,     "Composite Unit of Measure"),
  b::Element(e::Situational, "Range Minimum"),
  b::Element(e::Situational, "Range Maximum")),

b::Segment(210, s::M7, "Seal Numbers",
  r::Situational, d::RepeatCount.bounded(2),
  b::Element(e::Situational, "Seal Number")))),

          d::TableDef.header("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::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::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(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::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::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"))),

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::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::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")),

    d::LoopDef.build("LOOP 0330",
      d::RepeatCount.bounded(25),
      b::Segment(143, s::LH1, "Hazardous Identification Information",
        r::Required, d::RepeatCount.bounded(1),
        b::Element(e::Required,    "Unit or Basis for Measurement Code"),
        b::Element(e::Situational, "Lading Quantity"),
        b::Element(e::Required,    "UN/NA Identification Code"),
        b::Element(e::NotUsed,     "Not Available"),
        b::Element(e::NotUsed,     "Not Available"),
        b::Element(e::NotUsed,     "Not Available"),
        b::Element(e::NotUsed,     "Not Available"),
        b::Element(e::NotUsed,     "Not Available"),
        b::Element(e::NotUsed,     "Not Available"),
        b::Element(e::Required,    "Packing Group 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::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::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"))))))),

          d::TableDef.header("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,     "Not Available"),
b::Element(e::NotUsed,     "Not Available"),
b::Element(e::NotUsed,     "Not Available"),
b::Element(e::Situational, "Volume"),
b::Element(e::Situational, "Volume Unit Qualifier"),
b::Element(e::NotUsed,     "Not Available"),
b::Element(e::NotUsed,     "Not Available"),
b::Element(e::NotUsed,     "Not Available"),
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(t::SQ866,
          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(t::SS862,
          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(t::SW945,
          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"))))