What to Do If Your Program Loops
If your program seems to be in a loop, you should first verify
that it is looping, and then interrupt its processing and do one of
the following:
- Halt it entirely and return to the previous environment
- Restart the program at an address outside of the loop.
An indication of a program loop may be what seems to be an unreasonably long processing time.
If you are in a long loop, you can use the CP TRACE command with the RUN option and look at the addresses run to identify the loop.
In a smaller loop, you can verify a loop by checking the PSW frequently.
If the last word repeatedly contains the same series of addresses,
it is a good indication that your program is in a loop. To check the
PSW of your virtual machine, you must be in the CP command environment.
You can then use DISPLAY PSW to examine the PSW by entering:
display psw and
then enter the command BEGIN to restart the program: begin If
you are checking for a loop, you might enter both commands on the
same line using the logical line end. If the line end is set to a
pound sign (#), enter: display psw#begin When
you have determined that your program is in a loop, you can stop the
program by entering the CMS immediate command HX: hx If
you want your program to continue at an address past the loop, you
can use the CP command BEGIN to specify the address at which you want
to continue. For example, enter: begin 20cd0 You
could also use the CP command STORE to change the instruction address
in the PSW before entering the BEGIN command. For example, enter:
store psw 0 20cd0#begin