Difference Between XCTL and LINK

About CICS and BMS - In this Mainframe Forum - You can post your queries on CICS

Moderators: DikDude, Natarajan, Moderator Group

Post Reply
anilsani285
Member
Posts: 10
Joined: Sun Jul 04, 2010 5:26 pm

Difference Between XCTL and LINK

Post by anilsani285 » Wed Jul 07, 2010 10:00 pm

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
Anil-Sani

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Wed Jul 07, 2010 10:10 pm

Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

anilsani285
Member
Posts: 10
Joined: Sun Jul 04, 2010 5:26 pm

Post by anilsani285 » Wed Jul 07, 2010 10:22 pm

hi..

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


THANKS
Anil-Sani

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Wed Jul 07, 2010 11:24 pm

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.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

onlineinterviewquestions
Member
Posts: 1
Joined: Wed Jan 31, 2018 11:19 pm
Location: New Delhi
Contact:

Post by onlineinterviewquestions » Wed Jan 31, 2018 11:25 pm

The link is used to call another program and return back to itself.
XCTL is used for Transfer program control

spiThingy
Member
Posts: 2
Joined: Mon Aug 06, 2018 7:49 am

Post by spiThingy » Fri Aug 10, 2018 8:24 am

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

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others