windows 无需访问大型机即可学习 COBOL

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4433165/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 07:52:37  来源:igfitidea点击:

Learning COBOL Without Access to Mainframe

windowscobol

提问by AJ.

I am a graduate student majoring in Computer Science. My department teaches the majority of its courses using Java (though I did take one course on system architecture that used C to demonstrate processor scheduling, memory management, etc....but I digress).

我是一名计算机科学专业的研究生。我的部门使用 Java 教授其大部分课程(尽管我确实上了一门关于系统架构的课程,该课程使用 C 来演示处理器调度、内存管理等......但我离题了)。

I want to learn more about COBOL, but I don't have access to a mainframe system. Can anyone please recommend a freeCOBOL compiler for Windows that would enable me to get through some basic COBOL tutorials?

我想了解有关 COBOL 的更多信息,但我无法访问大型机系统。任何人都可以为 Windows推荐一个免费的COBOL 编译器,使我能够完成一些基本的 COBOL 教程吗?

Disclaimer: yes, I've Googled this already, so hoping for some experienced individuals to give some further info.

免责声明:是的,我已经在谷歌上搜索过了,所以希望有经验的人提供更多信息。

Thanks!

谢谢!

回答by NealB

Other posters have suggested Tiny COBOL, but have a look at OpenCOBOLtoo. OpenCOBOL is a cross compiler to C and has a fairly active development community.

其他海报建议使用 Tiny COBOL,但也可以看看OpenCOBOL。OpenCOBOL 是 C 的交叉编译器,拥有相当活跃的开发社区。

COBOL is not a difficult language to learn. Unless you are tying to work your way into a mainframe shop, spending a lot of time studying COBOL may not have much career payback.

COBOL 不是一门难学的语言。除非你打算进入大型机商店,否则花大量时间学习 COBOL 可能不会有太多的职业回报。

As belisarius pointed out, it is not the language as much as the environment that needs to be learned. By analogy, there isn't very much to learn about the C language either. However, just knowing C will not get you very far - you need to work with the huge standard library that comes with it. COBOL is similar in that respect. The difference is that COBOL does not come with a huge standard library, it is part of a package that often includes: CICS, DB/2, MQ-Series and an array of other library services (LE Services in an IBM environment).

正如贝利撒留所指出的,需要学习的不是语言,而是环境。以此类推,C 语言也没有太多可学习的地方。然而,仅仅了解 C 不会让你走得很远——你需要使用它附带的庞大的标准库。COBOL 在这方面是相似的。不同之处在于 COBOL 没有附带庞大的标准库,它是一个包的一部分,通常包括:CICS、DB/2、MQ-Series 和一系列其他库服务(IBM 环境中的 LE 服务)。

COBOL can be found outside of a mainframe environment but the mainframe is its "real home". As a generalization, "mainframe" implies an IBM mainframe running Z/OS (many may take exception to this statement). This publication: Introduction to the Mainframe - z/OSis a good place to get a feel for what an IBM mainframe environment is like.

COBOL 可以在大型机环境之外找到,但大型机是它的“真正的家”。作为概括,“大型机”意味着运行 Z/OS 的 IBM 大型机(许多人可能不同意这种说法)。此出版物:大型机简介 - z/OS是了解 IBM 大型机环境是什么样子的好地方。

The things I find characterize COBOL are:

