Debian Codegraph @

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

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