Debian Codegraph @

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

raw
1 *> { dg-do run }
2 *> { dg-options "-dialect mf" }
3 *> { dg-output-file "group2/INSPECT_BACKWARD_simple_TALLYING.out" }
4
5 program-id. prog.
6 data division.
7 working-storage section.
8 01 item pic x(64).
9 01 counter pic 999.
10 procedure division.
11
12 move "AAXAAAYAAAAZAAAAA" to item
13 display function trim(item)
14 display "Forward:"
15
16 move zero to counter
17 inspect item tallying
18 counter for all "A"
19 display "FOR ALL A " counter
20
21 move zero to counter
22 move "AAXAAAYAAAAZAAAAA" to item
23 inspect item tallying
24 counter for all "A" after "X"
25 display "FOR ALL A after X " counter
26
27 move zero to counter
28 move "AAXAAAYAAAAZAAAAA" to item
29 inspect item tallying
30 counter for all "A" before "Z"
31 display "FOR ALL A before Z " counter
32
33 move zero to counter
34 move "AAXAAAYAAAAZAAAAA" to item
35 inspect item tallying
36 counter for all "A" after "X" before "Z"
37 display "FOR ALL A after X before Z " counter
38
39 move zero to counter
40 move "AAXAAAYAAAAZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" to item
41 inspect item tallying
42 counter for trailing "A"
43 display "FOR TRAILING A " counter
44
45
46 display "Backward:"
47 move zero to counter
48 inspect backward item tallying
49 counter for all "A"
50 display "FOR ALL A " counter
51
52 move zero to counter
53 move "AAXAAAYAAAAZAAAAA" to item
54 inspect backward item tallying
55 counter for all "A" after "X"
56 display "FOR ALL A after X " counter
57
58 move zero to counter
59 move "AAXAAAYAAAAZAAAAA" to item
60 inspect backward item tallying
61 counter for all "A" before "Z"
62 display "FOR ALL A before Z " counter
63
64 move zero to counter
65 move "AAXAAAYAAAAZAAAAA" to item
66 inspect backward item tallying
67 counter for all "A" after "Z" before "X"
68 display "FOR ALL A after Z before X " counter
69
70 move zero to counter
71 move "AAXAAAYAAAAZAAAAA" to item
72 inspect backward item tallying
73 counter for trailing "A"
74 display "FOR TRAILING A " counter
75
76 goback.
77 end program prog.
78