Page 1 of 1

Difference Between XCTL and LINK

Posted: Wed Jul 07, 2010 10:00 pm
by anilsani285
HI...

I want to know the difference between XCTL and LINK and some examples

WHEN I SHOULD USE THE XCTL AND WHEN I SHOULD USE LINK COMMAND

Posted: Wed Jul 07, 2010 10:10 pm
by dbzTHEdinosauer

Posted: Wed Jul 07, 2010 10:22 pm
by anilsani285
hi..

THE LINKS HELPS FOR SOME EXTEND BUT I STILL NEED TO KNOW SOME REAL EXAMPLE WHERE EXACTLY WE USE THEM...


THANKS

Posted: Wed Jul 07, 2010 11:24 pm
by dbzTHEdinosauer
Use LINK to go from one module to another and then return to the first module.
you would link to a module to provide the first some data.


Use XCTL to go from one module without a need to return to the first module.
you would xctl when module-1 has finished its work and another module must continue the process.

Posted: Wed Jan 31, 2018 11:25 pm
by onlineinterviewquestions
The link is used to call another program and return back to itself.
XCTL is used for Transfer program control

Posted: Fri Aug 10, 2018 8:24 am
by spiThingy
Here's a simple example.

XCTL:
Suppose you have a CICS main menu inquiry screen that will have 2 options as below; each option will call a separate program. PROG1 will be called when option 1 is chosen, and PROG2 will be called when option 2 is chosen.

TRN1 INQUIRY SCREEN DD/MM/CCYY
HH:MM:SS

(1) PERSONAL DETAILS INQUIRY
(2) ORGANIZATION INQUIRY


SELECT OPTION: __

Since the screen itself is a running program, you may want to use XCTL to invoke the calls to PROG1 or PROG2. The screen program will transfer the control to the called PROG1 or PROG2. It will not wait for PROG1 or PROG2 to complete. We used XCTL so that the screen program may actually end and release the resources back to CICS.

sample code:
IF OPTION = '1'
EXEC CICS XCTL
PROGRAM ('PROG1')
END-EXEC
ELSE
EXEC CICS XCTL
PROGRAM ('PROG2')
END-EXEC
END-IF


LINK:
Suppose PROG1 in the previous example will call a routine program CALC1 that will calculate the individual's statistics or whatever; the data from the CALC1 obviously will be needed by PROG1, then you may want to use LINK call since PROG1 would want to wait for calculated data from CALC1 and it will wait for CALC1 program to complete.

sample code:

EXEC CICS LINK PROGRAM ('CALC1')
COMMAREA(WK-COMMAREA-DATA)
LENGTH(LENGTH OF WK-COMMAREA-DATA)
RESP(WS-EIBRESP)
END-EXEC