Topic
7 replies Latest Post - ‏2012-09-13T08:10:34Z by LenGreenwood
Fretful
Fretful
5 Posts
ACCEPTED ANSWER

Pinned topic How to read a fixed field length sequential file?

‏2012-09-12T12:11:09Z |
Hello,

I am new to IBM DataStage. I just got a txt file from my boss with fixed field lengths and a new line as record delimiter. What stage do i have to use and which settings should I select to get this job done? I tried the Sequential File and the Complex File but it did not work. I have to split the file up in columns.

Thanks in advance!
Updated on 2012-09-13T08:10:34Z at 2012-09-13T08:10:34Z by LenGreenwood
  • beach_bum
    beach_bum
    49 Posts
    ACCEPTED ANSWER

    Re: How to read a fixed field length sequential file?

    ‏2012-09-12T12:28:24Z  in response to Fretful
    It's an easy task that is fully documented in the product manual. Please have a look at that and let us know if you have any other questions.

    Cheerio,
    A
    • Fretful
      Fretful
      5 Posts
      ACCEPTED ANSWER

      Re: How to read a fixed field length sequential file?

      ‏2012-09-12T13:01:56Z  in response to beach_bum
      Well I could not find the example in the product manual, I probably have another version of it. Right now I am using a Sequential File State to read the File. In the preview mode the DataStage already reads the first column right and recognizes the record delimiter. But it's just reading the first column. All the others are empty!
      • Fretful
        Fretful
        5 Posts
        ACCEPTED ANSWER

        Re: How to read a fixed field length sequential file?

        ‏2012-09-12T13:29:26Z  in response to Fretful
        I set the general field width to 231 and i have to skip the first row but when I do thtat the following error shows up: ">##E IIS-DSEE-TOIX-00189 15:29:15(007) <Sequential_File_0> The -firstLineColumnNames option is not supported for fixed length records."
        • beach_bum
          beach_bum
          49 Posts
          ACCEPTED ANSWER

          Re: How to read a fixed field length sequential file?

          ‏2012-09-12T13:53:36Z  in response to Fretful
          I've don't recall seeing fixed length files with column names in them. Out of curiosity how do you handle flag columns in that case?

          In any case, just filter out the header record before converting to columns ... again a lot of ways of doing it all described in the manual.
          • Fretful
            Fretful
            5 Posts
            ACCEPTED ANSWER

            Re: How to read a fixed field length sequential file?

            ‏2012-09-12T15:24:16Z  in response to beach_bum
            Okay I removed the first and last row. Now I am trying to split the columns up using a column import stage. I tried it with 3 columns but only the first one gets filled, the other two's are empty. What could be wrong?!
            • Fretful
              Fretful
              5 Posts
              ACCEPTED ANSWER

              Re: How to read a fixed field length sequential file?

              ‏2012-09-13T07:06:19Z  in response to Fretful
              The important thing which I was missing all the time was the "special dialog" to enter the field-width. You can "activate" it by double clicking on the column number in the Output-Columns tab.
              • LenGreenwood
                LenGreenwood
                36 Posts
                ACCEPTED ANSWER

                Re: How to read a fixed field length sequential file?

                ‏2012-09-13T08:10:34Z  in response to Fretful
                That's the same dialog as you get by selecting a row in the Output columns grid, right-click, choose "Edit row..." from the context menu. The double-click on the column number is just a short cut.

                By the way, to get a sequential file stage to read fixed-width data, you really need to set the Format tab so it has Record length = fixed. Try going to the Format tab, select Record level, right-click and choose Format as/Fixed-width records.