"IBM Mainframe Assembler List" <[email protected]> wrote on 
02/12/2022 10:11:13 PM:
> You could PACK the field, or just the last byte (which is just a
> nibble-swap), and CP to =P'0'.  The cond. code tells you what you want 
to
> know.


        I have to use PKA instead of PACK because the zoned data can be up 
to 31 bytes in length and PKA doesn't set the condition code. Yes, you 
said I could just PACK the last byte but I think I prefer bit testing 
similar to the following.


> Or, you could use
> IF TM,lastByte,B'11110000',O
>  It's +  F (or not signed, if you like that interpretation)
> ELSEIF TM,lastByte,B'00010000',O
>  It's -  B or D
> ELSE
>  It's +  A, C, or E
> ENDIF
> Note that this is a pure sign check, i.e. 0 is not special.
> 
> The last is more instructions, but I'd guess that it would perform the 
best
> if that matters.


        In line with the above, I will consider zoned data that ends with 
anything less than x'A0' to be invalid and will just return it to the 
caller as it was in the record.  Otherwise, I will PKA/CVBG it and then 
negate it (because PKA ignores overpunch signs and forces a packed x'.C' 
sign) if the original last byte passes the following test.

IF  0(R3),(NO,TM),X'F0'       IF WAS NEGATIVE 
AND 0(R3),(ON,TM),X'10' 
 MGHI R2,-1                    NEGATE THE 64-BIT NUMBER
ENDIF 


        After that, I will convert it back to zoned data with a floating 
left sign and an optional decimal point using EDMK.  I will use just two 
edit masks and dynamically place the optional decimal point in the second 
one.  I will also dynamically place the significance byte depending upon 
whether I want to keep leading zeroes or not.

MASK0    DC    x'402020202020202020202020202020202020202020202020202020-
               20202020206040' 
MASK1    DC    x'402020202020202020202020202020202020202020202020202020-
               20202020202060' 


Sincerely,

Dave Clark
-- 
int.ext: 91078
direct: (937) 531-6378
home: (937) 751-3300

Winsupply Group Services
3110 Kettering Boulevard
Dayton, Ohio  45439  USA
(937) 294-5331




*********************************************************************************************
This email message and any attachments is for use only by the named 
addressee(s) and may contain confidential, privileged and/or proprietary 
information. If you have received this message in error, please 
immediately notify the sender and delete and destroy the message and all 
copies. All unauthorized direct or indirect use or disclosure of this 
message is strictly prohibited. No right to confidentiality or privilege 
is waived or lost by any error in transmission. 
*********************************************************************************************

Reply via email to