| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| whizkid79 Beginner
 
  
 Joined: 29 Sep 2004
 Posts: 53
 Topics: 14
 
 
 | 
			
				|  Posted: Mon Oct 04, 2004 2:14 pm    Post subject: Copying DB2 smallint field to a flat file |   |  
				| 
 |  
				| Hi, 
 I know that a DB2 smallint field, is stored in binary format in dataset. We cant see the value unless we do a hex on. I have a rexx program the reads a DB2 smallint field. But while copying that to a file, it's converted to char format. I tried D2X in rexx as well as in DB2, but of no use. Please let me know how I can copy a DB2 smallint field as binary to a flat file, so that i can use a copybook to view the file contents properly.
 
 Thanks.
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| SureshKumar Intermediate
 
 
 Joined: 23 Jan 2003
 Posts: 211
 Topics: 21
 
 
 | 
			
				|  Posted: Mon Oct 04, 2004 2:49 pm    Post subject: |   |  
				| 
 |  
				| whiizkid79, did you try casting the field. Like SELECT DIGITS(DB2 smallint field), it should give you numeric values. Thanks
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| kolusu Site Admin
 
  
 
 Joined: 26 Nov 2002
 Posts: 12394
 Topics: 75
 Location: San Jose
 
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| whizkid79 Beginner
 
  
 Joined: 29 Sep 2004
 Posts: 53
 Topics: 14
 
 
 | 
			
				|  Posted: Mon Oct 04, 2004 5:11 pm    Post subject: |   |  
				| 
 |  
				| Hi Kolusu, 
 I'l be more specific. I have a DB2 smallint field having value = 2. When extracted to a dataset it will be visible as dots(..). This is a 2 byte field  and on doing a HEX ON, i'll be getting the hexadecimal value of 2. But when i do the above process, the value 2 is getting displayed instead of the dots in the file. Now when i use fileaid to view the structure of the file (using a copybook), the values are not matching, because instead of the hex value, 2 is getting displayed. By requirement is to place the dots in the file while querying the smallint field from DB2, so that when i do a HEX ON, I'll be seeing the hx value of 2.
 
 Am i clear now?
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Cogito-Ergo-Sum Advanced
 
 
 Joined: 15 Dec 2002
 Posts: 637
 Topics: 43
 Location: Bengaluru, INDIA
 
 | 
			
				|  Posted: Tue Oct 05, 2004 2:52 am    Post subject: |   |  
				| 
 |  
				|  	  | Quote: |  	  | I have a DB2 smallint field having value = 2. When extracted to a dataset it will be visible as dots(..). This is a 2 byte field and on doing a HEX ON, i'll be getting the hexadecimal value of 2. But when i do the above process, the value 2 is getting displayed instead of the dots in the file. | 
 
 I do not get the above part.
 
 Just curious. But, what do you observe with a value of say, 3000 (decimal) ?
 _________________
 ALL opinions are welcome.
 
 Debugging tip:
 When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
 -- Sherlock Holmes.
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| kolusu Site Admin
 
  
 
 Joined: 26 Nov 2002
 Posts: 12394
 Topics: 75
 Location: San Jose
 
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		|  | 
	
		|  |