This question has asked in many interviews. Still, many people do not know when to use ‘XCTL’ command. I want to make very clear about this command.
Below is the syntax:
Exec CICS XCTL PROGRAM(program-name) [COMMAREA(data-name)] END-Exec
When, you issue a XCTL command with COMMAREA, then CICS will send a copy of data to the calling ‘program’. So, any changes to that data, will not be known to called ‘program’.
Good, now point is , after issuing ‘XCTL’ command, if you issue RETURN command in called module, what is the chemistry happens inside it?
Answer is, the called ‘program’ erases all the memory, and gives control to next program of same logical level. So, the called module, does not bother about the ‘program’ mentioned in the ‘XCTL’ command.
Which scenarios you can use ‘XCTL’ command:
- Menu driven programs- Here, you can issue ‘XCTL’ command. Since, the menu driven program just gives control to the ‘program’ as requested by user by using attention key.
- The program which you have given in the ‘XCTL’ command not present, then, you will get PGMIDERR exception
- In the Menu driven programs- You can use ‘XCTL’ command without COMMAREA.
- While calling error routine, we can use ‘XCTL’ command.
Related: CICS + Mainframe+ JOBS +Apply today!