Cobol读取语句格式。可以用其他方式重做吗? [英] Cobol Read statement format. Can it be redone a different way?

查看:116
本文介绍了Cobol读取语句格式。可以用其他方式重做吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在下面的阅读陈述中,是否不能将其制成以下形式?我个人认为这可能更容易理解和阅读。

On this read statement below couldn't it be made into the form of the following? I think personaly it might be easier to understand and read.

基本上,read语句只是读取文件并决定应执行哪个段落。可能很难看出该程序的用途,但我真正感兴趣的是您是否可以将读取内容更改为以下所列的其他格式。

Basically the read statement is simply reading through a file and making decision on which paragraph performs should be executed. It probably is difficult to see exaclty what the program does but what I was really interested to know was if you can change the read to a different format as listed below.

READ数据文件
在结尾
...执行一些代码
在结尾
...执行低于
END-READ的代码。

READ DATA-FILE AT END ...do some code NOT AT END ...do code that is below END-READ.

类别:

    INIT-READ.                                            
    READ C AT END                                
            GO TO EOJ.                                
    IF C-ID = '  ' AND C-S = 'P'            
       GO TO I-R                                
    END-IF.                                           
    IF CID = ' ' AND C-S = 'D'             
       IF F = 'Y'                                   
          MOVE 'N' TO F                             
          MOVE 'your text here' TO RPT-ID 
          MOVE A           TO H6                  
          MOVE B           TO H7                  
          PERFORM PA THRU H-A-X             
       END-IF                                         
          PERFORM WD-CLAIM THRU W-X            
       GO TO I-R                                
    END-IF.                                           
          PERFORM N-V THRU N-V-X.             


推荐答案

在讨论线程的底部,在GNU Cobol常见问题解答, http://opencobol.add1tocobol.com/gnucobol/#performing-forever罗杰(Roger While)提到了没有段落的READ控制的一个非常好的习惯用法。

At the bottom of a discussion thread, captured in the GNU Cobol FAQ, http://opencobol.add1tocobol.com/gnucobol/#performing-forever Roger While mentioned a pretty nice idiom for READ control without paragraphs.


我在先前
的帖子中看到的一件事新闻组cobol是

One thing that I saw on earlier posts to the newsgroup cobol was

一个
空在线执行组的需求/理由是什么。

What is the need/justification for an empty inline perform group.

即。
执行
...
最终执行

ie. PERFORM ... END-PERFORM

然后,所有讨论都没有意识到
存在- b $ b退出性能[循环]

None of the discussions then realized that there is a - EXIT PERFORM [CYCLE]

因此,这是一种无需段落就可以定义
退出条件的方法。

Therefore, it is a method to to define an exit condition without having paragraphs.

ie。 (非常简单)

ie. (very simply)



PERFORM
    READ xxx
      AT END
        EXIT PERFORM
    END-READ
    MOVE something TO somewhere
END-PERFORM

.. test xxx status and somewhere




当然还有其他变体。
基本上,这意味着您没有使用$ section $ / paragraphs进行
的编码。
(建议,如果仅从性能角度考虑,则建议使用)

There are, of course, other variations. Basically, it means that you code without using section/paragraphs. (Recommended, if only from performance point of view)

请注意, CYCLE选项提供了有趣的可能性。

Note that the CYCLE option offers interesting possibilities.

Roger

这篇关于Cobol读取语句格式。可以用其他方式重做吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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