我发现 COBOL 的特点是:

  • COBOL is a procedural language. Some vendors have added OO extensions and new COBOL language standards include OO extensions, but this is largely window dressing. COBOL is fundamentally a procedural language.

  • Data declaration. The PICTURE/USAGEthing is a bit of a mind bender. Data declaration combines internal data representation (binary, packed decimal, floating point, character, etc.) with presentation (number of digits, leading zeros, sign, etc.) into a single declaration.

  • REDEFINESused to provide different views of the same underlying memory.

  • Hierarchical data declarations. Data hierarchy is defined using level numbers. Level 1 defines the top of the hierarchy and increasing numbers define lower levels. Levels 66 (in conjunction with RENAMES), 77, 88 have special meanings.

  • Flow of control. Many programmers (even some veteran COBOL programmers) view SECTION/PARAGRAPHin a manner similar to a procedure call. They are completelydifferent. SECTION/PARAGRAPHdo not follow normal stack oriented call/return semantics. COBOL uses a unique mechanism to manage return from PERFORMedsections/paragraphs.

  • Monolithic programs with tons of global variables. It is not uncommon to find COBOL source files running into thousands of lines with several hundred global variables. COBOL doesn't have to be written this way - I believe this is a legacy dating back to a time when procedure calls were considered costly but PERFORMinga SECTION/PARAGRAPHwas very efficient. The habit seems to have stuck and newer COBOL programs tend to be written as monolithic monsters too.

  • String handling nightmare. COBOL does financial calculations very well. It does not do string handling very well at all. The string handling verbs INSPECT, STRINGand UNSTRINGcan do a number of interesting things, but manage to be quite aggravating too.

  • COPY/REPLACINGand REPLACEcompiler directives need to be understood. They behave somewhat differently than file inclusion in most other languages. Most shops use COPYonly for common record or data declaration, others use them for common procedural code too (with REPLACINGand or REPLACE).

  • COBOL 是一种过程语言。一些供应商添加了 OO 扩展,新的 COBOL 语言标准包括 OO 扩展,但这主要是为了装腔作势。COBOL 从根本上说是一种过程语言。

  • 数据声明。这PICTURE/USAGE件事有点令人费解。数据声明将内部数据表示(二进制、压缩十进制、浮点、字符等)与表示(位数、前导零、符号等)结合到一个声明中。

  • REDEFINES用于提供相同底层内存的不同视图。

  • 分层数据声明。数据层次结构是使用级别编号定义的。级别 1 定义层次结构的顶部,增加的数字定义较低的级别。级别 66(与 RENAMES 一起使用)、77、88 具有特殊含义。

  • 控制流。许多程序员(甚至一些资深的 COBOL 程序员)SECTION/PARAGRAPH以类似于过程调用的方式查看。他们是完全不同的。SECTION/PARAGRAPH不要遵循正常的面向堆栈的调用/返回语义。COBOL 使用独特的机制来管理PERFORMed节/段落的返回。

  • 具有大量全局变量的单体程序。发现 COBOL 源文件包含数千行和数百个全局变量的情况并不少见。COBOL不必这样写-我相信这是一个传统可以追溯到的时候,程序调用被认为是昂贵的,但PERFORMing一个SECTION/PARAGRAPH是非常有效的。这种习惯似乎已经根深蒂固,而且较新的 COBOL 程序也往往被编写为单体怪物。

  • 字符串处理噩梦。COBOL 可以很好地进行财务计算。它根本不能很好地处理字符串。字符串处理动词INSPECT, STRINGandUNSTRING可以做许多有趣的事情,但也设法变得非常恼人。

  • COPY/REPLACINGREPLACE编译器指令需要理解。它们的行为与大多数其他语言中的文件包含有所不同。大多数商店COPY仅用于公共记录或数据声明,其他商店也将它们用于公共程序代码(使用REPLACING和 或REPLACE)。

Given a working knowledge of C, you should be able to pick up on COBOL without much difficulty.

鉴于 C 的应用知识,您应该能够毫不费力地掌握 COBOL。

回答by Dr. belisarius

I'll not address your specific question, since it was many years ago that I stopped working as a mainframe systems programmer (and with mainframes in general ... and that includes COBOL). Nevertheless, there are two points that I want to emphasize:

我不会回答你的具体问题,因为多年前我停止了作为大型机系统程序员的工作(以及一般的大型机......包括 COBOL)。尽管如此,我想强调两点:

  1. COBOL is an easy to learnlanguage. You'll feel at first that the syntax is daunting. A lot of "divisions", "sections" , "paragraphs" ... just try to understand why they exist. Nobody writes those labels. The way COBOL uses and redefines data structures is perhaps the most interesting concept, try to understand it well.

  2. This is the key point. I said "COBOL is easy". Now the bad news: being a fair mainframe COBOL programmer is NOTeasy. But that has nothing to do with COBOL, it's the environment. The mainframe is big, and there are a lot of "ecosystems" in there. You have DB2, CICS, some JCL, and VSAM as a bare minimum, and perhaps a dozen more, depending on your installation. Printers, tapes and other specialized and hard to manage hardware too. Each one of them requires several years to tame, and that's the real value of a good mainframe programmer. Microfocus had an expensive compiler/environment product that was able to emulate a few of these features, but I think it's out of market now.
    Anyway, dexterity with those features are usually acquired "on the shop" and very difficult (believe me) to get from a book or courseware.

  1. COBOL 是一种易于学习的语言。起初您会觉得语法令人生畏。很多“部门”、“部分”、“段落”……只是试图理解它们为什么存在。没有人写这些标签。COBOL 使用和重新定义数据结构的方式可能是最有趣的概念,尝试理解它。

  2. 这是关键点。我说“COBOL 很容易”。现在坏消息是:成为一名公平的大型机 COBOL 程序员并不容易。但这与 COBOL 无关,而是环境。大型机很大,里面有很多“生态系统”。您有 DB2、CICS、一些 JCL 和 VSAM 作为最低要求,可能还有更多,具体取决于您的安装。打印机、磁带和其他专业且难以管理的硬件。它们中的每一个都需要数年才能驯服,这就是优秀大型机程序员的真正价值所在。Microfocus 有一个昂贵的编译器/环境产品,它能够模拟其中一些功能,但我认为它现在已经过时了。
    无论如何,这些功能的灵巧性通常是“在商店里”获得的,而且很难(相信我)从书本或课件中获得。

That said, don't expect to get a mainframe job (other than a super-junior one) after learning and taming COBOL. That is just a first little step.

也就是说,不要指望在学习和驯服 COBOL 后获得一份大型机工作(除了超级初级的工作)。这只是第一步。

