I writing a code for converting Fixed point Binary Number to EBCDIC and vice versa. So, far I have done with converting Fixed point Binary to EBCDIC but has no clue how to start with EBCDIC (as I am confused with '+' or '-' in my input. How shall I get rid of '+' and '-' sign and add 'FD' or 'FC' to the last nibble. Here is my code written so far,

* BEGIN LOGIC HERE

***************************************************************

*======================================================================

* CONVERTING FROM BINARY TO EBCDIC *

*======================================================================

TOEDCDIC L R6,VAL_BIN1 PUT THE BINARY NUMBER IN R6

CVD R6,VAL_PAK1 CONVERT TO PACKED DECIMAL

UNPK VAL_ZON1,VAL_PAK1 CONVERT TO UNPACKED I.E. ZONED

MVC VAL_ZT1,VAL_ZON1 MAKE A COPY OF THE ZONED VAL

TM VAL_ZT1+7,X'10'

BZ POSNUM

MVI SIGNEBC,C'-'

OI VAL_ZT1+7,X'F0' CONVERT TO EBCDIC

MVC VAL_EBC1,VAL_ZT1 COPY INTO A CHAR FILE

B RETURN

POSNUM EQU *

MVI SIGNEBC,C'+'

OI VAL_ZT1+7,X'F0'

MVC VAL_EBC1,VAL_ZT1

*======================================================================

* CONVERTING FROM EBCDIC TO BINARY *

*======================================================================

L R7,VAL_EBC2

NI VAL_EBC2,

*************************************************************

* END LOGIC HERE

********************* DATA AREAS *********************

SAVEAREA DC 18F'0'

VAL_BIN1 DC 1F'-55555' BINARY DATA 1

VAL_PAK1 DS PL11 PACKED DATA 1

VAL_ZON1 DS ZL11 ZONED DATA 1

VAL_ZT1 DS ZL11 ZONED TEMPORARY DATA 1

SIGNEBC DS CL1

VAL_EBC1 DS CL11 EBCDIC DATA 1

VAL_EBC2 DS CL11'+0000000002' EBCDIC DATA 2

VAL_ZON2 DS ZL11 ZONED DATA 2

VAL_PAK2 DS PL11 PACKED DATA 2

VAL_PT2 DS PL11 PACKED TEMPORARY DATA 2

VAL_BIN2 DS 1F BINARY DATA 2

***************************************************************

*======================================================================

* CONVERTING FROM BINARY TO EBCDIC *

*======================================================================

TOEDCDIC L R6,VAL_BIN1 PUT THE BINARY NUMBER IN R6

CVD R6,VAL_PAK1 CONVERT TO PACKED DECIMAL

UNPK VAL_ZON1,VAL_PAK1 CONVERT TO UNPACKED I.E. ZONED

MVC VAL_ZT1,VAL_ZON1 MAKE A COPY OF THE ZONED VAL

TM VAL_ZT1+7,X'10'

BZ POSNUM

MVI SIGNEBC,C'-'

OI VAL_ZT1+7,X'F0' CONVERT TO EBCDIC

MVC VAL_EBC1,VAL_ZT1 COPY INTO A CHAR FILE

B RETURN

POSNUM EQU *

MVI SIGNEBC,C'+'

OI VAL_ZT1+7,X'F0'

MVC VAL_EBC1,VAL_ZT1

*======================================================================

* CONVERTING FROM EBCDIC TO BINARY *

*======================================================================

L R7,VAL_EBC2

NI VAL_EBC2,

*************************************************************

* END LOGIC HERE

********************* DATA AREAS *********************

SAVEAREA DC 18F'0'

VAL_BIN1 DC 1F'-55555' BINARY DATA 1

VAL_PAK1 DS PL11 PACKED DATA 1

VAL_ZON1 DS ZL11 ZONED DATA 1

VAL_ZT1 DS ZL11 ZONED TEMPORARY DATA 1

SIGNEBC DS CL1

VAL_EBC1 DS CL11 EBCDIC DATA 1

VAL_EBC2 DS CL11'+0000000002' EBCDIC DATA 2

VAL_ZON2 DS ZL11 ZONED DATA 2

VAL_PAK2 DS PL11 PACKED DATA 2

VAL_PT2 DS PL11 PACKED TEMPORARY DATA 2

VAL_BIN2 DS 1F BINARY DATA 2

My Storage dump

00000000 00000000 FFFF26FD 00000000 ................

0055555D 000000F5 F5F5F5F5 FDF0F0F0 ...)...55555.000

F000F5F5 F5F5F5FD F0F0F0F0 0060F5F5 0.55555.0000.-55

F5F5F5FD F0F0F0F0 00000000 00000000 555.0000........

00000000 00000000 00000000 00000000 ................

0055555D 000000F5 F5F5F5F5 FDF0F0F0 ...)...55555.000

F000F5F5 F5F5F5FD F0F0F0F0 0060F5F5 0.55555.0000.-55

F5F5F5FD F0F0F0F0 00000000 00000000 555.0000........

00000000 00000000 00000000 00000000 ................

Thanks you for looking at my code.