平面文件中的数据记录(COBOL样式) [英] Data Records from Flat File (COBOL Style)
问题描述
我正在考虑重写一些独立的Pro * COBOL应用程序
读取平面文件并吐出一些报告。
有吗有什么方法可以模仿COBOL从平面
文件中读取数据结构的能力?我希望C#有一种方法可以定义一个数据
结构,我可以读取这些行,这样就可以很容易地操作它们了。
我们非常感谢任何建议。
I''m looking at rewriting some stand-alone Pro*COBOL applications that
read flat files and spit out some reports.
Is there any way to mimic COBOL''s ability to read lines from a flat
file into a data structure? I''m hoping C# has a way to define a data
structure that I can read the lines into so that they can be easily
manipulated.
Any advice would be greatly appreciated.
推荐答案
J. G.写道:
我正在考虑重写一些独立的Pro * COBOL应用程序来读取平面文件并吐出一些报告。
有没有办法模仿COBOL从平面文件读取数据结构的能力?我希望C#有一种方法来定义一个数据结构,我可以阅读这些结构,以便它们可以轻松地操作。
任何建议都会很大赞。
I''m looking at rewriting some stand-alone Pro*COBOL applications that
read flat files and spit out some reports.
Is there any way to mimic COBOL''s ability to read lines from a flat
file into a data structure? I''m hoping C# has a way to define a data
structure that I can read the lines into so that they can be easily
manipulated.
Any advice would be greatly appreciated.
我对COBOL一无所知,但我想我知道你需要什么,我是
非常肯定你可以创建一个结构然后使用System.IO以二进制模式将
数据填充到结构中,我不确定如何声明
已修复结构中的-size字符串以匹配您的文件。
I don''t know anything about COBOL but I think I see what you need, I''m
pretty sure you can create a struct and then use System.IO to fill the
data in binary mode into the struct, what I''m not sure is how to declare
fixed-size strings within the struct to match your file.
尝试使用可下载源代码的文章:
http://www.codeproject.com/useritems...sp#xx1033560xx
>
J。 G." < JA *********** @ gmail.com>在消息中写道
news:6c ************************** @ posting.google.c om ...
Try this article with downloadable source code:
http://www.codeproject.com/useritems...sp#xx1033560xx
"J. G." <ja***********@gmail.com> wrote in message
news:6c**************************@posting.google.c om...
我正在考虑重写一些独立的Pro * COBOL应用程序,这些应用程序可以读取平面文件并吐出一些报告。
有什么方法可以模仿COBOL能否将平面文件中的行读入数据结构?我希望C#有一种方法来定义一个数据结构,我可以阅读这些结构,以便它们可以轻松地操作。
任何建议都会很大赞。
I''m looking at rewriting some stand-alone Pro*COBOL applications that
read flat files and spit out some reports.
Is there any way to mimic COBOL''s ability to read lines from a flat
file into a data structure? I''m hoping C# has a way to define a data
structure that I can read the lines into so that they can be easily
manipulated.
Any advice would be greatly appreciated.
JG,
可能是除了循环和放置之外唯一的额外想法
String.Substring(0,10)//这是前10个字符
String.Substring(10)//这是记录的其余部分。
假设我明白你的意思。
Cor
JG,
Probably is the only think extra beside just looping and placing
String.Substring(0,10) //which are the first 10 characters
String.Substring(10) //Which is the rest of the record.
Just assuming that I understand what you mean.
Cor
这篇关于平面文件中的数据记录(COBOL样式)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!