是否可以在Cobol中添加内嵌注释 [英] Is it possible to add inline comments in Cobol

查看:507
本文介绍了是否可以在Cobol中添加内嵌注释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大多数现代编程语言都提供了一种添加内嵌注释的方法,通常是使用换行符指示注释的结束的那些,以及用于指示注释开始的任意分隔符或序列的序列,同时使该行的开始是解释的指令。

Most modern programming languages give a way to add inline comments, generally those that use a newline character to indicate the end of a comment, and an arbitrary delimiter or sequence of tokens to indicate the beginning of a comment, while letting the beginning of the line being an interpreted instruction.

在COBOL中,注释整行记录(可以通过在第7列中插入一个星号( * )来完成)

In COBOL, while commenting a whole line is well documented (it can be done by putting an asterisk symbol (*) in column 7), finding documentation on whether or not you can comment the rest of the line beginning at an arbitrary position is harder.

问题是:你可以评论行开头的其余部分吗?在COBOL中的任意位置?

The question is: can you comment the rest of a line beginning at an arbitrary position in COBOL?

想象是这种注释的特殊字符,一个假想的例子:

Imagining that # is the special character for this kind of comment, here is a fictive example of what is seeked:

   *--- This structure is a dummy example
    01 MY-STRUCTURE.
        05 MY-VARIABLE PIC X VALUE '-'. # Valid values are in {-, a, b}


推荐答案

Pre Cobol 2002否

Pre Cobol 2002 No

在Cobol 2002 *>中介绍。请参阅 Cobol 2002 和搜索内嵌注释,其中给出此示例:

In Cobol 2002 *> was introduced. see Cobol 2002 and search in-line comment, which give this example:

05 Field-X Pic XX *> Used in calculating the current THINGY
...
MOVE ABC to XYZ  *> Current-XYZ
             LMN *> Saved XYZ

还有其他一些例外


  • Exec Sql - End-Exec 中。您可以对某些SQL供应商(例如Oracle)使用内嵌注释(/ * * /)。这不是真的Cobol虽然但是嵌入语言,通常通过预编译器实现。

  • 可以是允许在行注释中的Cobols实现

  • 默认情况下,许多pre Cobol 20002编译器仅查看第7列到第72列。因此列1到6 以及第71列之后的任何内容都可以包含注释。

  • In Exec Sql - End-Exec. you are able to use in-line comments (/* */) for some SQL venders (e.g. Oracle). This is not true Cobol though but an embeded language, generally implemented via a pre-compiler. Othere Exec End-exec statement may also allow in-line comments.
  • The may be Cobols implementations that allow in line comments
  • By default many pre Cobol 20002 compiler's only look at columns 7 to 72. So columns 1 to 6 and anything after column 71 can hold comments.

这篇关于是否可以在Cobol中添加内嵌注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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