我对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, thatsimply read TEXT based reports and scrap the reports for variousinformation.I''m curious to know if anyone has attempted to do this sort of thing usingC#?I would love to get rid of my COBOL programmer and especially the code, if Ican. Apparently, it is much simplier to edit/parse text reports in COBOLthan 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 typicallyignored 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 forreading files as binary files, text files, file streams, memory streams, etc.Look at the System.Text namespace for classes for different characterencodings. The System.String class has may methods for common string parsing. http://msdn.microsoft.com/library/de...classtopic.aspI 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 aCOBOL.NET language product. You can use the existing COBOL codebase to create..NET assemblies, and then simply decompile them into C# using a free productsuch as Roeder''s Reflector.Peter--Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.comUnBlog: 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 aswell 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 itis good for the applications he describes.My experience in converting systems is that it is better to recode into the newlanguage rather than relying on some automatic translation system. You have thebest 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#?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-09 16:29