#------------------------------------------------------------------------
# FFR/6
#------------------------------------------------------------------------

FFR6 =    
    StandardMessageIdentification
    ConsignmentDetail
    1*FlightDetails
    [ULDDescription]
    [SpecialServiceRequest]
    [OtherServiceInformation]
    BookingReference
    [DimensionsInformation]
    [ProductInformation]
    [Shipper]
    [Consignee]
    [CustomerIdentification]
    [ShipmentReferenceInformation];

# Standard Message Identification
# -------------------------------
StandardMessageIdentification =
    "FFR/6" 
    CRLF;

# Consignment Detail
# ------------------
ConsignmentDetail =    
    AWBIdentification 
    AWBOriginAndDestination
    (
        (
            QuantityDetail_Part
            [DensityGroup / VolumeDetail]
            TotalConsignmentPieces
        )
        /
        (
            QuantityDetail_Total    
            [DensityGroup / VolumeDetail]
        )
    )
    NatureOfGoods    
    [CRLF 1*9SpecialHandlingRequirements]
    CRLF;

AWBIdentification =    
    DE112_AirlinePrefix 
    Hyphen
    DE113_AWBSerialNumber;

AWBOriginAndDestination =
    2DE313_AirportCityCode;

QuantityDetail_Total =
    Slant
    DE703_ShipmentDescriptionCode_T 
    DE701_NumberOfPieces 
    DE601_WeightCode 
    DE600_Weight;

QuantityDetail_Part =
    Slant
    DE703_ShipmentDescriptionCode_P 
    DE701_NumberOfPieces 
    DE601_WeightCode 
    DE600_Weight;

VolumeDetail =
    DE604_VolumeCode
    DE500_VolumeAmount;
    
DensityGroup =
    DE603_DensityIndicator_DG
    DE602_DensityGroup;
    
TotalConsignmentPieces =
    DE703_ShipmentDescriptionCode_T
    DE701_NumberOfPieces;
    
NatureOfGoods =
    Slant
    DE708_ManifestDescriptionOfGoods;
    
SpecialHandlingRequirements = 
    Slant
    DE705_SpecialHandlingCode;
    
# Flight Details
# --------------
FlightDetails =
    FLT_FlightIdentification
    Slant
    FLT_AirportsOfDepartureAndArrival
    Slant
    (
        (DE409_SpaceAllocationCode_CA
         FLT_AllotmentIdentification)
        /
        DE409_SpaceAllocationCode
    )
    CRLF;

FLT_FlightIdentification =
    DE312_CarrierCode
    DE800_FlightNumber
    Slant
    DE202_Day
    DE201_Month;
    
FLT_AirportsOfDepartureAndArrival =
    2DE313_AirportCode;

FLT_AllotmentIdentification =
    Slant
    DE417_AllotmentIdentification;

# ULD - ULD Description
# ---------------------
ULDDescription =
    DE103_LineIdentifier_ULD
    Slant
    DE702_NumberOfULDs
    *(
        1*3
        (
            Slant
            ULD_ULDIdentification
            [ULD_ULDPositionInformation]
            ULD_WeightOfULDContents
        )
        CRLF
    );
    
ULD_ULDIdentification =
    DE802_ULDType
    [DE115_ULDSerialNumber
     DE801_ULDOwnerCode];

ULD_ULDPositionInformation =
    Hyphen
    DE811_ULDLoadingIndicator;
    
ULD_WeightOfULDContents =
    Slant
    DE601_WeightCode
    DE600_Weight;

# SSR - Special Service Request
# -----------------------------
SpecialServiceRequest =
    DE103_LineIdentifier_SSR
    1*2
    (
        Slant 
        DE404_SpecialServiceRequest 
        CRLF
    );

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

# REF - Booking Reference
# -----------------------
BookingReference =
    DE103_LineIdentifier_REF
    Slant
    (
        (REF_RequestingOfficeMessageAddress
         [slant 
          REF_RequestingOfficeFileReference])
        /
        (Slant
         [REF_RequestingOfficeFileReference]
         Slant
         REF_RequestingParticipantIdentification)
    )
    CRLF;
        
REF_RequestingOfficeMessageAddress =
    DE313_AirportCityCode
    DE107_OfficeFunctionDesignator
    DE308_CompanyDesignator;
    
REF_RequestingOfficeFileReference =
    DE117_BookingFileReference;
    
REF_RequestingParticipantIdentification =
    DE319_ParticipantIdentifier
    Slant
    DE320_ParticipantCode
    Slant
    DE313_AirportCityCode;

