为什么COBOL同时具有`SECTION`和`PARAGRAPH`? [英] Why does COBOL have both `SECTION` and `PARAGRAPH`?

查看:168
本文介绍了为什么COBOL同时具有`SECTION`和`PARAGRAPH`?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么COBOL同时具有SECTIONPARAGRAPH?

Why does COBOL have both SECTION and PARAGRAPH?

有人可以解释为什么COBOL的设计师同时创建SECTIONPARAGRAPH的原因吗?自从COBOL最初发布以来,它们就已经存在了,所以我怀疑它们存在的真正原因早已消失(类似于NEXT SENTENCE之类,它们仍在语言规范中以实现向后兼容,但自从引入C#之后就不再需要了).明确的作用域终止符).

Can anybody explain why the designers of COBOL created both SECTIONs and PARAGRAPHs? These have been around since the initial release of COBOL so I suspect the real reason for their existence has long since gone away (similar to things like NEXT SENTENCE which are still in the language specification for backward compatibility but no longer required since the introduction of explicit scope terminators).

我的猜测是可能已经引入了SECTION以支持程序覆盖. SECTION具有与之相关的可选PRIORITY优先级,以标识其所属的程序叠加层.但是,大多数现代的COBOL实现都忽略或丢弃了PRIORITY数字(和覆盖图).

My guess is that SECTION may have been introduced to support program overlays. SECTION has an optional PRIORITY number associated with it to identify the program overlay it is part of. However, most modern implementations of COBOL ignore or have dropped PRIORITY numbers (and overlays).

当前,我看到在PROCEDURE DIVISIONDECLARATIVE部分中仍然需要SECTION,但是找不到任何理由.我看不到SECTIONPARAGRAPH之间的语义差异,除了PARAGRAPH属于SECTION.

Currently, I see that SECTIONs are still required in the DECLARATIVE part of the PROCEDURE DIVISION, but can find no justification for this. I see no semantic difference between SECTION and PARAGRAPH other than PARAGRAPH is subordinate to SECTION.

某些COBOL商店禁止使用SECTION代替PARAGRAPH(在北美似乎很常见).其他人则禁止PARAGRAPH来支持SECTION(在欧洲似乎很常见).还有一些人有关于何时合适的指导原则.所有这些对我来说似乎都是非常武断的-这就引出了一个问题:为什么将它们放在语言规范的首位?而且,他们今天有什么意义吗?

Some COBOL shops ban the use of SECTION in favour of PARAGRAPH (seems common in North America). Others ban PARAGRAPH in favour of SECTION (seems common in Europe). Still others have guidelines as to when each is appropriate. All of this seems highly arbitrary to me - which begs the question: Why were they put into the language specification in the first place? And, do they have any relevance today?

如果您回答此问题,那么也可以指向支持您的答案的参考文献.

If you answer this question, it would be great if you could also point to a reference to support your answer.

谢谢

推荐答案

对此没有任何引用,因为我听说它是​​从我店里的一个旧计时器传给我的,但是...

No references on this, since I heard it passed on to me from one of the old timers in my shop but...

在旧的COBOL编译器中,至少对于IBM和Unisys,可以一次将部分加载到内存中.在过去内存不足的美好年代,一个程序太大而无法一次加载到内存中,就可以使用部分将其模块化以用于内存使用.同时拥有各节和各段,使程序员可以决定哪些代码部分不能一次全部加载到内存中—为了效率起见,您希望同一执行循环的两个部分一起加载到内存中.如今,这或多或少是没有实际意义的.

In the old COBOL compilers, at least for IBM and Unisys, sections were able to be loaded into memory one at a time. Back in the good old days when memory was scarce, a program that was too large to be loaded into memory all at once was able to be modularized for memory usage using sections. Having both sections and paragraphs allowed the programmer to decide which code parts were loaded into memory together if they couldn't all be loaded at once - you'd want two parts of the same perform loop loaded together for efficiency's sake. Nowadays it's more or less moot.

我的商店仅使用段落,禁止GOTO并要求退出段落,因此我们所有的PERFORMS都是PERFORM 100-PARAGRAPH THRU 100-EXIT或类似的内容-这似乎使这些段落对我而言更像是部分.但是我不认为现在真的有很大的区别.

My shop uses paragraphs only, prohibits GOTO and requires exit paragraphs, so all our PERFORMS are PERFORM 100-PARAGRAPH THRU 100-EXIT or something similar - which seems to make the paragraphs more like sections to me. But I don't think that there's really much of a difference now.

这篇关于为什么COBOL同时具有`SECTION`和`PARAGRAPH`?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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