Results 1 to 13 of 13
  1. #1
    New Lounger
    Join Date
    Sep 2002
    Location
    Sylacauga, Alabama, USA
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Blank character at end of string in text file (97)

    Have exported data from a query to a space-delimited txt file. It appears to be the correct string-length, but when imported to our AS400 system, it has an extra blank character at the end of the string. I've verified and re-verified each field length, both in my basic table and in the Advanced options during the exporting process. What is this character and how can I get rid of it?

  2. #2
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Blank character at end of string in text file (97)

    When you say it has an extra space at the end of the string, do you mean each field in the each record or at the end of each record?
    Pat

  3. #3
    New Lounger
    Join Date
    Sep 2002
    Location
    Sylacauga, Alabama, USA
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Blank character at end of string in text file (97)

    Just one blank character (end of record?) at the end of each record (string, aka row). This file has to import each record as exactly 303 characters (which it is) and the one hidden character makes it 304.

  4. #4
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Blank character at end of string in text file (97)

    Do you have a string delimiter as quotes?
    I have just tried to export from a query and it exports the correct number of characters.
    What SR are you up to in Acess97?
    Pat

  5. #5
    New Lounger
    Join Date
    Sep 2002
    Location
    Sylacauga, Alabama, USA
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Blank character at end of string in text file (97)

    No quotes. And when I check the character count, it's exporting it looks perfect. It's only when the AS400 programmer imports it into the AS400 and fits it into a 303-character string, then the extra character wraps to another line.

    My Access 97 is SR-1. I can upgrade to 2002, but no one else here has that version and I prefer to stay compatible.

  6. #6
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Blank character at end of string in text file (97)

    No I wasn't alluding to an upgrade to 2002 but instead an upgrade to SR2 in A97.
    Can you verify that the text file contains a space at the end of each line?
    Or is it the AS400 end (unix I presume) that has embedded the space?
    Pat

  7. #7
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Blank character at end of string in text file (97)

    In this situation, I believe what you want is a fixed length record with specified field widths, rather than a space delimited file. In order to do that you need to create an export specification. The export wizard will help you do that.
    Wendell

  8. #8
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Blank character at end of string in text file (97)

    You're getting an end of record character, which is what I would expect given the format you're using. Wendell's post gives you the answer you need, a fixed-width export instead of space delimited.
    Charlotte

  9. #9
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Blank character at end of string in text file (97)

    Would you post the file that Access creates, it would be good to look at it.
    Pat

  10. #10
    New Lounger
    Join Date
    Sep 2002
    Location
    Sylacauga, Alabama, USA
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Blank character at end of string in text file (97)

    Actually, when I said space-delimited I should have said fixed-width. I use the wizard and under the Advanced tab, I set the field lengths and starting positions. Here is my resulting file...
    Attached Files Attached Files

  11. #11
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Blank character at end of string in text file (97)

    After looking at your file the records are 305 characters long including the CR/LF characters.
    There is a space just prior to the CR/LF but is this just part of the last field?
    Why don't you fill the last field in the table to it's maximum length and try your export again, and see what the length is, and also see if the last character is a space.
    What are you using to look at your file, I use UltraEdit.
    Pat

  12. #12
    New Lounger
    Join Date
    Sep 2002
    Location
    Sylacauga, Alabama, USA
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Blank character at end of string in text file (97)

    Pat, I only had notepad to view this file, as well as the export wizard. I downloaded a trial copy of UltraEdit and I will definitely be buying this software! I'm running through the menus right now and have my spaces defined. I assume the paragraph mark at the end of each string is the CR/LF. I've done as you suggested and filled the last field. Here's the new txt file. Shows 304 characters plus the CR/LF character, which is what I thought. My question is, "how do I eliminate that CR/LF character?" I need to do this in Access, if possible.

    Judy
    Attached Files Attached Files

  13. #13
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Blank character at end of string in text file (97)

    Now the file has 306 character records, which includes the CR and LF characters (CR is the Carriage Return character, LF is the Line Feed character).
    The CR & LF characters are normally output from the export into a text file, this is an old DOS format having the CR & LF characters at the end of each line. This is the line terminator for a text file, it was defined that way back in the 80's.

    So I believe you cannot delete these characters from the output file.

    When you say you have to import the file on a AS400, is this Unix based? If so, you will have to change the record terminator in some way. Even in Unix I believe that the record terminator is a LF character while if you are in MAC mode it is the CR character (or vice versa, I cannot remember which way).

    HTH
    Pat

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •