Thursday, December 22, 2011

CICS : CALL vs LINK

Doing DYNAMIC CALLs to other COBOL programs (subroutines) instead of LINKs in CICS for  repetitive processes provides performance gain. I created a new version of the subroutine changing the 'CICS RETURN' to a 'GOBACK'. During testing, I not only tested CALLs to the new subroutine, but I tested LINKs. I was surprised to find significantly better performance numbers when I LINK to the new subroutine (which does the 'GOBACK'), versus a LINK to the old subroutine which does the 'CICS RETURN'.

If a sub-program is accessed more than once from the same Caller, then a CALL is more efficient. Otherwise, it doesn't matter as the first CALL and any LINK are equal in overhead.

The only drawback with CALL's is that they must be LOCAL. Remote program's cannot be accessed via a CALL using Distributed Program Link (DPL).
We went through an extensive performance tuning a while back, and made considerable gains by selectively changing certain LINKs to CALLs. The big gains came in programs that were invoked many times (thousands of times!) per run unit, since the initialization of constants etc is done only the first time the program is called in a run unit.

One thing to beware of, though. We had to ensure that the invoked program was quasi-reentrant. On the second and subsequent calls in a run unit, the working storage retains its last-used state. So the rule I established was (in all programs, whether they are CALLed or LINKed to), to use VALUE clauses only on true constants (and 88-levels, of course), and to do explicit initialization of all variables, using MOVES or INITIALIZEs etc.

If those rules are followed, it is not a difficult change to start CALLing a program that was (or still is) LINKed to.


No comments:

Post a Comment

Note: Only a member of this blog may post a comment.