My requirement is that the name of a file is to be determined in a COBOL program and should be passed back to the JCL executing it, so that it can be used in the subsequent steps.
I know that RETURN-CODE can be used to pass back data from COBOL, but I do not think it is of any use in this case. I am also aware of the technique of setting a global variable in the JCL and passing the reference via PARMS to COBOL, where the value can be modified in the linkage section and can be used in the JCL later.
What I would like to know at this point is
1. What should linkage section variables be to accept the reference, more specifically the data type?
2. Should it be modified in the linkage section itself so that the changes reflect in the JCL or can it be changed in the logic of the COBOL program? I am asking this because the file name is determined by the logic of the program dynamically.