MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Question Regarding Redefines...

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
vijju4ubaby
Beginner


Joined: 11 Apr 2006
Posts: 2
Topics: 1

PostPosted: Thu Apr 13, 2006 4:01 am    Post subject: Question Regarding Redefines... Reply with quote

Hi,

I am having three variables declared as shown below...

01 A PIC X(5) VALUE 'ABCDE'.
01 B REDEFINES A PIC 9(10).
01 C PIC 9(10) VALUE 12345.

And the following are the set of prcedural stmts which are using the above variables...

ADD B TO C.
DISPLAY 'A='A.
DISPLAY 'B='B.
DISPLAY 'C='C.

The following is the output for the above code...
A=ABCDE
B=ABCDE
C=1234512345

Can anyone explain me why its diplaying 1234512345....and how it is treating the Bs value as 1234500000?Even the Numeric test on the variabl B is failing(IF B IS NUMERIC )...
Back to top
View user's profile Send private message Yahoo Messenger
ANIL SARATHY
Beginner


Joined: 30 Aug 2005
Posts: 88
Topics: 3
Location: Syracuse,New york

PostPosted: Thu Apr 13, 2006 7:16 am    Post subject: Reply with quote

i think while adding it is considering the B variable as signed decimal.

Zone decimal: first 4 bits have sign and rest four bits will have numeric value.

first 4 bits: f - unsigned c - postiv d- negative

9(1) value 4: is respresented as 11110100 ie in x"F4". type hex on in dataset to check this

so 9(10) value is abcd. : x"C1C2C3C4C0C0C0C0C0C0".


C = B + C

12345 (as 'F0F0F0F0F0F0F1F2F3F4") + "C1C2C3C4C0C0C0C0C0C0".

= 1234512345

Laughing
_________________
Anil Sarathy
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
vijju4ubaby
Beginner


Joined: 11 Apr 2006
Posts: 2
Topics: 1

PostPosted: Thu Apr 13, 2006 8:12 am    Post subject: Reply with quote

Thanks for ur quick response.....
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group