Bobby,

Here is a simple code fragment to take a binary return code loaded into R1
and to convert it into a 4 digit decimal character string (also in R1) --

        CVD     R1,20(,R13)                     Convert to packed decimal
        UNPK    20(5,R13),25(3,R13)             Convert to zoned decimal
        OI      24(R13),C'0'                    Fix the sign position
        ICM     R1,B'1111',21(R13)              Insert the zoned decimal
result into R1

Current hardware is NOT sensitive to the alignment of the target operand of
the CVD machine instruction.

R13 is assumed to contain the address of a standard register save area.  The
R0 and R1 positions within the save area are used.  Since these would be
overwritten during a call to a subroutine, there should be no issue.

Please note that if the original binary content of R1 exceeds +/- 9999, the
4 digit decimal character string returned in R1 will equate to the absolute
value of the original binary content of R1 modulo 10000.

John P. Baker
President
NGSSA, LLC

-----Original Message-----
From: IBM Mainframe Assembler List [mailto:ASSEMBLER-LIST@LISTSERV.UGA.EDU]
On Behalf Of Bauer, Bobby (NIH/CIT) [E]
Sent: Wednesday, August 08, 2012 9:07 AM
To: ASSEMBLER-LIST@LISTSERV.UGA.EDU
Subject: Printing a return code

New to the list but been written assembler off and on for years.
I'm writing some code using the BCPii API. The return codes from the CALLs
are placed into storage in (to me) an unusual manner. In a full word that
looks like:
00000301
or
00000F01

How can I make these printable? I'm using a SNAP to debug but getting the RC
into a WTO would be a LOT easier. Any ideas?

Bobby Bauer
Center for Information Technology
National Institutes of Health
Bethesda, MD 20892-5628
301-594-7474

Reply via email to