Difference Between LINK XCTL and COBOL Calls(Static & Dynamic)
LINK –> Every time a subprogram is invoked an initialized version of working storage is provided.
Dynamic& Static –> Not every time a separate copy of working storage is provided. It is provided only for the first time invocation of sub-program and for the subsequent entries, previous state working storage copy is provided.
In Case of LINK, the subprogram must end with a RETURN or GOBACK. Where as in case of CALL subprogram must end with GOBACK or EXIT. If return is used, it terminates the Main program as well for CALL.
Program called Using LINK should be defined in CICS using RDO. For subprograms called using CALL, CSD(CICS System Definition) should be there.
LINK –> Supports any language supported by CICS.. where as CALL supports only COBOL or Assembler.
Link Runs as a separate run unit where as call executes it as a single run unit.
With CALL more number of data items can be sent to its subprogram but in Link only one data item – DFHCOMMAREA can be sent.
CALL works in a single CICS region where as LINK can be used to invoke sub program across the regions.
In terms of efficiency, CALL would be more efficient in terms of time as it executes in the same run unit of main program. But as in case of CALL every program gets stored as a separate copy thus it is not cost effective compared to LINK/XCTL. But this is not same in all cases as in in CALL the first call statement of Sub program takes more time where as the subsequent calls takes very less time. So programmer needs to check which one is suitable for his requirement. If the sub program is being called in the same program multiple times, then CALL costs lesser than LINK/XCTL. In case of link/XCTL call cost does not vary for subsequent calls.
If there are any more differences that you wish to point out, please post via comments section right below this post.