Array concatenation: Difference between revisions
Content added Content deleted
Recombinant (talk | contribs) (→{{header|Zig}}: fix, add deinit() where appropriate, use std.mem.concat) |
imported>Acediast (→{{header|COBOL}}: specified version) |
||
Line 1,210: | Line 1,210: | ||
=={{header|COBOL}}== |
=={{header|COBOL}}== |
||
{{works with|COBOL 2014}} |
|||
<syntaxhighlight lang="cobol"> identification division. |
|||
<syntaxhighlight lang="cobolfree">IDENTIFICATION DIVISION. |
|||
PROGRAM-ID. array-concat. |
|||
DATA DIVISION. |
|||
environment division. |
|||
WORKING-STORAGE SECTION. |
|||
configuration section. |
|||
01 table-one. |
|||
repository. |
|||
⚫ | |||
function all intrinsic. |
|||
01 table-two. |
|||
⚫ | |||
77 tally USAGE IS INDEX. |
|||
⚫ | |||
⚫ | |||
77 show PIC Z(4) USAGE IS DISPLAY. |
|||
PROCEDURE DIVISION. |
|||
data division. |
|||
⚫ | |||
working-storage section. |
|||
PERFORM initialize-tables |
|||
⚫ | |||
⚫ | |||
PERFORM display-result |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
END-PERFORM |
|||
⚫ | |||
⚫ | |||
⚫ | |||
END-PERFORM. |
|||
⚫ | |||
77 show pic z(4). |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
END-PERFORM. |
|||
⚫ | |||
procedure division. |
|||
⚫ | |||
⚫ | |||
⚫ | |||
perform initialize-tables |
|||
DISPLAY FUNCTION TRIM(show) ", " WITH NO ADVANCING |
|||
⚫ | |||
END-PERFORM |
|||
perform display-result |
|||
⚫ | |||
goback. |
|||
DISPLAY FUNCTION TRIM(show). |
|||
⚫ | |||
⚫ | |||
move 4 to t1 |
|||
⚫ | |||
⚫ | |||
end-perform |
|||
move 3 to t2 |
|||
⚫ | |||
⚫ | |||
end-perform |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
end-perform |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
display trim(show) ", " with no advancing |
|||
end-perform |
|||
⚫ | |||
display trim(show) |
|||
⚫ | |||
⚫ | |||
{{out}} |
{{out}} |
||
<pre> |
<pre>$ cobc -xjd array-concatenation.cob --std=cobol2014 # COBOL 2014 needed for FUNCTION TRIM |
||
6, 12, 18, 3, 6, 9, 12 |
6, 12, 18, 3, 6, 9, 12 |
||
</pre> |
</pre> |