What is the difference between CALL and XCTL?

All sort of Mainframes Interview Questions.
Post Reply
User avatar
Akshya Chopra
Registered Member
Posts: 80
Joined: Mon May 20, 2013 11:32 pm
Algeria

What is the difference between CALL and XCTL?

Post by Akshya Chopra »

Hi,

What is the difference between CALL and XCTL?
User avatar
zum13
Active Member
Posts: 127
Joined: Thu May 04, 2023 12:58 am

Re: What is the difference between CALL and XCTL?

Post 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
 
User avatar
Akshya Chopra
Registered Member
Posts: 80
Joined: Mon May 20, 2013 11:32 pm
Algeria

Re: What is the difference between CALL and XCTL?

Post by Akshya Chopra »

Thanks zum13.

So CALL and LINK can be considered equivalent?
User avatar
zum13
Active Member
Posts: 127
Joined: Thu May 04, 2023 12:58 am

Re: What is the difference between CALL and XCTL?

Post 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
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1903
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: What is the difference between CALL and XCTL?

Post 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.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “Interview Questions.”