将COBOL代码转换为C#? [英] Converting COBOL code to C# ?

查看:115
本文介绍了将COBOL代码转换为C#?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一些COBOL程序,有些正在开发中,

只是阅读基于TEXT的报告并废弃各种

信息的报告。


我很想知道是否有人试图使用

C#来做这类事情?


我我很想摆脱我的COBOL程序员,尤其是代码,如果我能够b / b
。显然,编辑/解析COBOL

中的文本报告要比其他语言简单得多....所以我被告知。

任何样本或在线参考会很棒。


请注意,有些报告是多页的,有些报道可能有特殊报道。\\ n \\ n
" binary"用于打印机等的编码标题,解析器通常会忽略这些标题。

解决方案

< blockquote>我对COBOL一无所知,所以我无法比较这两者。但是在.NET中,

它是相当直接的读写文件。


看一下System.IO命名空间。有些类可以读取文件作为二进制文件,文本文件,文件流,内存流等等。

查看System.Text命名空间以获取不同的类字符

编码。 System.String类有可用于常见字符串解析的方法。

http://msdn.microsoft.com/library/de...classtopic.asp

我对COBOL没有任何线索,但它在.NET(C#或VB.NET)中真的很容易。


" dm1608"写道:

我们有一些COBOL程序,有些正在开发中,它们只是阅读基于TEXT的报告并废弃报告以获取各种信息。

我很想知道是否有人试图用C#做这种事情?

我很想摆脱我的COBOL程序员特别是代码,如果我可以。显然,编辑/解析COBOL中的文本报告要比其他语言简单得多....所以我被告知。

任何样本或在线参考都会很棒。

请注意,有些报告是多页的,有些可能有特殊的二进制报告。用于打印机等的编码标头,通常被解析器忽略。



dm1608,


我有理由相信,至少有一家供应商(我相信富士通)有一个

的COBOL.NET语言产品。您可以使用现有的COBOL代码库来创建

..NET程序集,然后使用免费产品

(例如Roeder的Reflector)将它们反编译为C#。 br $> b $ b Peter


-

联合创始人,Eggheadcafe.com开发者门户网站:
http://www.eggheadcafe.com

UnBlog:
http://petesbloggerama.blogspot.com



" dm1608"写道:

我们有一些COBOL程序,有些正在开发中,它们只是阅读基于TEXT的报告并废弃报告以获取各种信息。

我很想知道是否有人试图用C#做这种事情?

我很想摆脱我的COBOL程序员特别是代码,如果我可以。显然,编辑/解析COBOL中的文本报告要比其他语言简单得多....所以我被告知。

任何样本或在线参考都会很棒。

请注意,有些报告是多页的,有些可能有特殊的二进制报告。用于打印机等的编码标头,通常被解析器忽略。



我认为如果他遇到了购买COBOL编译器的麻烦,他可能会把这些程序留在COBOL中(并保存他糟糕的程序员的工作!)。


我已经写了数百个COBOL程序(虽然不是很多年)而且

对他描述的应用程序有好处。


我的经历转换系统是最好重新编码成新的
语言,而不是依赖于某些自动翻译系统。你有世界上最好的规格 - 一个现有的工作系统 - 来验证你的结果。


也许重新编写VB会更容易?

Peter Bromberg [C#MVP]写道:

dm1608,

我有理由相信至少有一家供应商(我相信富士通)有一个COBOL.NET语言产品。您可以使用现有的COBOL代码库来创建.NET程序集,然后使用免费产品(例如Roeder的Reflector)将它们反编译为C#。
Peter



We have a number of COBOL programs, and some were currently developing, that
simply read TEXT based reports and scrap the reports for various
information.

I''m curious to know if anyone has attempted to do this sort of thing using
C#?

I would love to get rid of my COBOL programmer and especially the code, if I
can. Apparently, it is much simplier to edit/parse text reports in COBOL
than other languages.... so I''m being told.
Any samples or online references would be great.

Please note that some reports are multi-page and some may have special
"binary" coded headers that is used for printers, etc., that are typically
ignored by the parser.

解决方案

I don''t know anything about COBOL, so I can''t compare the two. But in .NET,
it is fairly straight forward reading and writing files.

Take a look at the System.IO namespace. There are classes in there for
reading files as binary files, text files, file streams, memory streams, etc.
Look at the System.Text namespace for classes for different character
encodings. The System.String class has may methods for common string parsing.

http://msdn.microsoft.com/library/de...classtopic.asp

I have no clue about COBOL, but it''s real easy in .NET (C# or VB.NET).

"dm1608" wrote:

We have a number of COBOL programs, and some were currently developing, that
simply read TEXT based reports and scrap the reports for various
information.

I''m curious to know if anyone has attempted to do this sort of thing using
C#?

I would love to get rid of my COBOL programmer and especially the code, if I
can. Apparently, it is much simplier to edit/parse text reports in COBOL
than other languages.... so I''m being told.
Any samples or online references would be great.

Please note that some reports are multi-page and some may have special
"binary" coded headers that is used for printers, etc., that are typically
ignored by the parser.



dm1608,

I am reasonably sure that at least one vendor (Fujitsu, I believe) has a
COBOL.NET language product. You can use the existing COBOL codebase to create
..NET assemblies, and then simply decompile them into C# using a free product
such as Roeder''s Reflector.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"dm1608" wrote:

We have a number of COBOL programs, and some were currently developing, that
simply read TEXT based reports and scrap the reports for various
information.

I''m curious to know if anyone has attempted to do this sort of thing using
C#?

I would love to get rid of my COBOL programmer and especially the code, if I
can. Apparently, it is much simplier to edit/parse text reports in COBOL
than other languages.... so I''m being told.
Any samples or online references would be great.

Please note that some reports are multi-page and some may have special
"binary" coded headers that is used for printers, etc., that are typically
ignored by the parser.



I think that if he goes to the trouble of buying a COBOL compiler, he may as
well leave the programs in COBOL (and save his poor programmer''s job!).

I have written hundreds of COBOL programs (although not for many years) and it
is good for the applications he describes.

My experience in converting systems is that it is better to recode into the new
language rather than relying on some automatic translation system. You have the
best spec in the world - an existing working system - to verify your results.

Perhaps recoding to VB would be easier ?
Peter Bromberg [C# MVP] wrote:

dm1608,

I am reasonably sure that at least one vendor (Fujitsu, I believe) has a
COBOL.NET language product. You can use the existing COBOL codebase to create
.NET assemblies, and then simply decompile them into C# using a free product
such as Roeder''s Reflector.
Peter



这篇关于将COBOL代码转换为C#?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