difference between passing control to different program using return() and calling a program using xctl

559 views Asked by At

If I have ,say, 2 screens. First is the prompt screen which asks for, say, some record key and the next screen displays the information about the record. Now when I want to transfer the control to the second screen (after doing the job of the 1st screen) I can do that by :

 exec cics
    return(trans-id)
    commarea(ws-commarea)
 end exec.    

where trans-id is that of the 2nd screen.

Then what is need for using a calling function such as xctl when we already have the return() available in cics?

2

There are 2 answers

0
cschneid On

Using XCTL or LINK or dynamic CALLs confines your processing to one CICS transaction.

If you so desire, you can design your application to spread different business functions across multiple transactions, passing data with a commarea.

Historically this wasn't done for a number of reasons. Thirty years ago, some CICS Systems Programmers felt transaction IDs were a limited resource and encouraged application designers to keep processing to the minimum number of transactions possible.

Security in CICS is handled at the transaction level, so your user must have authority to execute all transactions that comprise the business function they must perform.

Resources such as temporary storage queues are often named in part using the transaction ID to differentiate and keep them separate.

Prior to CICS TS version 2 (I think) the data to be shared between those transactions was limited to the size of a commarea (32K). All supported versions of CICS now have channels and containers, allowing you to pass significantly larger amounts of data.

My experience is that it is simpler to code and easier to maintain pseudo-conversational transactions with screen interactions if the code is all in one transaction. You really want your transactions to be pseudo-conversational or non conversational. I believe this to be the overriding reason you see transactions designed to use XCTL, LINK, or dynamic CALLs.

0
James On

XCTL also doesn't allow dynamic routing (you always stay in the same CICS region), and is one way only. Pseudo-conversational return as above will let the user update the screen, and then only when they press an Attention Identifier (such as Enter) will the next program run. XCTL will run immediately.