Author: Robert Sample
Posted: Fri Sep 16, 2016 10:37 pm (GMT 5.5)
A load module does not contain declarations of any variables; it contains storage for WORKING-STORAGE variables (whether declared in a copybook or in the actual program does not matter), and the program executable code works with offsets to registers to address the various bytes of memory. So, technically, a load module doesn't even reference variables as they are defined to the COBOL program -- it references memory locations and lengths. Note that copybooks that define records in the FD do not have memory allocated until the file OPEN occurs, so the load module may not have storage allocated for a copybooks at all.
You need to rid yourself of the idea that the executable code has any understanding of the data structures in the source code -- this simply is not the case. There are products that can retain the data structures and map them to memory when the program is executing, but these products generally work by making a copy of the data structures during the compile process so the copy can be referenced during execution. COBOL itself has nothing to do with such a process.
_________________
TANSTAAFL
The first rule of code reuse is that the code needs to be worth re-using.
"We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil." -- Donald Knuth
Posted: Fri Sep 16, 2016 10:37 pm (GMT 5.5)
A load module does not contain declarations of any variables; it contains storage for WORKING-STORAGE variables (whether declared in a copybook or in the actual program does not matter), and the program executable code works with offsets to registers to address the various bytes of memory. So, technically, a load module doesn't even reference variables as they are defined to the COBOL program -- it references memory locations and lengths. Note that copybooks that define records in the FD do not have memory allocated until the file OPEN occurs, so the load module may not have storage allocated for a copybooks at all.
You need to rid yourself of the idea that the executable code has any understanding of the data structures in the source code -- this simply is not the case. There are products that can retain the data structures and map them to memory when the program is executing, but these products generally work by making a copy of the data structures during the compile process so the copy can be referenced during execution. COBOL itself has nothing to do with such a process.
_________________
TANSTAAFL
The first rule of code reuse is that the code needs to be worth re-using.
"We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil." -- Donald Knuth