CHAPTER 9Iteration Beyond the Basic PERFORM.PPT

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
CHAPTER 9Iteration Beyond the Basic PERFORM.PPT

Structured COBOL Programming, Stern Stern, 9th Edition CHAPTER 9 Iteration: Beyond the Basic PERFORM OBJECTIVES To familiarize you with: 1. The simple PERFORM. 2. How PERFORM statements are used for iteration. 3. The various options available with the PERFORM statement. The Simple PERFORM Reviewed The Basic Formats There are two formats of the basic PERFORM: 1. In-Line PERFORM PERFORM Statements to be executed END-PERFORM The Basic Formats 2. PERFORM Paragraph-Name PERFORM [paragraph-name-1] control returns to this statement The PERFORM paragraph-name statement will: 1. Execute all instructions in the named paragraph. 2. Transfer control to the next instruction in sequence, after the PERFORM paragraph-name. The Basic Formats Pseudocode Pseudocode for a PERFORM paragraph-name PERFORM Paragraph . . PARAGRAPH . . {Statements to be performed go here . Modularizing Programs Using PERFORM Statements Version 1: Nonmodular Approach IF AMT1-IN AMT2-IN ADD AMT1-IN TO TOTAL-1 ADD AMT2-IN TO TOTAL-2 ADD 1 TO OK-REC-CTR ELSE ADD AMT2-IN TO TOTAL-3 ADD 1 TO ERR-REC-CTR END-IF. Modularizing Programs Using PERFORM Statements Version 2: Modular Approach IF AMT1-IN AMT2-IN PERFORM 300-OK-RTN ELSE PERFORM 400-ERR-RTN END-IF. 300-OK-RTN. ADD AMT1-IN TO TOTAL-1 ADD AMT2-IN TO TOTAL-2 ADD 1 TO OK-REC-CTR. 400-ERR-RTN. ADD AMT2-IN TO TOTAL-3 ADD 1 TO ERR-REC-CTR. Executing a Group of Paragraphs with a Simple PERFORM PERFORM paragraph-name-1 {THROUGH} {THRU} paragraph-name-2 The PERFORM paragraph-name executes all statements beginning at paragraph-name-1 until the end of paragraph-name-2 is reached. Control is then transferred to the statement directly following the PERFORM. The Use and Misuse of GO TO Statements Format: GO TO paragraph-name-1 Unlike the PERFORM, which returns control to the statement f

文档评论(0)

gshshxx + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档