Function definition: Difference between revisions

Content added Content deleted
(Add LDPL)
imported>Acediast
(→‎{{header|COBOL}}: replaced superfluous implementations with standards)
Line 1,141: Line 1,141:


=={{header|COBOL}}==
=={{header|COBOL}}==
In COBOL, ''multiply'' is a reserved word, so the requirements must be relaxed to allow a different function name. The following uses a program:
In COBOL, ''multiply'' is a reserved word, so the requirements must be relaxed to allow a different function name.
{{works with|GnuCOBOL}}
{{Works with|COBOL-85}}
The following uses a subprogram:
{{works with|IBM Enterprise COBOL for z/OS}}
<syntaxhighlight lang="cobol"> IDENTIFICATION DIVISION.
<syntaxhighlight lang="cobol"> IDENTIFICATION DIVISION.
PROGRAM-ID. myTest.
PROGRAM-ID. myTest.
Line 1,171: Line 1,171:
END PROGRAM myMultiply.</syntaxhighlight>
END PROGRAM myMultiply.</syntaxhighlight>


{{Works with|COBOL 2002}}
This example uses user-defined functions, which were added in COBOL 2002.
This example uses user-defined functions.
{{works with|GnuCOBOL|2.0}}
{{works with|IBM Enterprise COBOL for z/OS|6.4}}
<syntaxhighlight lang="cobol"> IDENTIFICATION DIVISION.
<syntaxhighlight lang="cobol"> IDENTIFICATION DIVISION.
PROGRAM-ID. myTest.
PROGRAM-ID. myTest.