IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Question on storing binary number to char


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
seman18

New User


Joined: 08 Feb 2009
Posts: 67
Location: hz

PostPosted: Fri Apr 22, 2011 10:23 am
Reply with quote

I tried to store binary number into char, it shows 63 in hex
Code:
DCL BIN_E FIXED BIN(7) INIT(99);
DCL P5_E CHAR(1) BASED(ADDR(BIN_E));


however, when I change the below, it shows 00 in hex, why it failed? I am confused.
Code:
DCL BIN_E FIXED BIN(8) INIT(99);
DCL P5_E CHAR(1) BASED(ADDR(BIN_E));
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Fri Apr 22, 2011 3:08 pm
Reply with quote

A FIXED BIN (7) can occupy one byte; a FIXED BIN (8) must occupy two (SIGNED is implied). P5_E is defined on the first byte of BIN_E. In your first example, the internal representation of 99 is 63; in the second, it's 0063...and P5_E is defined on the 00, which you are seeing.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts Generate random number from range of ... COBOL Programming 3
No new posts Increase the number of columns in the... IBM Tools 3
Search our Forums:

Back to Top