Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Example of different output of the same coding using Cobol '74 or '85

Status
Not open for further replies.

Crox

Programmer
Apr 3, 2000
893
NL
000300 IDENTIFICATION DIVISION.<br>000400 PROGRAM-ID. TEST0001.<br>000410*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;COPYRIGHT (C) Crox<br>000500 ENVIRONMENT DIVISION.<br>000600 CONFIGURATION SECTION.<br>000700 SOURCE-COMPUTER. IBM-PC.<br>000800 OBJECT-COMPUTER. IBM-PC.<br>000900 INPUT-OUTPUT SECTION.<br>001000 FILE-CONTROL.<br>001100 DATA DIVISION.<br>001200 FILE SECTION.<br>001300 WORKING-STORAGE SECTION.<br>001400 01&nbsp;&nbsp;HULPVELDEN.<br>001500&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;03&nbsp;&nbsp;X&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;VALUE 9&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PIC 9.<br>001510&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;03&nbsp;&nbsp;Y&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;VALUE 8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PIC 9.<br>002700 PROCEDURE DIVISION.<br>002710 HOOFD SECTION.<br>002800 0001.<br>002900&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DISPLAY 'PERFORM VARYING DIALECT ANS : '<br>003000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PERFORM HULP<br>003010&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;VARYING X FROM 1 BY 1 UNTIL X &gt; 3<br>003100&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AFTER Y FROM X BY 1 UNTIL Y &gt; 3.<br>006100 0009.<br>006200&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;STOP RUN.<br>006210<br>006300 HULP SECTION.<br>006400 0001.<br>006410&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DISPLAY 'X / Y: ' X ' / ' Y.<br>006500 0009.<br>006600&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EXIT.<br><br>compiled with the COBOL 74 compiler, jou<br>get different output compared with the<br>COBOL 85 compiler. If you use CA-REALIA<br>COBOL, you can compile with one of the<br>16 dialects it supports. Than you can<br>see the differences using that single<br>compiler. <br><br>output of the '85 compiler:<br><br>PERFORM VARYING DIALECT ANS : <br>X / Y: 1 / 1<br>X / Y: 1 / 2<br>X / Y: 1 / 3<br>X / Y: 2 / 2<br>X / Y: 2 / 3<br>X / Y: 3 / 3<br><br><br>output of the '74 compiler:<br><br>PERFORM VARYING DIALECT ANS : <br>X / Y: 1 / 1<br>X / Y: 1 / 2<br>X / Y: 1 / 3<br>X / Y: 2 / 1<br>X / Y: 2 / 2<br>X / Y: 2 / 3<br>X / Y: 3 / 2<br>X / Y: 3 / 3<br><br>So you see, you get complete different output.<br><br>There are more examples of course like<br>the alphabetic test, moves of records<br>with varying length, those kinds of<br>things. There are many of them. <br><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top