Skip to main content

[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
:)

[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
:)
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!

[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
:)
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!