# DIM - Dimensions Information
# ----------------------------
DimensionsInformation =
    DE103_LineIdentifier_DIM
    1*(    Slant
        DIM_TotalWeightDetails
        Slant
        DIM_DimensionsDetails
        Slant
        DE701_NumberOfPieces
        CRLF);

DIM_TotalWeightDetails =
    DE601_WeightCode
    DE600_Weight;

DIM_DimensionsDetails =
    DE611_MeasurementUnitCode
    DE608_LengthDimension
    Hyphen
    DE609_WidthDimension
    Hyphen
    DE610_HeightDimension;

# PID - Product Information
# -------------------------
ProductInformation =
    DE103_LineIdentifier_PID
    Slant
    DE505_ServiceCode
    [PID_RateInformation]
    CRLF;

PID_RateInformation =
    Slant
    DE507_RateClassCode
    [    Slant
        (DE707_CommodityItemNumber /
         DE513_ULDRateClassType /
         (DE507_RateClassCode DE511_RateClassPercentage))
    ];

# SHP - Shipper
# -------------
Shipper =
    DE103_LineIdentifier_SHP
    [SHP_AccountDetail]
    CRLF
    SHP_Name
    SHP_StreetAddress
    SHP_Location
    (
        (SHP_CodedLocation_B
         1*SHP_ContactDetail)
        /
        (SHP_CodedLocation_C
         *SHP_ContactDetail)
        /
        SHP_CodedLocation_A
    )
    CRLF;

SHP_AccountDetail =
    Slant
    DE108_AccountNumber;
    
SHP_Name =
    Slant
    DE300_Name
    CRLF;
    
SHP_StreetAddress =
    Slant
    DE301_StreetAddress
    CRLF;
    
SHP_Location =
    Slant
    DE302_Place
    [Slant DE303_StateProvince]
    CRLF;

SHP_CodedLocation_A =
    Slant
    DE304_ISOCountryCode;
SHP_CodedLocation_B =
    Slant
    DE304_ISOCountryCode
    Slant;
SHP_CodedLocation_C =
    Slant
    DE304_ISOCountryCode
    Slant 
    DE305_PostCode;

SHP_ContactDetail =
    Slant
    DE122_ContactIdentifier
    Slant
    DE123_ContactNumber;

# CNE - Consignee
# ---------------
Consignee =
    DE103_LineIdentifier_CNE
    [CNE_AccountDetail]
    CRLF
    CNE_Name
    CNE_StreetAddress
    CNE_Location
    (
        (CNE_CodedLocation_B
         1*CNE_ContactDetail)
        /
        (CNE_CodedLocation_C
         *CNE_ContactDetail)
        /
        CNE_CodedLocation_A
    )
    CRLF;

CNE_AccountDetail =
    Slant
    DE108_AccountNumber;
    
CNE_Name =
    Slant
    DE300_Name
    CRLF;
    
CNE_StreetAddress =
    Slant
    DE301_StreetAddress
    CRLF;
    
CNE_Location =
    Slant
    DE302_Place
    [Slant DE303_StateProvince]
    CRLF;

CNE_CodedLocation_A =
    Slant
    DE304_ISOCountryCode;
CNE_CodedLocation_B =
    Slant
    DE304_ISOCountryCode
    Slant;
CNE_CodedLocation_C =
    Slant
    DE304_ISOCountryCode
    Slant 
    DE305_PostCode;

CNE_ContactDetail =
    Slant
    DE122_ContactIdentifier
    Slant
    DE123_ContactNumber;

# CUS - Customer Identification
# -----------------------------
CustomerIdentification =
    DE103_LineIdentifier_CUS
    [CUS_AccountDetail]
    CRLF
    CUS_Name
    CUS_Place;

CUS_AccountDetail =
    Slant
    [DE108_AccountNumber]
    Slant 
    (
        (DE311_IATACargoAgentNumericCode
         Slant
         DE309_IATACargoAgentCASSAddress
         Slant
         DE319_ParticipantIdentifier)
        /
        (DE311_IATACargoAgentNumericCode
         Slant
         Slant
         DE319_ParticipantIdentifier)
        /
        (DE311_IATACargoAgentNumericCode
         Slant
         DE309_IATACargoAgentCASSAddress)
        /
        DE311_IATACargoAgentNumericCode
    );

CUS_Name =
    Slant
    DE300_Name
    CRLF;
    
CUS_Place =
    Slant
    DE302_Place
    CRLF;

