Debian Codegraph @

gcc/testsuite/cobol.dg/group2/FLOAT-LONG_with_SIZE_ERROR.cob

raw
1 *> { dg-do run }
2 *> { dg-output-file "group2/FLOAT-LONG_with_SIZE_ERROR.out" }
3
4 identification division.
5 program-id. prog.
6 data division.
7 working-storage section.
8 *------------------------
9 77 counter pic s9(4) binary value zero.
10 * FLOAT-LONG
11 77 doubleValue COMP-2 value 2.
12 77 lastDoubleValue COMP-2.
13 ******************************************************************
14 procedure division.
15 main section.
16 perform varying counter from 1 by 1 until
17 counter > 1060
18 *> display 'counter: ' counter ', value: ' doubleValue
19 compute doubleValue = doubleValue * 2
20 ON SIZE ERROR
21 display 'SIZE ERROR raised'
22 end-display
23 display 'SIZE ERROR, last value = ' doubleValue
24 end-display
25 exit perform
26 not ON SIZE ERROR
27 if doubleValue > lastdoubleValue
28 move doubleValue to lastdoubleValue
29 else
30 display 'math ERROR, last value > current: '
31 lastdoubleValue ' > ' doubleValue
32 end-display
33 exit perform
34 end-if
35 end-compute
36 end-perform
37 display "counter is " counter
38 if not (counter >= 1023 and <=1025)
39 display ' '
40 display 'counter is ' counter
41 end-if
42 goback.
43