#------------------------------------------------------------------------
# FSR
#------------------------------------------------------------------------

FSR =    
    StandardMessageIdentification
    ConsignmentDetail
    *FlightDetails
    [OtherServiceInformation];

# Standard Message Identification
# -------------------------------
StandardMessageIdentification =
    "FSR" 
    CRLF;

# Consignment Detail
# ------------------
ConsignmentDetail =    
    AWBIdentification 
    [AWBOriginAndDestination]
    [QuantityDetail]
    [NatureOfGoods]
    CRLF;

AWBIdentification =    
    DE112_AirlinePrefix 
    Hyphen
    DE113_AWBSerialNumber;

AWBOriginAndDestination =
    2DE313_AirportCityCode;

QuantityDetail =
    Slant
    (    DE703_ShipmentDescriptionCode_T 
        DE701_NumberOfPieces 
        [DE601_WeightCode DE600_Weight]
    ) / 
    (    DE703_ShipmentDescriptionCode_P 
        DE701_NumberOfPieces 
        [DE601_WeightCode DE600_Weight] 
        TotalConsignmentPieces
    );

TotalConsignmentPieces =
    DE703_ShipmentDescriptionCode_T 
    DE701_NumberOfPieces;
    
NatureOfGoods =
    Slant
    DE708_ManifestDescriptionOfGoods;

# Flight Details
# --------------
FlightDetails =
    DE312_CarrierCode
    [DE800_FlightNumber]
    Slant
    [DE202_Day DE201_Month]
    Slant
    AirportsOfDepartureAndArrival
    CRLF;

AirportsOfDepartureAndArrival =
    2DE313_AirportCode;

# Other Service Information
# -------------------------
OtherServiceInformation =
    DE103_LineIdentifier_OSI
    1*2(Slant
        DE405_OtherServiceInformation
        CRLF);

# Data Elements
# -------------
DE101_StandardMessageIdentifier         = 3Alpha;
DE103_LineIdentifier                    = 3Alpha;
DE103_LineIdentifier_OSI                = "OSI";
DE112_AirlinePrefix                     = 3Numeric;
DE113_AWBSerialNumber                   = 8Numeric;
DE201_Month                             = 3Alpha;
DE202_Day                               = 2Numeric;
DE312_CarrierCode                       = 2Mixed;
DE313_AirportCode                       = 3Alpha;
DE313_AirportCityCode                   = 3Alpha;
DE405_OtherServiceInformation           = 1*65Text;
DE600_Weight                            = 1*7Decimal;
DE601_WeightCode                        = Alpha;
DE701_NumberOfPieces                    = 1*4Numeric;
DE703_ShipmentDescriptionCode           = "T" / "P";
DE703_ShipmentDescriptionCode_T         = "T";
DE703_ShipmentDescriptionCode_P         = "P";
DE708_ManifestDescriptionOfGoods        = 1*15Text;
DE800_FlightNumber                      = 3*4Numeric [Alpha];

# Types
# -----
CRLF    = (CR LF) / LF; 
CR      = %x0D;
LF      = %x0A;
Slant   = "/";
Hyphen  = "-";
Alpha   = %x41-5A;
Numeric = %x30-39;
Decimal = %x30-39 / ".";
Mixed   = Alpha / Numeric;
Text    = %x41-5A / %x30-39 / "." / "-" / " ";

#------------------------------------------------------------------------
# eof
#------------------------------------------------------------------------