# SRI - Shipment Reference Information
# ------------------------------------
ShipmentReferenceInformation =
    DE103_LineIdentifier_SRI
    Slant
    (
        (DE132_ReferenceNumber
         Slant
         DE133_SupplementaryShipmentInformation
         Slant
         DE133_SupplementaryShipmentInformation)
        /
        (Slant
         DE133_SupplementaryShipmentInformation
         Slant
         DE133_SupplementaryShipmentInformation)
        /
        (DE132_ReferenceNumber
         Slant
         Slant
         DE133_SupplementaryShipmentInformation)
        /
        (DE132_ReferenceNumber
         Slant
         DE133_SupplementaryShipmentInformation)
        /
        (Slant
         Slant
         DE133_SupplementaryShipmentInformation)
        /
        (Slant
         DE133_SupplementaryShipmentInformation)
        /
        DE132_ReferenceNumber
    )    
    CRLF;    

# Data Elements
# -------------

DE101_StandardMessageIdentifier         = 3Alpha;
DE103_LineIdentifier_CNE                = "CNE";
DE103_LineIdentifier_CUS                = "CUS";
DE103_LineIdentifier_DIM                = "DIM";
DE103_LineIdentifier_OSI                = "OSI";
DE103_LineIdentifier_PID                = "PID";
DE103_LineIdentifier_REF                = "REF";
DE103_LineIdentifier_SHP                = "SHP";
DE103_LineIdentifier_SRI                = "SRI";
DE103_LineIdentifier_SSR                = "SSR";
DE103_LineIdentifier_ULD                = "ULD";
DE107_OfficeFunctionDesignator          = 2Mixed;
DE108_AccountNumber                     = 1*14Text;
DE112_AirlinePrefix                     = 3Numeric;
DE113_AWBSerialNumber                   = 8Numeric;
DE115_ULDSerialNumber                   = Mixed 3*4Numeric;
DE117_BookingFileReference              = 1*15Text;
DE122_ContactIdentifier                 = 1*3Mixed;
DE123_ContactNumber                     = 1*25Mixed;
DE124_MessageTypeVersionNumber          = 1*3Numeric;
DE132_ReferenceNumber                   = 1*14Text;
DE133_SupplementaryShipmentInformation  = 1*12Text;
DE201_Month                             = 3Alpha;
DE202_Day                               = 2Numeric;
DE300_Name                              = 1*35Text;
DE301_StreetAddress                     = 1*35Text;
DE302_Place                             = 1*17Text;
DE303_StateProvince                     = 1*9Text;
DE304_ISOCountryCode                    = 2Alpha;
DE305_PostCode                          = 1*9Text;
DE308_CompanyDesignator                 = 2Mixed;
DE309_IATACargoAgentCASSAddress         = 4Numeric;
DE311_IATACargoAgentNumericCode         = 7Numeric;
DE312_CarrierCode                       = 2Mixed;
DE313_AirportCityCode                   = 3Alpha;
DE313_AirportCode                       = 3Alpha;
DE319_ParticipantIdentifier             = 1*3Mixed;
DE320_ParticipantCode                   = 1*17Mixed;
DE404_SpecialServiceRequest             = 1*65Text;
DE405_OtherServiceInformation           = 1*65Text;
DE409_SpaceAllocationCode               = 2Alpha;
DE409_SpaceAllocationCode_CA            = "CA";
DE417_AllotmentIdentification           = 1*14Mixed;
DE500_VolumeAmount                      = 1*9Decimal;
DE505_ServiceCode                       = Alpha;
DE507_RateClassCode                     = Alpha;
DE511_RateClassPercentage               = 1*3Numeric;
DE513_ULDRateClassType                  = Numeric *2Alpha;
DE600_Weight                            = 1*7Decimal;
DE601_WeightCode                        = Alpha;
DE602_DensityGroup                      = 1*2Numeric;
DE603_DensityIndicator                  = 2Alpha;
DE603_DensityIndicator_DG               = "DG";
DE604_VolumeCode                        = 2Alpha;
DE608_LengthDimension                   = 1*5Numeric;
DE609_WidthDimension                    = 1*5Numeric;
DE610_HeightDimension                   = 1*5Numeric;
DE611_MeasurementUnitCode               = 1*3Mixed;
DE701_NumberOfPieces                    = 1*4Numeric;
DE702_NumberOfULDs                      = 1*2Numeric;
DE703_ShipmentDescriptionCode_T         = "T";
DE703_ShipmentDescriptionCode_P         = "P";
DE705_SpecialHandlingCode               = 3Alpha;
DE707_CommodityItemNumber               = 4*7Numeric;
DE708_ManifestDescriptionOfGoods        = 1*15Text;
DE800_FlightNumber                      = 3*4Numeric [Alpha];
DE801_ULDOwnerCode                      = 2Mixed;
DE802_ULDType                           = Alpha 2Mixed;
DE811_ULDLoadingIndicator               = 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
#------------------------------------------------------------------------