Page 1 of 1

CICS logical level importance?

PostPosted: Wed Jan 18, 2017 12:29 am
by tivrfoa
Hi,

I understand that the logical level is important when using EXEC CICS RETURN instead of GOBACK,
https://www.ibm.com/support/knowledgece ... fhp3p9.htm

but why would I want to create a lower logical level?

Why would I call a subprogram that uses commarea, using EXEC CICS LINK instead of CALL?

Probably in > 90% of the time subprograms want to return to the caller, so why not simply use GOBACK and don't care about how they were called?
Are there other differences if using EXEC CICS RETURN beyond the flow?

Did you have any situation that you needed to use EXEC CICS RETURN instead of GOBACK?

Thank you very much!!!

Re: CICS logical level importance?

PostPosted: Wed Jan 18, 2017 2:09 am
by Robert Sample
If you study this diagram carefully http://www.ibm.com/support/knowledgecenter/SSGMCP_4.2.0/com.ibm.cics.ts.applicationprogramming.doc/topics/dfhp3_cobol_subprog_flow.html, I believe many of your questions will be answered. As the diagram shows (look at program V for example), GOBACK and EXEC CICS RETURN behavior depends upon the invocation method -- CALL or EXEC CICS LINK (or EXEC CICS XCTL to some extent). One reason to use EXEC CICS LINK is if you use CEDF to debug the transaction, CEDF will stop at EXEC CICS LINK statements whereas it will NOT stop for CALL statements. Logical levels can be very important in CICS since a statement such as GOBACK may return to the same level program or a higher level program. If you have 20 or 30 programs at 3 or 4 or more logical levels being invoked by a transaction, with EXEC CICS LINK, EXEC CICS XCTL, and CALL statements in different programs you could easily find yourself in a program you don't expect to be in when you use GOBACK or EXEC CICS RETURN.

Re: CICS logical level importance?

PostPosted: Wed Jan 18, 2017 10:36 pm
by tivrfoa
Thanks a lot Robert.

Could someone share a use case (real world example) that you needed to use EXEC CICS RETURN instead of GOBACK?

I can't see when a subroutine would not want to return to the caller.

Re: CICS logical level importance?

PostPosted: Wed Jan 18, 2017 10:45 pm
by Robert Sample
I'm not sure you understand -- EXEC CICS LINK and CALL are used for subprograms; however, EXEC CICS XCTL is used for a same-level change of program. The new program is NOT a subprogram, and may in fact be invoked from other programs. When XCTL is used (and it is used often), EXEC CICS RETURN goes back to the previous level, not to the program that invoked the XCTLed program.

A real-world example: at a previous employer, medical exam data was stored in a hierarchical data base. Since there could be multiple types of records (lab, blood results, etc) stored for a single exam, XCTL was used to go to the correct program to display that type of data for that exam (which often required using paging). When the listing was done, no matter which program was being executed at the time, EXEC CICS RETURN would go back to the exam selection screen.