Linkage Practice Exercise

This exercise is intended to help you understand standard entry and exit linkage.

It is not a homework assignment and will not be graded.


You need to write a program and a subroutine. This is a bit more work than the other practice exercises.

  1. Call the program PRACTICE. It should have a save area called PRACSAVE.

  2. Start your program with standard entry linkage. Use base register 12. However, after the USING statement, put in an XDUMP.

    When you run the program, look at the XDUMP output. You will find that register 13 does have a meaningful value. This is the address of an 18-fullword save area belonging to ASSIST.

  3. You should also have a subroutine called SUB. It should also use standard entry and exit linkage. It should have a save area called SUBSAVE.

    SUB has one parameter: the address of an 18-fullword save area.

  4. In PRACTICE, load values 257, 257, 258,... 266 (these are all in decimal) into registers 2 through 10.

    Now call SUB. The parameter list should contain one item, the address of PRACSAV. Before the BALR statement, though, use XDUMP to print out the register values.

    When you run the program, you should be able to see in the XDUMP output the values you have just put in registers 1 and 15.

  5. In SUB, after the entry linkage, unload the address of PRACSAV into register 11. (As in: "L 11,0(0,1)")

    Now use XDUMP to print the contents of PRACSAV, that is, the 72 bytes starting at address 0(11).

    When you run the program, you should see in the XDUMP output the values you earlier put into registers 2 through 10.

    In SUB, also use XDUMP to print out the contents of SUBSAVE.

    When you run the program, you should see in the XDUMP output that most of SUBSAVE is uninitialized, but you should be able to spot the backward pointer.

  6. In SUB, put the value 768 (decimal) in register 15. In the exit linkage, do not restore the value of register 15.

  7. In PRACTICE, after you are back from SUB, use XDUMP to print out the register values.

    When you run the program, you should be able to see in register 15 the value you put there (which is different from what it was earlier).