John,

My comments were based on what the previous people had been discussing, namely 
a branch table.  An address table is a very viable alternative.

Item of note, unless you are working with all your own code, you have to 
validate the value in R15 before just using it to branch into a branch table 
with tests that the value is within limits and the lower 2 bits are not on.  
Such as:

         BALR  r14,r15        Call your routine
         LR    R14,R15        DON'T DISTROY R15
         CHI   R15,16         CHECK HIGH LIMIT
         JH    BADRETURN      TOO BIG?  DIE WITH MESSAGE
         N     R14,=XL4'00000003'  ANY STRAY BITS?
         JNZ   BADRETURN      YES, DIE WITH MESSAGE
         B     *+4(R15)       BRANCH ACCORDING TO RC
         ...

What I normally do is check for zero, if that is what you expect most often, 
then, if that fails, go through all the gyrations.

         BALR  r14,r15        Call your routine
         LTR   R14,R15        DID WE GET ZERO AS EXPECTED?
         BZ    RCZERO         YES, ->
         CHI   R15,16         CHECK HIGH LIMIT
         JH    BADRETURN      TOO BIG?  DIE WITH MESSAGE
         N     R14,=XL4'00000003'  ANY STRAY BITS?
         JNZ   BADRETURN      YES, DIE WITH MESSAGE
         B     *+4(R15)       BRANCH ACCORDING TO RC
         ...

I'm sure we all have our own techniques.

Chris Blaicher
Principal Software Engineer, Software Development
Syncsort Incorporated
50 Tice Boulevard, Woodcliff Lake, NJ 07677
P: 201-930-8260  |  M: 512-627-3803
E: [email protected]


-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf 
Of John Gilmore
Sent: Wednesday, May 08, 2013 3:51 PM
To: [email protected]
Subject: Re: Return codes

Chris Blaicher,

Your sort of B/T has important uses, but one composed only of addresses is 
useful too.  Perhaps it shoul;d be called an address table to avoid confusion.  
I will; send you an example privately.

John Gilmore, Ashland, MA 01721 - USA

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions, send email to 
[email protected] with the message: INFO IBM-MAIN



ATTENTION: -----

The information contained in this message (including any files transmitted with 
this message) may contain proprietary, trade secret or other  confidential 
and/or legally privileged information. Any pricing information contained in 
this message or in any files transmitted with this message is always 
confidential and cannot be shared with any third parties without prior written 
approval from Syncsort. This message is intended to be read only by the 
individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any use, disclosure, copying or distribution of this message, in any form, is 
strictly prohibited. If you have received this message in error, please 
immediately notify the sender and/or Syncsort and destroy all copies of this 
message in your possession, custody or control.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to