本文介绍了如何将具有可变长度记录的文本文件转换为固定长度记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!



我正在寻找一个示例,将具有可变长度记录的平面文本文件转换为具有固定长度记录的平面文件。有没有人有例子?

Hi,
I am looking for an example to convert a flat text file with variable length records to a flat file with fixed length records. Does anyone have an example?

推荐答案



Jim,你需要知道文本文件中任何字符串的最大字段长度

Hi Jim, you will need to know the maximum field length for any strings in the text file




我知道每个字段的大小。记录的开头部分是固定的(前100个左右的字节)。其余的根据记录类型而有所不同(例如:05,06,10,30,50等)。我需要在每条记录的末尾用Ctrl / Lf修复所有记录(336长度)。

记录的一个例子是:

20817 C A00059530 376480850 PP001755719 056920 CARMICHAEL AVE BETHESDA,MD 20817

20817 C A00059530 376480850 PP001755719 06MARK F THIMMIG

20817 C A00059530 376480850 PP001755719THIMMIG JORDAN C A0005953002 061030B00786 10 000016

20817 C A00059530 376480850 PP001755719THIMMIG JORDAN C A0005953002 061030B007860100 003001001020067061 99203 +000001 + 000008000 + 000008000PAPBFA + 000000000 + 000002400 + 000000000 + 000000000 + 000000000 +000005600 0000 {+ 000000000 + 000000 000 + 000000000 + 000000000 + 000000000 1020060001

I know the size of each field. The beginning portion of the records is fixed ( the first 100 or so bytes). The rest varies according to the record type (ex: 05, 06,10, 30, 50, etc). I need all the records to be fixed (336 length) with a Ctrl/Lf at the end of each record.
An example of the records is:
20817 C A00059530 376480850 PP001755719 056920 CARMICHAEL AVE BETHESDA, MD 20817
20817 C A00059530 376480850 PP001755719 06MARK F THIMMIG
20817 C A00059530 376480850 PP001755719THIMMIG JORDAN C A0005953002 061030B00786 10 000016
20817 C A00059530 376480850 PP001755719THIMMIG JORDAN C A0005953002 061030B007860100 003001001020067061 99203 +000001 +000008000+000008000PAPBFA +000000000+000002400+000000000+000000000+000000000 +000005600 0000{ +000000000+000000000+000000000+000000000+000000000 1020060001




字段数是否从记录变为记录?

Does the number of fields change from record to record?


这篇关于如何将具有可变长度记录的文本文件转换为固定长度记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 13:52