The XCTL command passes control to another program, but the resources requested by the first program may still be allocated.
A task does not end until a RETURN statement is executed. While in LINK command, program control resumes its instruction following the LINK parameter.
The disadvantage of LINK is that it requires that both the calling program and the called program remain in main memory even though both are no longer needed.
Sometimes it is preferable to use EXEC CICS LINK and EXEC CICS XCTL rather than the facilities that the various languages provide. For example:
These CICS API commands are helpful when applied to abend handling, exceptional conditions, and attention identifiers. For example, if you have a common input-handling function that uses the EXEC CICS RECEIVE command, it might be preferable to call it with EXEC CICS LINK. By using the EXEC CICS LINK command, the input-handling function can set its own attention identifier handlers.
The EXEC CICS LINK command is helpful when it is used to distribute the processing by using the distributed program link (DPL) facility. This enables you to distribute the processing of your application to where the data resides. For example, if your region needs to apply a series of updates to a transient data queue that exists in a remote region, it might be more efficient to do this by using DPL, rather than function shipping each request individually. To do this without using EXEC CICS LINK would mean that you would have to use a remote procedure call facility of some type.
The EXEC CICS LINK command can be helpful in reducing the amount of code that you need to write.
The EXEC CICS XCTL command is helpful when you have a condition in which the calling function does not need to receive control back after the invoked function is called. With this condition, it is preferable to use EXEC CICS XCTL instead of EXEC CICS LINK, because less storage is used in the application server.
The EXEC CICS LINK and EXEC CICS XCTL commands are helpful if you are planning to migrate to another CICS platform the system that you are writing. Using these CICS API commands is preferable even at the cost of some efficiency.
Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!