Table of Contents

Search

  1. Preface
  2. Using the Designer
  3. Working with Sources
  4. Working with Flat Files
  5. Working with Targets
  6. Mappings
  7. Mapplets
  8. Mapping Parameters and Variables
  9. Working with User-Defined Functions
  10. Using the Debugger
  11. Viewing Data Lineage
  12. Comparing Objects
  13. Managing Business Components
  14. Creating Cubes and Dimensions
  15. Using the Mapping Wizards
  16. POWERCENTERHELP
  17. Datatype Reference
  18. Configure the Web Browser

Importing Fixed-Width Flat Files

Importing Fixed-Width Flat Files

Fixed-width flat files are byte-oriented, which means that the field lengths are measured in bytes. They can also be line sequential, which means each row ends with a newline character. You can import a fixed-width file that does not contain binary data or multibyte character data greater than two bytes per character.
When you import a fixed-width file, you can create, move, or delete column breaks using the Flat File Wizard. Incorrect positioning of column breaks can create misalignment errors when you run a session with a file source containing single-byte and multibyte characters. Misalignment of multibyte data in a file causes errors in a workflow.
To import a fixed-width flat file definition:
  1. To import a source definition, open the Source Analyzer and click
    Sources
    Import from File
    . To import a target definition, open the Target Designer and click
    Targets
    Import from File.
    The
    Open Flat File
    dialog box appears.
  2. Select the file you want to use.
  3. Select a code page.
    When you import a flat file source definition, select a code page that matches the code page of the data in the file.
  4. Click
    OK.
    The contents of the file appear in the window at the bottom of the Flat File Wizard.
  5. Edit the following settings:
    Fixed-Width Flat File Wizard, Step 1 of 3
    Description
    Flat File Type
    File type. Select Fixed Width for a fixed-width file.
    Enter a Name for This Source
    Name of the source. This is the name of the source in the repository. You can use the file name or any other logical name.
    Start Import At Row
    Indicates the row number at which the Flat File Wizard starts reading when it imports the file.
    For example, if you specify to start at row 2, the Flat File Wizard skips 1 row before reading.
    Import Field Names From First Line
    If selected, the Designer uses data in the first row for column names. Select this option if column names appear in the first row. Invalid field names are preceded by “FIELD_.”
  6. Click
    Next.
    Follow the directions in the wizard to manipulate the column breaks in the file preview window. Move existing column breaks by dragging them. Double-click a column break to delete it.
    For shift-sensitive files, the Flat File Wizard displays single-byte shift characters as ‘.’ in the window. Double-byte shift characters appear as ‘..’ in the window so you can configure the column breaks accurately.
  7. Click
    Next.
    Enter column information for each column in the file.
    To switch between columns, select a new column in the
    Source Definition
    or
    Target Definition group
    , or click the column heading in the file preview window.
    Fixed-Width Flat File Wizard, Step 3 of 3
    Description
    Name
    Port name that you want to appear for each column. If you select Import Field Names from First Line, the wizard reads the column names provided in the file.
    Datatype
    Column datatype. Select Text, Numeric, or Datetime, and then enter the appropriate Length/Precision, Scale, and Width.
    For numeric columns, Precision is the number of significant digits, and Width is the number of bytes to read from source files or to write to target files.
    For text columns, Precision is measured in bytes for fixed-width files and in characters for delimited files.
    By default, the Flat File Wizard enters the same value for both Precision and Width. You can change the value of the precision to enter the number of significant digits, but the width must be greater than or equal to the precision.
    Only characters 0 to 9 are considered numeric. Columns that contain multibyte character set numbers, such as Japanese, are considered text.
  8. Click
    Finish.
    If the file size exceeds 256 KB or contains more than 16 KB of data for each row, verify that the Flat File Wizard imports the file with the correct field precision and width. If not, adjust the field precision and width in the Flat File Wizard or in the imported definition.


Updated June 25, 2018