I recall that VM/370 CP routines set CC before returning to the caller;
I don't have access to the source anymore (for the last 30 years or so)
to verify this and what technique was used.  I just remember thinking it
was different and clever (coming from a VS1/MVS background).

On 2020-06-02 5:30 p.m., Dan Greiner wrote:
Although Seymour has pointed out the OS/360 convention of placing a return code in GR15, 
there are numerous alternative approaches used elsewhere. Your example of using 
"historical opcodes" (BAL 14,some_test / BE success) was used extensively in 
the National Institute of Health (NIH) version of the Wylbur / Milton text editing / 
communications packages of the 1960s. Other operating systems and languages take 
different approaches (an early version of Bell Labs mainframe version of UNIX used R7 for 
a return code).

Other than the conventional OS-360 approach, I tend to favor the above example (i.e., 
having the subroutine set the CC, rather than the indexed-branch approach). Having the 
subroutine set the CC provides a means of having (up to) four possible actions that the 
calling program can take upon return. You state: "The problem for me was that you 
have to jump through some convolutions to set the condition code." However, you 
still have to have some determination in the subroutine that loads a condition code 
(conventional approach), or selects which branch to used (index-branch approach).

Using the indexed branch allows for many more possible actions -- not just 
binary true/false -- but may necessitate accommodating all possible branch 
cases following each return. I also agree that the indexed branch approach may 
be more complicated to maintain.

As to how to set [and preserve] the condition code, many experienced assembler programmers have yet 
to discover the "newer" instruction SET PROGRAM MASK (SPM) [and INSERT PROGRAM MASK 
(IPM)].  I say "newer" with tongue pressed firmly in cheek, since these unprivileged 
instructions have been around since the introduction of the S/370 (five decades ago).


Gary Weinhold
Senior Application Architect
DATAKINETICS | Data Performance & Optimization
Phone:+1.613.523.5500 x216
Email: weinh...@dkl.com
Visit us online at www.DKL.com
E-mail Notification: The information contained in this email and any 
attachments is confidential and may be subject to copyright or other 
intellectual property protection. If you are not the intended recipient, you 
are not authorized to use or disclose this information, and we request that you 
notify us by reply mail or telephone and delete the original message from your 
mail system.

Reply via email to