Highlighted
Absent Member.
Absent Member.
1013 views

[archive] A bit of fun with bugs

[Migrated content. Thread originally posted on 18 December 2002]

By accident I found the following (Major?) bug in AcuCobol:

Let make a quiz out of it (hope you're in for a little joke) 😉
* what does the following code display, and does it ever end?

--- cut here ---------------------------

identification division.

program-id. bugtest.
author. Frans Smits Software B.V. (Leon Arnst).

procedure division.

main section.
perform until 5
display 5
subtract 1 from 5
end-perform.

exit program.
stop run.

--- cut here ----------------------------

Sounds funny, but the answer is:
Yes, it ends after displaying
5
4
3
2
1
🙂
0 Likes
1 Reply
Highlighted
Absent Member.
Absent Member.

RE: [archive] A bit of fun with bugs

According to section 6.4.1 of the Reference Manual (Book 3) in paragraph #3, the result of the 'subtract' verb is stored in a temporary data item created by the compiler.

This sample program seems to show that the 'temporary' data item is named '5', which is why the perform can end.

Great Stuff, Frans!
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.