HTH!

哼!

回答by Joe Zitzelberger

There used to be a Cobol-to-C compiler and Eclipse IDE from a company called "The Kompany". The product was called "Kobol". It would let you write Cobol using an eclipse based environment that would be similar to what you would use for a mainframe (Rational Developer for Z). They have a free demo version and a cheap student version IIRC.

曾经有一家名为“The Kompany”的公司的 Cobol-to-C 编译器和 Eclipse IDE。该产品被称为“Kobol”。它可以让您使用基于 Eclipse 的环境编写 Cobol,该环境类似于您用于大型机的环境(Rational Developer for Z)。他们有免费的演示版和便宜的学生版 IIRC。

You will find that Cobol is easy to learn, easy to write and hard to shoot yourself in the foot with. That is one of the reasons it is so very popular with financial institutions.

您会发现 Cobol 易于学习、易于编写且难以用脚射击自己。这就是它在金融机构中如此受欢迎的原因之一。

I think it is great that you are adding Cobol to your toolbox.

我认为您将 Cobol 添加到您的工具箱中很棒。

回答by MikeC

Micro focus now offer their Personal Edition of Visual COBOL free for non-commercial use. This COBOL works with either Microsoft Visual Studio as a .Net language or Eclipse. It even comes with a lite version of Visual Studio so you don't have to buy that. You can download it from https://www.microfocus.com/product-downloads/vcpe/vcpe22/index.aspx

Micro focus 现在免费提供 Visual COBOL 个人版用于非商业用途。此 COBOL 可与作为 .Net 语言的 Microsoft Visual Studio 或 Eclipse 一起使用。它甚至带有精简版的 Visual Studio,因此您无需购买。您可以从https://www.microfocus.com/product-downloads/vcpe/vcpe22/index.aspx下载

The open source OpenCOBOL at www.opencobol.org/ has now changed its name and location. Now called GNU Cobol it may be found at sourceforge.net/projects/open-cobol/. This is an excellent COBOL that implements a substantial part of the ANS 85 and ISO 2002 COBOL standards.

www.opencobol.org/ 上的开源 OpenCOBOL 现在已更改其名称和位置。现在称为 GNU Cobol,它可以在 sourceforge.net/projects/open-cobol/ 找到。这是一个出色的 COBOL,它实现了 ANS 85 和 ISO 2002 COBOL 标准的重要部分。

The GNU COBOL site also has a link to Gary Cutler's Programmers Guide to OpenCOBOL 1.1 which is an excellent language reference. If you are looking for learning materials you can try my COBOL tutorial at www.csis.ul.ie/cobol/course

GNU COBOL 站点还有一个链接,指向 Gary Cutler 的 OpenCOBOL 1.1 程序员指南,这是一个很好的语言参考。如果您正在寻找学习材料,您可以在 www.csis.ul.ie/cobol/course 上尝试我的 COBOL 教程

There is also a very useful online version of COBOL that uses the OpenCOBOL compiler. It may be found at http://www.compileonline.com/compile_cobol_online.phpCheck out their overly long "Hello world" program. In ISO 2002 COBOL the IDENTIFICATION DIVISION is not required and since the program stops when the end of the text is reached, the STOP RUN is not required either. Only the three lines shown below are actually required. Try it yourself.

还有一个非常有用的 COBOL 在线版本,它使用 OpenCOBOL 编译器。它可以在http://www.compileonline.com/compile_cobol_online.php上找到, 看看他们过长的“Hello world”程序。在 ISO 2002 COBOL 中,不需要 IDENTIFICATION DIVISION,并且由于程序在到达文本末尾时停止,因此也不需要 STOP RUN。实际上只需要下面显示的三行。自己试试吧。

PROGRAM-ID. HELLO-WORLD.
PROCEDURE DIVISION.
   DISPLAY 'Hello, world'.

回答by colemanj

Try OpenCOBOL http://www.opencobol.org/, it's free, it runs on Windows and Linux and is being actively developed.

试试 OpenCOBOL http://www.opencobol.org/,它是免费的,可以在 Windows 和 Linux 上运行,并且正在积极开发中。

回答by AgentConundrum

Have you tried TinyCobol? I thinkI used it once and it wasn't bad.

你试过TinyCobol吗?我我用过一次,还不错。

A while back, MicroFocus had a free version of their IDE+Compiler (Net Express), but they no longer offer it. I'm pretty sure I have a copy of the installer somewherearound here, though I'm not sure that it would still be legal to install if they no longer offer the product. I can take a look later tonight (it would be on my other computer, which is currently headless and inactive) and see what I come up with.

不久前,MicroFocus 有一个免费版本的 IDE+Compiler (Net Express),但他们不再提供。我很确定我在这里某处有安装程序的副本,但我不确定如果他们不再提供该产品,安装是否仍然合法。今晚晚些时候我可以看看(它会在我的另一台计算机上,它目前是无头和不活动的),看看我想出了什么。