COBOL 有何用途?

发布于 2024-09-24 15:19:32 字数 1437 浏览 8 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

瘫痪情歌 2024-10-01 15:19:32

通用面向商业的语言由 Grace Murray Hopper“发明”(了解她,她是其中之一)我们今天所知的计算发展的关键人物)。总体想法是产生一种基于英语的语言,而不是基于数学或在代码中表达的语言。

结构

ADD YEARS TO AGE

非常简单地说,您将使用类似于

age = age + years

或 的

age += years

。出现在 1960 年代初期,它被广泛用于业务领域的处理。仍然有大量用 COBOL 构建的应用程序仍在运行和维护,并且它仍然非常活跃。 1997 年左右,Gartner 报告称,全球 80% 的业务都在 COBOL 上运行,现有代码超过 2000 亿行,并且每年估计有 50 亿行新代码。因此,为了确保你有一份终身工作,你可以做比学习 COBOL 更糟糕的事情。

cobol 程序的结构在每个该死的程序中的助记符中进行了总结。这意味着有一个:-

  • 数据部门的程序环境部门的信息
  • 标识部门,提供有关描述硬件
  • (在我那个时代,我们使用 CODASYL 现在更广为人知,并且新近重新发明为 no-sql
  • 过程部门“这里是代码”,

因为打孔卡的遗产(是的,我也使用它们)你总是通过缩进 8 个空格来开始代码,否则一些编译器将无法识别它(Python 的阴影,其中空格很重要)

它当然是一种编译语言

。政府、各种规模的军事企业,但通常是较大的公司,所以我想你可以说到处都是,它被用来管理政府、军队和企业,我相信美国的社会福利系统运行在数百万行 Cobol 上。写于 20 世纪 60 年代中期,英国一家大型信用评级公司在整个运营过程中都使用它,并且在英国大多数建筑协会和银行都在其上运行其核心系统。

我可以继续,但我不会去阅读它。顺便说一下,如果你愿意的话,你甚至可以获得面向对象的 Cobol

COmmon Business Oriented Language 'invented' by Grace Murray Hopper ( read about her she is one one of the pivotal people in the development of computing as we know it today). The general idea was to produce a language that was English based as opposed to mathematically based or expressed as such in the code.

Very simply put you would use a construct like

ADD YEARS TO AGE

as opposed to

age = age + years

or

age += years

Appearing in the early 1960's it was massively adopted for processing in the area of business. There are still a large volume of applications built in COBOL still running and maintained and it is still very much alive and kicking. Around 1997 Gartner reported that 80% of the world's business ran on COBOL with over 200 billion lines of code in existence and with an estimated 5 billion lines of new code annually. So you could do a lot worse than learn COBOL to ensure you have a job for life.

The structure of a cobol program is summarised in the Mnemonic In Every Damn Program. Meaning that there is an:-

  • Identification Division giving information about the program
  • Environment Division describing the hardware
  • Data Division (In my day we used CODASYL now better known and newly re-invented as no-sql
  • Procedure Division 'Here be code'

Because of the legacy from punch cards (yes i used them as well) you always started the code by indenting 8 spaces in else some compilers would not recognise it (shades of Python where whitespace is significant).

It is of course a compiled language.

Where is it used. Governments, the Military Businesses of all sizes but usually the larger corporates so i suppose you could say everywhere and it is used to run governments, and the Military and business's. I believe the US's social welfare system runs on several million lines of Cobol written in the mid 60's. Experian a large UK based credit rating company uses it throughout there operation with interfaces to the web. Again in the UK most of the Building Societies and Banks run their core systems on it.

I could go on but i won't go and read about it. And by the way you can even get Object Oriented Cobol if you want

○闲身 2024-10-01 15:19:32

用过信用卡吗?您的交易可能正在接触后端的 COBOL 代码。

Ever use a credit card? Your transaction is probably touching COBOL code on the backend.

残月升风 2024-10-01 15:19:32

正确的工具适合正确的作业

批次

COBOL 最突出的一点不是它的冗长。它主要是作为一种语言被设计来进行批处理的。其 I/O 功能在这方面非常高效。

尽管它比 OOL 早一个地质时代,但在与现代 OO 程序员交谈时,从 OO 的角度描述批处理编程和 COBOL 是很有用的。这样的描述虽然在历史上是不正确的,但在概念上对面向对象程序员有所帮助。

也就是说,这完全是错误的,但却是非常正确的:

COBOL 已被“优化”以迭代大型、不,大量 顺序“集合”
(即批处理,也称为文件)。事实上,它是如此优化,以至于所有的 OO
功能已被剥离,留下打开文件、进程的基本 API
记录并关闭文件。在基本算法的更复杂版本中,多个
文件被打开,它们的记录相互匹配并被操纵以产生一个
或更多输出文件(批次)。

当 COBOL 被选用于非批处理过程时,例如伪会话编程(备份 CICS“绿色”屏幕 - 又名 BMS),它是最不合适的。毫不奇怪,这个功能很快就被用 OOL 编写的 GUI 应用程序所取代。

编辑器

IBM 大型机上的 ISPF 编辑器已经过优化,可以处理 COBOL 所需的编码类型。编辑器中操作的基本单位是行。默认情况下,垂直对齐是静态的,不会根据上下文流动或移动;键入到行尾会导致键盘锁定。由于这种“垂直对齐守恒”,复制行或行块以及对齐命令相对容易。对于 COBOL 垂直对齐,作为一个易读性问题,比 OO 语言更重要。

在一篇文章中很难描述,但是在两个编程世界和两种类型的编辑器中都有所用,我不得不说我不想在 IDE 风格的编辑器中编辑 COBOL,并且我不想编辑 Java 和ISPF 编辑器中的 C 系列语言。 (我想您可以将 ISPF 样式编辑器插入到各种 IDE 中,但我不需要去那里。)

NB OO COBOL 有其用途,但不是< /strong> 作为重新设计处理批处理的代码的新方法。

The Right Tool for the Right Job

Batch

The most salient point about COBOL is not its verboseness. It is that it was primarily designed, as a language, to do batch processing. Its I/O functionality in that regard is exceptionally efficient.

Even though it predates OOLs by a geological epoch, it is useful when speaking to a modern-day OO programmer to describe batch programming and COBOL from an OO point of view. Describing it like this, though historically incorrect, helps OO programmers conceptually.

To wit, the utterly fallacious, and yet very true:

COBOL has been "optimized" to iterate over large, nay, vast sequential "collections"
(i.e. batches, also known as files). In fact, it is so optimized, that all the OO
functionality has been stripped out, leaving a basic API that opens files, processes
records, and closes files. In more complex version of the basic algorithm, multiple
files are opened, their records matched to each other and manipulated to produce one
or more output files (batches).

Where COBOL was co-opted for non-batch processes, for instance pseudo-conversational programming (backing up CICS "green" screens - aka BMS), it was least suitable. Not surprisingly, it is this functionality that has been most quickly replaced by GUI apps written in OOLs.

The Editor

The ISPF Editor on IBM mainframes has been optimized to handle the kind of coding COBOL requires. The basic unit of manipulation in the editor is the line. By default, vertical alignment is static and not flowed or shifted based on context; typing to the end of a line results in a keyboard lock. Because of this "conservation of vertical alignment," it is relatively easy to duplicate lines or blocks of lines, and align commands. With COBOL vertical alignment, as a legibility issue, is of greater importance than OO languages.

It is difficult to describe in a post, but having facility in both programming worlds and with both types of editors, I have to say that I would not want to edit COBOL in an IDE style editor, and I would not want to edit Java and C-family languages in an ISPF Editor. (I imagine you can plug-in an ISPF style editor into the various IDEs, but I haven't had the need to go there.)

N.B. OO COBOL has its uses, but not as a new way to re-engineer code that handles batch processing.

数理化全能战士 2024-10-01 15:19:32

根据我的经验(虽然有限),COBOL 在 IBM 大型机系统中大量使用。因此,我相信在任何以 I/O 为重点的情况下(如上所述的金融系统、保险公司、政府等),只要需要或首选大型机,并且可能会使用 COBOL 已经存在了一段时间。我说它已经有一段时间了,因为在现代我很少听说 COBOL 是一种首选语言。

From my, although limited experience, COBOL is used a lot with IBM mainframe systems. So I believe in any situation where I/O is the emphasis (as mentioned above financial systems, insurance companies, government, etc) to the extent that a mainframe is needed or preferred and has been around for a while COBOL is probably used. I say been around for a while since in modern day I do not hear much of COBOL being a go to language.

氛圍 2024-10-01 15:19:32

Cobol 主要用于金融处理。任何时候银行、经纪公司、信用卡供应商等开展业务时,都会有 Cobol 的身影。

Cobol is used primarily for financial processing. Any time banks, brokerage houses, credit card vendors, et al are doign business, there will be Cobol in the mix.

神魇的王 2024-10-01 15:19:32

COBOL 的 ANSI 标准和一些编译器在过去 15 年里有了很大的发展,包括用于创建和操作 Web 框架内容和交互式站点、用于数据通信、用于在小型处理器和手持设备上运行的库。众所周知的版本以 MF、CIS、RF、RM 等字符或主要用于数据处理计算机安装的版本的新旧计算机主机制造商的名称为前缀。

The ANSI standard for COBOL and some compilers have evolved considerably in the last 15 years and include libraries for creating and operating web frame contents and interactive sites, for data communications, for running on small processors and devices used in the hand. Well known versions are prefixed with characters like MF, CIS, RF, RM or the names of computer mainframe manufacturers old and new for versions in use primarily in Data Processing computer installations.

逆蝶 2024-10-01 15:19:32

今天使用 COBOL 只是因为它在当时很流行,并且许多老牌大型企业不想将其代码重新编写为现代语言。 (主要是成本+时间)

一行COBOL代码的最大长度是72个字符长,为什么问?因为这就是打孔卡上有多少个孔。即使该语言还没有更新以允许更长的行...

COBOL 是一种邪恶的、古老的语言,几乎没有什么用了,除非您正在扩展旧程序...

Today COBOL is used only because it used to be popular back in the day, and many old large businesses don't want to re-write their code into a modern language. (mainly cost + time)

The maximum length of a line of COBOL code is 72 characters long, why you ask? Because that's how many holes there were in punch cards. Even still the language hasn't been updated to allow for longer lines...

COBOL is an evil, ancient language that has little use any more, unless you are extending OLD programs...

你在我安 2024-10-01 15:19:32

COBOL 用于商业应用程序。 Fortran 适用于科学应用程序。用于硬件和固件的 C 和 C++。用于网络的 Java。

那么你可能会问,为什么是 COBOL?嗯,COBOL 的商业编程比任何其他语言都容易十倍。

例如,将数字移至报表字段并将其格式化为货币:

   MOVE VAL-A TO REPORT-FIELD-A.

不需要 getter 或 setter 方法。无需为每个 MOVE 语句编写两种方法。

所有对字符串字符的更改以及对 $99,999.99 的格式化都是自动的。尝试用任何其他语言进行此操作。

肮脏的小秘密是 COBOL 实际上是一种美化的汇编宏语言。甚至还有一个编译器选项来打印汇编代码。这使得它易于理解且功能强大。

COBOL:简单、快速、准确、可读和可维护。老板所要求的一切。

COBOL is used for Business applications. Fortran is for scientific apps. C and C++ for hardware and firmware. Java for the web.

Then you may ask, why COBOL? Well, COBOL is about ten times easier to program for business than any of the other languages.

For example, to move a numeric to a report field and format it as a currency:

   MOVE VAL-A TO REPORT-FIELD-A.

There are no getter or setter methods needed. No need to program two methods for each MOVE statement.

And all the changing to string characters, and formating to $99,999.99 IS automatic. Try that in any of the other languages.

The dirty little secret is that COBOL is really a glorified ASSEMBLER MACRO language. There is even a compiler option to print the assembler code. That makes it easy to understand and powerful.

COBOL: Easy, quick, accurate, readable and maintainable. Everything a boss could ask for.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文