Retrieves data passed by the PASSDATA clause of a PERFORM statement.
COLLECTDATA variable
variable is the name of the variable where the data is returned.
The COLLECTDATA statement is used in conjunction with the PERFORM statement. It is assumed that you are familiar with the operation of the PERFORM statement in this description.
The COLLECTDATA statement is only used in a program that has been PERFORMed by another program. The data returned to the variable is passed by the PASSDATA clause of the PERFORM statement. If no PASSDATA clause was used, then a value of null is assigned to the variable.
Use of the COLLECTDATA statement in a program that has not been PERFORMed is meaningless. In this case, the variable is assigned a null value.
PROG1 001 PERFORM 'RUN BP PROG2' PASSDATA 'ABC'
PROG2 001 COLLECTDATA COLLVAR 002 PRINT 'PROG2: DATA=':COLLVAR