Let's understand Mainframe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

Module 8: CICS Program and Data Passing


LINK

What the LINK command does

  • LINK transfers control from one program to another program.
  • The called program runs at the next lower logical level.
  • When the called program issues RETURN, control comes back to the program that issued the LINK.
  • It works like a subroutine call. The caller waits while the called program runs.
  • Data is passed with the COMMAREA or CHANNEL option.
  • The program name must be defined to CICS unless it is already loaded.

Syntax of the LINK command

  • PROGRAM(name) names the program to invoke. This option is required.
  • COMMAREA(data-name) passes a communication area. Give LENGTH with it.
  • CHANNEL(name) passes a channel instead of a COMMAREA.
  • INPUTMSG passes the current terminal input message to the called program.
  • Example:-
    EXEC CICS LINK PROGRAM('PROG2') COMMAREA(COMMA) LENGTH(COMMAL) END-EXEC.
  • After the LINK, execution continues with the next statement in the calling program.

How the linked program returns

  • The linked program ends with a plain EXEC CICS RETURN END-EXEC.
  • This RETURN sends control back to the program that issued the LINK.
  • Do not use RETURN TRANSID here. That would start a new task instead of returning.
  • Check EIBRESP after the LINK to see if the called program was found and ran normally.





© copyright mainframebug.com
Privacy Policy
MainframeBug Assistant