Processing the data
In the PROCEDURE DIVISION
of a program,
you code the executable statements that process the data that you
defined in the other divisions. The PROCEDURE DIVISION
contains
one or two headers and the logic of your program.
About this task
The PROCEDURE DIVISION
begins with the division
header and a procedure-name header. The division header for a program
can simply be:
PROCEDURE DIVISION.
You
can code the division header to receive parameters by using the USING
phrase,
or to return a value by using the RETURNING
phrase.
To receive an argument that was passed by reference (the default) or by content, code the division header for a program in either of these ways:
PROCEDURE DIVISION USING dataname
PROCEDURE DIVISION USING BY REFERENCE dataname
Be sure to define dataname in
the LINKAGE SECTION
of the DATA DIVISION
.
To receive a parameter that was passed by value, code the division header for a program as follows:
PROCEDURE DIVISION USING BY VALUE dataname
To return a value as a result, code the division header as follows:
PROCEDURE DIVISION RETURNING dataname2
You can also combine USING
and RETURNING
in
a PROCEDURE DIVISION
header:
PROCEDURE DIVISION USING dataname RETURNING dataname2
Be sure to define dataname and dataname2 in
the LINKAGE SECTION
.
Coding the LINKAGE SECTION
Coding the PROCEDURE DIVISION for passing arguments
Using PROCEDURE DIVISION RETURNING . . .
Eliminating repetitive coding
The procedure division header (Enterprise COBOL for z/OS® Language Reference)
The USING phrase (Enterprise COBOL for z/OS Language Reference)
CALL statement (Enterprise COBOL for z/OS Language Reference)