Page 1 of 1

What is the difference between CALL and XCTL?

Posted: Fri Jan 10, 2025 12:21 pm
by Akshya Chopra
Hi,

What is the difference between CALL and XCTL?

Re: What is the difference between CALL and XCTL?

Posted: Fri Jan 10, 2025 10:10 pm
by zum13
Hello.

Most of the places where you will see "CALL" used are in invoking a statically linked module where you expect control to return to your program. If you run the assembly with "PRINT GEN" you can see that it's basically doing this:

Code: Select all

        L    R15,=V(OTHERMOD)
        BALR R14,R15
XCTL is used to load and pass control to an entry point in another linked module. The module will be loaded from PDS (if not already available), then control will pass to the entry point. When it returns, control will not be returned to the calling program but to what called the calling program.

CALL: https://www.ibm.com/docs/en/zos/3.1.0?t ... escription
XCTL: https://www.ibm.com/docs/en/zos/3.1.0?t ... escription
 

Re: What is the difference between CALL and XCTL?

Posted: Mon Jan 13, 2025 11:55 am
by Akshya Chopra
Thanks zum13.

So CALL and LINK can be considered equivalent?

Re: What is the difference between CALL and XCTL?

Posted: Mon Jan 13, 2025 6:05 pm
by zum13
CALL passes control to another CSECT which is in the current load module and hence is already in storage. It's for calling modules that you've statically linked, i.e. you've added an INCLUDE statement in the linkage editor to bind it into the current load module.

LINK will load a separate load module into storage (if a copy isn't already available) and pass control to it, but unlike XCTL, control will return to the caller once it's done its work.

LINK: https://www.ibm.com/docs/en/zos/3.1.0?t ... escription

Re: What is the difference between CALL and XCTL?

Posted: Mon Jan 13, 2025 8:40 pm
by Robert Sample
If you are talking about the difference between EXEC CICS CALL and EXEC CICS XCTL, the former acts as a subroutine call and will return to the program (the statement after the EXEC CICS CALL) when the subprogram ends whereas the latter transfers control to the new program and does not return to the program with EXEC CICS XCTL.