| 1 |
*> { dg-do run } |
| 2 |
*> { dg-options "-dialect ibm" } |
| 3 |
*> { dg-output-file "group2/FUNCTION_LENGTH__2_.out" } |
| 4 |
program-id. prog. |
| 5 |
data division. |
| 6 |
working-storage section. |
| 7 |
01 desc1. |
| 8 |
05 desc1-entry pic x(5) occurs 10. |
| 9 |
|
| 10 |
01 desc2. |
| 11 |
05 desc2-table occurs 10 times. |
| 12 |
10 desc2-entry pic x(5). |
| 13 |
|
| 14 |
01 desc3. |
| 15 |
05 desc3-outer occurs 1 to 5 times depending on desc3-lim. |
| 16 |
10 desc3-outer-txt pic x(7). |
| 17 |
10 desc3-inner occurs 11 times. |
| 18 |
15 desc3-inner-text pic x(13). |
| 19 |
77 desc3-lim binary-long. |
| 20 |
|
| 21 |
77 msg pic x(64). |
| 22 |
77 should-be pic zzzz9. |
| 23 |
77 but-is pic zzzz9. |
| 24 |
|
| 25 |
procedure division. |
| 26 |
|
| 27 |
display "using FUNCTION LENGTH" |
| 28 |
|
| 29 |
move "function length(desc1)" to msg |
| 30 |
move 50 to should-be |
| 31 |
move function length(desc1) to but-is |
| 32 |
perform result-is |
| 33 |
|
| 34 |
move "function length(desc1-entry)" to msg |
| 35 |
move 50 to should-be |
| 36 |
move function length(desc1-entry) to but-is |
| 37 |
perform result-is |
| 38 |
|
| 39 |
move "function length(desc1-entry(1))" to msg |
| 40 |
move 5 to should-be |
| 41 |
move function length(desc1-entry(1)) to but-is |
| 42 |
perform result-is |
| 43 |
|
| 44 |
move "function length(desc2)" to msg |
| 45 |
move 50 to should-be |
| 46 |
move function length(desc2) to but-is |
| 47 |
perform result-is |
| 48 |
|
| 49 |
move "function length(desc2-table)" to msg |
| 50 |
move 50 to should-be |
| 51 |
move function length(desc2-table) to but-is |
| 52 |
perform result-is |
| 53 |
|
| 54 |
move "function length(desc2-entry)" to msg |
| 55 |
move 5 to should-be |
| 56 |
move function length(desc2-entry) to but-is |
| 57 |
perform result-is |
| 58 |
|
| 59 |
move "function length(desc2-entry(1))" to msg |
| 60 |
move 5 to should-be |
| 61 |
move function length(desc2-entry(1)) to but-is |
| 62 |
perform result-is |
| 63 |
|
| 64 |
move 5 to desc3-lim |
| 65 |
|
| 66 |
move "function length(desc3)" to msg |
| 67 |
move 750 to should-be |
| 68 |
move function length(desc3) to but-is |
| 69 |
perform result-is |
| 70 |
|
| 71 |
move "function length(desc3-outer)" to msg |
| 72 |
move 750 to should-be |
| 73 |
move function length(desc3-outer) to but-is |
| 74 |
perform result-is |
| 75 |
|
| 76 |
move "function length(desc3-outer(1))" to msg |
| 77 |
move 150 to should-be |
| 78 |
move function length(desc3-outer(1)) to but-is |
| 79 |
perform result-is |
| 80 |
|
| 81 |
move "function length(desc3-outer-txt)" to msg |
| 82 |
move 7 to should-be |
| 83 |
move function length(desc3-outer-txt) to but-is |
| 84 |
perform result-is |
| 85 |
|
| 86 |
move "function length(desc3-inner)" to msg |
| 87 |
move 143 to should-be |
| 88 |
move function length(desc3-inner) to but-is |
| 89 |
perform result-is |
| 90 |
|
| 91 |
move "function length(desc3-inner(1))" to msg |
| 92 |
move 13 to should-be |
| 93 |
move function length(desc3-inner(1)) to but-is |
| 94 |
perform result-is |
| 95 |
|
| 96 |
display "After changing desc3-lim from 5 to 3..." |
| 97 |
move 3 to desc3-lim |
| 98 |
|
| 99 |
move "function length(desc3)" to msg |
| 100 |
move 450 to should-be |
| 101 |
move function length(desc3) to but-is |
| 102 |
perform result-is |
| 103 |
|
| 104 |
move "function length(desc3-outer)" to msg |
| 105 |
move 450 to should-be |
| 106 |
move function length(desc3-outer) to but-is |
| 107 |
perform result-is |
| 108 |
|
| 109 |
move "function length(desc3-outer(1))" to msg |
| 110 |
move 150 to should-be |
| 111 |
move function length(desc3-outer(1)) to but-is |
| 112 |
perform result-is |
| 113 |
|
| 114 |
move "function length(desc3-outer-txt)" to msg |
| 115 |
move 7 to should-be |
| 116 |
move function length(desc3-outer-txt) to but-is |
| 117 |
perform result-is |
| 118 |
|
| 119 |
move "function length(desc3-inner)" to msg |
| 120 |
move 143 to should-be |
| 121 |
move function length(desc3-inner) to but-is |
| 122 |
perform result-is |
| 123 |
|
| 124 |
move "function length(desc3-inner(1))" to msg |
| 125 |
move 13 to should-be |
| 126 |
move function length(desc3-inner(1)) to but-is |
| 127 |
perform result-is |
| 128 |
|
| 129 |
goback. |
| 130 |
result-is. |
| 131 |
display function trim(msg) ": " with no advancing |
| 132 |
if but-is equal to should-be |
| 133 |
display function trim(but-is) |
| 134 |
else |
| 135 |
display "should be " function trim(should-be) |
| 136 |
" but is " function trim(but-is) |
| 137 |
end-if. |
| 138 |
end program prog. |
| 139 |
|