I understand that XOPTS NOLINKAGE and LINKAGE can be used alrenatively in a COBOL CICS program. However, I dont understand the exact difference between these two. The only difference I can understand is: usage of XOPTS NOLINKAGE (DFHEIBLK is to be included explicitely in the linkage section) will save program from having unnecessory DFHCOMMAREA block to be included in the procedure division.
IMHO 'unncessaary' will be is too harsh verbiage in this situation.
I will rather say that NOLINKAGE will transfer the responsibility of declaring commarea structure to the programmer.
If option is LINKAGE-
CICS translator will find if program has a linkage section or not.
If not, it will insert a linkage section definition.
If programmer has just declared linkage section and nothing is defined inside it then, translator will add the definition of DFHEIBLK and DFHCOMMAREA structures in it.
And it will modify the procedure divison statement to PROCEDURE DIVISION USING DFHEIBLK DFHCOMMAREA.
When NOLINKAGE, it won't bother to check if programmer has declared it or not. This transfers the responsibility to the programmer.
Think about this hypothetical scenario-
If there is program B which is translated with NOLINKAGE option and user hasn't declared DFHCOMMAREA.
Now program A wants to LINK this program B using COMMAREA(some-variables), how will program B receive these variables?