Describing the File Formats

Describing the CSV file format in Chapter 7 was fairly simple due to the restrictions we placed on it. The most significant of these was that every row has the same logical format. We're going to allow more variation in our flat file formats. Applications that use flat files to import or export data typically support several different logical record formats and group these records into repeating units. We'll need to specify more information about the grammar of our flat files than we did with CSV files. In addition to data types and other characteristics of fields, we'll need to specify the details of all the record types as well as how the records are grouped together.

As with the CSV format, the flat file format's file description document has three major sections, each represented by an Element that is an immediate child of the root Element.

  • PhysicalCharacteristics: the flat file characteristics

    Figure 8.2. Sample Output Flat File (PurchaseOrders.Dat)
             10        20        30        40        50        60        70        80       
     90        100       110       120       130
             |         |         |         |         |         |         |         |         |
             |         |         |         |         |
    
    HDRBQ003               AZ999345            2002110120021115
    SHPYazoo Grocers - NE Distribution Center  12 Industrial Parkway, NW                      
                 Portland            ME 04101
    LINHCVAN                       1200000002590000000000
    DSCInstant Hot Cocoa Mix - Vanilla flavor
    LINHCMIN                       2400000002530000000000
    DSCInstant Hot Cocoa Mix - Mint flavor
    HDRBQ003               AW999346            2002110120021115
    SHPYazoo Grocers - SE Distribution Center  Dock 37                       3975 Hwy 75      
                 Atoka               OK 74525
    LINHCVAN                       3600000002590000000000
    DSCInstant Hot Cocoa Mix - Vanilla flavor
    LINHCMIN                       7200000002530000000000
    DSCInstant Hot Cocoa Mix - Mint flavor
    HDRAY001               2002-0967           2002110920021114
    SHPCorner Drug and Sundries                14 Main Street                                 
                 Wichita             KS 67201
    LINHCVAN                       2400000002590000000000
    DSCInstant Hot Cocoa Mix - Vanilla flavor
    

  • XMLOutputCharacteristics: XML output characteristics, required only when converting to XML

  • Grammar: flat file grammar

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset