Debian Codegraph @

gcc/testsuite/cobol.dg/group2/STRING___UNSTRING__NOT__ON_OVERFLOW.cob

raw
1 *> { dg-do run }
2 *> { dg-output-file "group2/STRING___UNSTRING__NOT__ON_OVERFLOW.out" }
3
4 identification division.
5 program-id. prog.
6 data division.
7 working-storage section.
8 77 simple-str pic x(20).
9 77 err-str pic x(50).
10 *-----------------------------------------------------------------
11 procedure division.
12 * STRING test
13 move spaces to simple-str
14 string 'data'
15 delimited by size
16 into simple-str
17 on overflow
18 move spaces to err-str
19 string 'STRING OVERFLOW'
20 delimited by size
21 into err-str
22 end-string
23 display err-str upon syserr
24 end-display
25 display '1 failed'
26 end-display
27 not on overflow
28 display '1 passed'
29 end-display
30 end-string
31 if simple-str not = 'data'
32 display 'STRING ERROR (1): "' simple-str '"'
33 end-display
34 end-if
35 *
36 move spaces to simple-str
37 string 'data is too big here...'
38 delimited by size
39 into simple-str
40 on overflow
41 display '2 passed'
42 end-display
43 not on overflow
44 display '2 failed'
45 end-display
46 move spaces to err-str
47 string 'missing OVERFLOW'
48 delimited by size
49 into err-str
50 end-string
51 display err-str upon syserr
52 end-display
53 end-string
54 if simple-str not = 'data is too big here'
55 display 'STRING ERROR (2): "' simple-str '"'
56 end-display
57 end-if
58 *
59 * UNSTRING test
60 move spaces to simple-str
61 unstring 'data'
62 into simple-str
63 on overflow
64 move spaces to err-str
65 unstring 'UNSTRING OVERFLOW'
66 into err-str
67 end-unstring
68 display err-str upon syserr
69 end-display
70 display '3 failed'
71 end-display
72 not on overflow
73 display '3 passed'
74 end-display
75 end-unstring
76 if simple-str not = 'data'
77 display 'UNSTRING ERROR (1): "' simple-str '"'
78 end-display
79 end-if
80 *
81 move spaces to simple-str
82 unstring 'data is too big here...'
83 into simple-str
84 on overflow
85 display '4 passed'
86 end-display
87 not on overflow
88 display '4 failed'
89 end-display
90 move spaces to err-str
91 string 'missing OVERFLOW'
92 delimited by size
93 into err-str
94 end-string
95 display err-str upon syserr
96 end-display
97 end-unstring
98 if simple-str not = 'data is too big here'
99 display 'UNSTRING ERROR (2): "' simple-str '"'
100 end-display
101 end-if
102 *
103 STOP RUN.
104