Jump to content
Server Maintenance This Week. ×

Export as .txt


This topic is 1843 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • 2 years later...
  • Newbies

I admit that I am replying to an old post, but in reading the numerous replies I thought I would put my two-cents in. The format that the OP describes sounds like a fixed-length text file. This means, as others have noted, that there are no delimiters between fields in the data file. There may be delimiters between records sets, but not necessarily...

An example:

95114YY07M5452541555512124415 ONE TREE

Each position in the fixed-length file is related to specific data. Some legacy systems read data as a linear file, so where the data is in the file relates to the actual data. A legacy system could read the following as:

position 1-5: 95114

position 6: Y

position 7: Y

position 8-9: 07

position 10: M

position 11-15: 54525

position 16-25: 4155551212

position 26-40: 4415 ONE TREE (spaces can be used to pad the field length if no data exist)

So, exporting as a tabbed file will cause an issue for the legacy system. Especially if the tab falls in a field where the system expects numeric data such as a dollar amount. Depending upon the legacy system, data at the end of the data block can be a non-printable characters such as a carriage return or a line feed or could be the beginning of the next data record.

If there are no carriage returns or line feeds in the file the line of data will continue to scroll horizontally passed the right margin until the end of file is reached. If there are carriage returns or line feeds then data records will appear as even length rows in notepad or text editors.

By the way, I recommend using any text editor over notepad. Text editor allow the opening of very large files and leave the data unaltered. Also some, such as Ultra Edit, have a built in hex editor which makes examining the contents of a file much easier. Especially when looking for non-printable characters.

Also the data is probably straight ascii which is otherwise known as a text file (txt). Tab and comma delimited files are also text files which does stir the pot on meaning. However, since the original parent fled the thread all is really speculation.

Link to comment
Share on other sites

  • 9 years later...
On 12/20/2007 at 6:19 PM, comment said:

Is this really so difficult as to warrant such a lengthy exchange? Here is your file with no modifications other than removing all the nonessentials. It produces EXACTLY the same file as your final export does. I don't know why you think "many fields and many calcs" are required - one calculation field is all it takes. And even that could be eliminated by using XML.

EightCharFile2.fp7.zip

Hi Comment,

This great example produced just what I needed to fill the nasty part of my SQL Script!

How would you add a block of text once at the beginning (Header) and once at the end (Footer) of the exported text, without having them repeat themselves? Something like this:

-----

HEADER
(IRMHIS= 11631366 AND IRMDEP= 3590 AND IRMCIT BETWEEN 20190223 AND 20190225) OR
(IRMHIS= 17804117 AND IRMDEP= 3552 AND IRMCIT BETWEEN 20190400 AND 20190402) OR
(IRMHIS= 14058310 AND IRMDEP= 3552 AND IRMCIT BETWEEN 20190401 AND 20190403) OR
FOOTER

-----

Instead of this:

-----

HEADER
(IRMHIS= 11631366 AND IRMDEP= 3590 AND IRMCIT BETWEEN 20190223 AND 20190225) OR
FOOTER

HEADER

(IRMHIS= 17804117 AND IRMDEP= 3552 AND IRMCIT BETWEEN 20190400 AND 20190402) OR
FOOTER

HEADER

(IRMHIS= 14058310 AND IRMDEP= 3552 AND IRMCIT BETWEEN 20190401 AND 20190403) OR
FOOTER

-----

I can imagine that the last OR can be erased on the fly, as well.

Please let me know if I need to move this question to another (new) topic.

Best,

Daniel

Link to comment
Share on other sites

This topic is 1843 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.