Debian Codegraph @

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

raw
1 *> { dg-do run }
2 *> { dg-output-file "group2/ALLOCATE_Rule_8_OPTION_INITIALIZE_with_figconst.out" }
3
4 identification division.
5 program-id. prog.
6 procedure division.
7 display "initialize zeroes"
8 call "prog-zeroes"
9 display "initialize low-value"
10 call "prog-low"
11 display "initialize spaces"
12 call "prog-space"
13 display "initialize high-value"
14 call "prog-high"
15 continue.
16 end program prog.
17
18 identification division.
19 program-id. prog-space.
20 options. initialize working-storage spaces.
21 data division.
22 working-storage section.
23 01 based-var based.
24 02 based-x pic x(24) value "I am I, Don Quixote".
25 02 based-9 pic 999 value 123.
26 02 based-p pointer value NULL.
27 01 allocated-pointer pointer.
28 procedure division.
29 display "allocate characters (ISO 2023 Rule 8: OPT_INIT if specified, otherwise defaultbyte, otherwise zero)"
30 allocate 35 characters returning allocated-pointer
31 set address of based-var to allocated-pointer
32 call "reporter" using based-var
33 free allocated-pointer
34 goback.
35 end program prog-space.
36
37 identification division.
38 program-id. prog-low.
39 options. initialize working-storage low-values.
40 data division.
41 working-storage section.
42 01 based-var based.
43 02 based-x pic x(24) value "I am I, Don Quixote".
44 02 based-9 pic 999 value 123.
45 02 based-p pointer value NULL.
46 01 allocated-pointer pointer.
47 procedure division.
48 display "allocate characters (ISO 2023 Rule 8: OPT_INIT if specified, otherwise defaultbyte, otherwise zero)"
49 allocate 35 characters returning allocated-pointer
50 set address of based-var to allocated-pointer
51 call "reporter" using based-var
52 free allocated-pointer
53 goback.
54 end program prog-low.
55
56 identification division.
57 program-id. prog-zeroes.
58 options. initialize working-storage binary zeroes.
59 data division.
60 working-storage section.
61 01 based-var based.
62 02 based-x pic x(24) value "I am I, Don Quixote".
63 02 based-9 pic 999 value 123.
64 02 based-p pointer value NULL.
65 01 allocated-pointer pointer.
66 procedure division.
67 display "allocate characters (ISO 2023 Rule 8: OPT_INIT if specified, otherwise defaultbyte, otherwise zero)"
68 allocate 35 characters returning allocated-pointer
69 set address of based-var to allocated-pointer
70 call "reporter" using based-var
71 free allocated-pointer
72 goback.
73 end program prog-zeroes.
74
75 identification division.
76 program-id. prog-high.
77 options. initialize working-storage high-values.
78 data division.
79 working-storage section.
80 01 based-var based.
81 02 based-x pic x(24) value "I am I, Don Quixote".
82 02 based-9 pic 999 value 123.
83 02 based-p pointer value NULL.
84 01 pval redefines based-var pointer.
85 01 allocated-pointer pointer.
86 procedure division.
87 display "allocate characters (ISO 2023 Rule 8: OPT_INIT if specified, otherwise defaultbyte, otherwise zero)"
88 allocate 35 characters returning allocated-pointer
89 set address of based-var to allocated-pointer
90 display pval
91 free allocated-pointer
92 goback.
93 end program prog-high.
94
95 identification division.
96 program-id. reporter.
97 data division.
98 linkage section.
99 01 based-var based.
100 02 based-x pic x(24).
101 02 based-9 pic 999 .
102 02 based-p pointer .
103 procedure division using based-var.
104 reportt.
105 display " (1) as allocated"
106 perform reportt2
107 goback.
108 reportt2.
109 display " " """" based-x """" with no advancing
110 display space """" based-9 """" with no advancing
111 display space based-p.
112 continue.
113 end program reporter.
114