Sunday, April 7, 2024

MVS program control

In a job, each step runs a program. Control is passed to the program via an ATTACH macro. The macro has expanded to a SVC to ask supervisor to find and load the program and create a Request Block (RB) to indicate a level of control. Supervisor then pass control to it via BALR 14,15 wheee R14 contains the return address and R15 contains the load add re as of the program.  ATTACH will also create a TCB  

The program can issue LINK macro which ask supervisor to load another program and pass control to it. OS will create another RB for the called program to indicate another level of control. In other words, the called program will return control to the previous level when it issues a RETURN macro. 

The XCTL macro is similar to link except it means called program return control not to the immediate caller but one higher level to the caller id the caller program.  XCTL issue a SVC to replace the caller RB with the caller RB in the call chain  

The LOAD macro loads a program and return the load address. However, no SVC is called this no RB is created.  A caller can jump to the loaded program via a CALL macro and return to the caller via a RETURN macro. 

RB are linked off from TCB. The TCB points to the latest called program. The foist called program for the step will be the last element in the project list and point back to the TCB. 

No comments: