| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| vijju4ubaby Beginner
 
 
 Joined: 11 Apr 2006
 Posts: 2
 Topics: 1
 
 
 | 
			
				|  Posted: Thu Apr 13, 2006 4:01 am    Post subject: Question Regarding Redefines... |   |  
				| 
 |  
				| 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 |  | 
	
		|  | 
	
		| ANIL SARATHY Beginner
 
  
 Joined: 30 Aug 2005
 Posts: 88
 Topics: 3
 Location: Syracuse,New york
 
 | 
			
				|  Posted: Thu Apr 13, 2006 7:16 am    Post subject: |   |  
				| 
 |  
				| 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
 
 
  _________________
 Anil Sarathy
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| vijju4ubaby Beginner
 
 
 Joined: 11 Apr 2006
 Posts: 2
 Topics: 1
 
 
 | 
			
				|  Posted: Thu Apr 13, 2006 8:12 am    Post subject: |   |  
				| 
 |  
				| Thanks for ur quick response..... |  | 
	
		| Back to top |  | 
	
		|  | 
	
		|  | 
	
		|  |